Skip to content

Commit

Permalink
Merge pull request #3889 from camptocamp/pg_qgis
Browse files Browse the repository at this point in the history
Add doc and target to edit the QGIS configuration file.
  • Loading branch information
Patrick Valsecchi committed Jul 2, 2018
2 parents 2310455 + 71121e7 commit 8581307
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
35 changes: 35 additions & 0 deletions doc/integrator/backend_qgis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,38 @@ settings and add the variable environment setting in the Apache config:
+ SetEnv PGSERVICEFILE path/to/pg_service.conf
Don't forget to restart Apache.

Docker
******

In a Docker mode, QGIS is configured in the ``qgisserver/`` directory. To edit the configuration,
run this target and open the ``/etc/project/project.qgs`` file:

.. prompt:: bash

./docker-run make edit-qgis-project

If you want to add PostGIS layers on the main DB, create/edit your ``$HOME/.pg_service.conf`` file
and add a section for the DB you want to access:

.. code::
[demo_geomapfish]
host=10.27.10.57
dbname=demo_geomapfish_2_3
user=<???>
password=<???>
port=5432
Then, in QGIS, fill only the ``name`` and ``service`` fields when you create the DB connection.
Then, you can create/edit a ``qgisserver/pg_service.conf.tmpl`` file and add a section looking
like that:

.. code::
[demo_geomapfish]
host=${PGHOST}
dbname=${PGDATABASE}
user=${PGUSER}
password=${PGPASSWORD}
port=${PGPORT}
Original file line number Diff line number Diff line change
Expand Up @@ -783,3 +783,17 @@ secrets:
gpg --output secrets.tar.bz2 --decrypt secrets.tar.bz2.gpg
tar -jxf secrets.tar.bz2
rm secrets.tar.bz2

# QGIS

.PHONY: edit-qgis-project
edit-qgis-project:
IP=$$(ip addr show dev $$(route | grep default | awk '{print $$(NF)}' | head -1) | awk '$$1 ~ /^inet/ { sub("/.*", "", $$2); print $$2 }' | head -1); \
docker run -ti \
--add-host=db:$$IP \
--volume $$PWD/qgisserver:/etc/qgisserver \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume $$HOME:$$HOME \
--env DISPLAY=unix$${DISPLAY} \
--env "PGSERVICEFILE=$$HOME/.pg_service.conf" \
--rm camptocamp/qgis-server:3.2 /usr/local/bin/start-client

0 comments on commit 8581307

Please sign in to comment.