Skip to content

qwc-services/qwc-docker

Repository files navigation

Docker containers for QWC Services

The QWC Services are a collection of microservices providing configurations for and authorized access to different QWC2 Map Viewer components.

This repository contains a sample setup for running QWC services with docker.

Documentation

The documentation is available at qwc-services.github.io.

Versioning

Since February 2023 a new long-term-support branch of QWC2 and its services has been introduced. The respective Docker images are tagged as vYYYY.x-lts (i.e. v2023.0-lts). This branch will receive bugfix updates for approximately one year. The sample docker-compose-example.yml references these images.

The latest versions of QWC2 and its services is available as before, tagged as vYYYY-MM-DD.

Health checks for Kubernetes

Health checks are a simple way to let the system know if an instance of the app is working or not working. If an instance of the app is not working, then other services should not access it or send a request to it. Instead, requests should be sent to another instance of the app that is ready, or retried at a later time. The system should also bring the app back to a healthy state.

Readyness:

Readiness probes are designed to let Kubernetes know when the app is ready to serve traffic. Kubernetes makes sure the readiness probe passes before allowing a service to send traffic to the pod. If a readiness probe starts to fail, Kubernetes stops sending traffic to the pod until it passes.

Check is available at: /ready

Example check:

  • Return ok, if web service is initialized and running

Liveness:

Check is available at: /healthz

Liveness probes let Kubernetes know if the app is alive or dead. If the app is alive, then Kubernetes leaves it alone. If the app is dead, Kubernetes removes the Pod and starts a new one to replace it.

Example checks:

  • Check database connection (Example service: qwc-admin-gui)
  • Check if all data files are available and readable (Example service: qwc-elevation-service)

Development

Create a QWC services dir:

mkdir qwc-services
cd qwc-services/

Clone QWC Config DB:

git clone https://github.com/qwc-services/qwc-config-db.git

Clone QWC Config service:

git clone https://github.com/qwc-services/qwc-config-service.git

Clone QWC OGC service:

git clone https://github.com/qwc-services/qwc-ogc-service.git

Clone QWC Data service:

git clone https://github.com/qwc-services/qwc-data-service.git

Clone QWC Map Viewer:

git clone https://github.com/qwc-services/qwc-map-viewer.git

Clone QWC Admin GUI:

git clone https://github.com/qwc-services/qwc-admin-gui.git

See READMEs of each service for their setup.

Setup your ConfigDB and run migrations (see QWC Config DB).

Run local services (set $QGIS_SERVER_URL to your QGIS server and $QWC2_PATH to your QWC2 files):

cd qwc-config-service/
QGIS_SERVER_URL=http://localhost:8001/ows/ QWC2_PATH=qwc2/ python server.py

cd qwc-ogc-service/
QGIS_SERVER_URL=http://localhost:8001/ows/ CONFIG_SERVICE_URL=http://localhost:5010/ python server.py

cd qwc-data-service/
CONFIG_SERVICE_URL=http://localhost:5010/ python server.py

cd qwc-map-viewer/
OGC_SERVICE_URL=http://localhost:5013/ CONFIG_SERVICE_URL=http://localhost:5010/ QWC2_PATH=qwc2/ python server.py

cd qwc-admin-gui/
python server.py

Sample requests:

curl 'http://localhost:5010/ogc?ows_type=WMS&ows_name=qwc_demo'
curl 'http://localhost:5010/qwc'
curl 'http://localhost:5013/qwc_demo?VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities'
curl 'http://localhost:5012/qwc_demo.edit_points/'
curl 'http://localhost:5030/themes.json'
curl 'http://localhost:5031'

To build containers for local services, in use build: rather than image: in docker-compose.yml:

qwc-print-service:
  # image: sourcepole/qwc-print-service:v2022.01.13
  build:
    context: ./qwc-services/qwc-print-service
  # [...]