4

I need setup QGIS Server + PostGIS (+ Lizmap) in Docker for our GIS users. I spent a lot of time reading documentation and searching for information on that matter but it's unclear for me as for sysadmin. I feel like QGIS server documentation limited on this topic. Could you direct me on right way?

EDIT: I've used Docker based Lizmap project, with my additions in docker-compose file, I've added Postgis and Pgadmin services (containers)

version: '3'
services:
  postgis:
    # image: "mdillon/postgis"
    image: "mdillon/postgis:10"
    container_name: postgis
    restart: always
    privileged: true  # add for centos7 firewall.
    volumes:
      - ./postgis:/var/lib/postgresql/data # default volumn path is /data/postgis.
    ports:
      - "9823:5432" # port 5432 of host machine will be listened.
    environment:
      - POSTGRES_PASSWORD=************** # default password is "1".
      - POSTGRES_USER=postgres # default username is "postgres".
      - PGDATA=/var/lib/postgresql/data # folder in container to store data.
      - POSTGRES_DB=postgres # default database is "postgres".

  pgadmin:
    container_name: pgadmin_container
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-support@example.org}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-************}
    volumes:
       - ./pgadmin:/root/.pgadmin
    ports:
      - "${PGADMIN_PORT:-5050}:80"
    restart: unless-stopped

  lizmap:
    image: 3liz/lizmap-web-client:3.2
    environment:
      LIZMAP_CACHEREDISDB: '1'
      LIZMAP_CACHEREDISHOST: redis
      LIZMAP_CACHESTORAGETYPE: redis
      LIZMAP_HOME: /srv/lizmap
      LIZMAP_USER: ${LIZMAP_USER_ID}
      LIZMAP_WMSSERVERURL: http://map:8080/ows/
    volumes:
      - ${LIZMAP_DIR}/instances:/srv/projects
      - ${LIZMAP_DIR}/var/lizmap-theme-config:/www/lizmap/var/lizmap-theme-config
      - ${LIZMAP_DIR}/var/lizmap-config:/www/lizmap/var/config
      - ${LIZMAP_DIR}/var/lizmap-db:/www/lizmap/var/db
      - ${LIZMAP_DIR}/www:/www/lizmap/www
      - ${LIZMAP_DIR}/www/var/log:/www/lizmap/var/log
    command:
      - php-fpm
    restart: unless-stopped
  map:
    image: 3liz/qgis-map-server:3.4
    environment:
      PGSERVICEFILE: /srv/etc/pg_service.conf
      QGSRV_CACHE_ROOTDIR: /srv/projects
      QGSRV_CACHE_SIZE: '20'
      QGSRV_LOGGING_LEVEL: DEBUG
      QGSRV_USER: ${LIZMAP_USER_ID}:${LIZMAP_USER_GID}
      ROUTER_HOST: map
    volumes:
      - ${LIZMAP_DIR}/instances:/srv/projects
      - ${LIZMAP_DIR}/etc:/srv/etc:ro
      - ${LIZMAP_DIR}/wps-data:/srv/data
    restart: unless-stopped
  redis:
    image: redis:5
  web:
    image: nginx:1
    volumes:
      - ${LIZMAP_DIR}/etc/nginx.conf:/etc/nginx/nginx.conf
      - ${LIZMAP_DIR}/var/log/nginx:/var/log/nginx
      - ${LIZMAP_DIR}:/srv/lizmap
    ports:
      - 8888:80
    depends_on:
      - lizmap

I'm able now login into lizmap in web browser, but tests projects in *.qgs files don't appears, so my lizmap web page is blank, even I try to change in UI lizmap setting regard to repository and projects. Also I'm able now to connect from Qgis Desktop on my local machine to Postgis database and use Pgadmin webclient to connect to the same Postgis database. Although I'm aware that my Postgis DB doesn't integrate with Qgis server, Lizmap and Nginx webserver. At the moment I think that I need, break down on sub tasks:

  1. Put test project (map) to my current Postgis DB
  2. Setup connection Qgis Server with Postgis DB through writing FCGI web config file for web server (in my case Nginx) . So some DB query should be writed in thi config file.
  3. Setup connection Lizmap web client with Postgis DB
  4. Probably setup/config XVFB in conjuction with QGIS server (container)
  • Hello and welcome to GIS SE. It would help what you've tried so far, so we can help you from there. – Piskr Nov 4 '19 at 8:58
  • @Piskr , thank you for respond indeed! I provide my current setup in my question. Let's discuss the possible solution :) – LocalOps Nov 19 '19 at 13:03
  • 1
    Well from what you wrote, the lizmap works, so if you want to open test projects, you need to create a repository (using lizmap in the browser) and in it you need to add your qgis project and the file provided by the lizmap-qgis plugin. If you want to connect lizmap and postgres (instead of sqlite) you can read more about it here: gis.stackexchange.com/questions/304083/… If you dont understand anything I can write a step-by-step on how to create a test project. – Piskr Nov 19 '19 at 13:11
  • Hi, I ended up here cause I'm facing the same problem, with the same docker: Lizmap container running fine but no way to view lizmap project nor to create a new repository. Any chance you still want to provide more instruction? – Luca Moiana Apr 17 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.