/qwc-docker

Docker containers for qwc-services

Primary LanguageShellMIT LicenseMIT

CI docker docker

Docker containers for QWC Services

Docker installation

Quick start

See QWC Services Core

Usage

Set JWT secret:

python3 -c 'import secrets; print("JWT_SECRET_KEY=\"%s\"" % secrets.token_hex(48))' >.env

Start all containers:

docker-compose up -d

Follow log output:

docker-compose logs -f

Open map viewer:

http://localhost:8088/

Connect to config DB:

psql "service=qwc_configdb"

Stop all containers:

docker-compose down

Update a single containers:

# docker-compose pull <container name>
docker-compose pull qwc-map-viewer

Update PostGIS container to ConfigDB migration ALEMBIC_VERSION (NOTE: Overwrites current database):

docker-compose build --build-arg ALEMBIC_VERSION=c77774920e5b qwc-postgis

Containers:

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)

DB connection

Setup PostgreSQL connection service file ~/.pg_service.conf for DB connections from the host machine to PostGIS container:

cat >>~/.pg_service.conf <<EOS
[qwc_configdb]
host=localhost
port=5439
dbname=qwc_demo
user=qwc_admin
password=qwc_admin
sslmode=disable

[qwc_geodb]
host=localhost
port=5439
dbname=qwc_demo
user=qwc_service_write
password=qwc_service_write
sslmode=disable

[qwc_webmapping]
host=localhost
port=5439
dbname=qwc_demo
user=qgis_server
password=qgis_server
sslmode=disable
EOS