# g3w-suite/g3w-suite-docker architecture

> Architecture diagram of the GitHub repository g3w-suite/g3w-suite-docker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/g3w-suite/g3w-suite-docker
- Repository: https://github.com/g3w-suite/g3w-suite-docker

## Overview

1. **What this repository is**
   - This repo is not the GIS application itself; it is the **Docker-based deployment layer** for G3W-SUITE, a self-hosted web GIS stack.
   - Its main job is to assemble, configure, and operate the runtime environment around the application.

2. **Top-level runtime topology**
   - The system is centered on a **Docker Compose stack** with multiple variants:
     - `docker-compose.yml` for production/default
     - `docker-compose-dev.yml` for development
     - `docker-compose-consumer.yml` for batch/consumer mode
   - The stack is designed to run a browser-facing web app behind a reverse proxy, with a database and supporting services alongside it.

3. **Core application service**
   - The main application container is built from `Dockerfile.g3wsuite.dockerfile`.
   - It runs the G3W-SUITE backend via **Gunicorn**; the startup path is explicitly:
     - image build
     - `scripts/setup.sh`
     - `scripts/docker-entrypoint.sh`
     - Gunicorn process
   - The app appears to be a Python/Django-based service, with a custom settings layer in `config/g3w-suite/settings_docker.py`.

4. **Reverse proxy and HTTP/HTTPS edge**
   - `config/nginx` contains the Nginx configuration and served error pages.
   - Nginx acts as the external entrypoint for the stack, handling:
     - HTTP routing to the app
     - optional SSL termination
     - static/error assets
   - HTTPS is optionally enabled with **Let’s Encrypt**, using `run_certbot.sh` and `scripts/makefile/renew-ssl.sh`.

5. **Spatial data persistence**
   - The data store is **PostgreSQL with PostGIS**; the README notes a migration from PostgreSQL/PostGIS 11/2.5 to 16/3.4 in v3.8.
   - Database access and operational state are persisted through `shared-volume` and `secrets`, indicating the stack keeps durable state outside the ephemeral containers.
   - Backup/restore is a first-class operational concern, with scripts under `scripts/makefile/`.

6. **Async/batch processing path**
   - The README explicitly mentions **Huey** for batch processing and a separate consumer stack (`docker-compose-consumer.yml`).
   - This means the architecture supports an asynchronous worker mode in addition to the request/response web path.
   - Redis is likely the coordination/cache/message component for this background work, based on the provided service access commands and common G3W-SUITE deployment layout.

7. **GIS server/runtime dependencies**
   - The repo includes a dedicated build path for **QGIS Server** dependencies and an Oracle-specific QGIS server image:
     - `Dockerfile.g3wsuite-deps*.dockerfile`
     - `docker/Dockerfile.qgis-server-oracle.dockerfile`
   - This suggests the stack has a GIS rendering/service layer that depends on QGIS runtime components and may support multiple backend database/vendor variants.

8. **Image build pipeline**
   - The repository separates base dependencies from the final application image:
     - dependency image build first
     - main app image build second
   - GitHub Actions workflows automate build/test/push for:
     - main image
     - LTR dependencies
     - backports
     - test builds
   - This is a container-image-first architecture rather than a source-only deployment.

9. **Configuration and override boundaries**
   - The deployment is highly configurable through mounted files rather than code changes:
     - `config/g3w-suite/overrides/templates`
     - `config/g3w-suite/overrides/static/style.css`
     - `config/g3w-suite/settings_docker.py`
     - `config/qgis/QGIS3.ini`
   - These are the main “customization seams” for branding, app settings, and QGIS behavior.

10. **Secrets and host integration**
   - Sensitive runtime files live under `secrets/`, including:
     - PostgreSQL service configuration
     - QGIS auth database
     - passwords
   - This points to a deployment model where containers consume host-provided credentials and auth material rather than baking secrets into images.

11. **Operational scripts and lifecycle tooling**
   - `scripts/docker-entrypoint*.sh`, `scripts/setup.sh`, and the Makefile-oriented helpers are the operational glue.
   - The repo also includes utility scripts for:
     - database backup/restore
     - SSL renewal
     - debugger attachment
     - container entrypoint variations for dev/consumer modes

12. **How data flows through the system**
   - External browser traffic enters via Nginx.
   - Nginx forwards app requests to the G3W-SUITE Gunicorn service.
   - The app reads/writes spatial and application state in PostgreSQL/PostGIS.
   - Background jobs, when enabled, run in the consumer worker path and coordinate through the async stack.
   - QGIS-related rendering/server functionality depends on the QGIS runtime and its configuration mounted into the containers.

13. **Important diagram boundaries**
   - A good architecture diagram should clearly separate:
     - the **edge proxy** layer
     - the **web application container**
     - the **spatial database**
     - the **async worker/consumer path**
     - the **build-time image pipeline**
     - the **host-mounted config/secrets volumes**
   - The repo’s main concern is not application logic, but the **packaging and orchestration boundaries** around a GIS platform.

Main entry points: [`Dockerfile.g3wsuite.dockerfile`](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite.dockerfile) (G3W app), [`docker-compose.yml`](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose.yml) (Compose stack), [`config/nginx/nginx.conf`](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/nginx/nginx.conf) (Nginx edge), [`.github/workflows/build_and_push_main_image.yml`](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/.github/workflows/build_and_push_main_image.yml) (GitHub Actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_runtime["Runtime stack"]
  node_docker_compose_main["Compose stack<br/>orchestration<br/>[docker-compose.yml]"]
  node_docker_compose_dev["Dev stack<br/>orchestration"]
  node_docker_compose_consumer["Consumer stack<br/>orchestration"]
  node_nginx_edge["Nginx edge<br/>reverse-proxy<br/>[nginx.conf]"]
  node_g3w_app["G3W app<br/>web-app"]
  node_db_postgis[("PostGIS DB<br/>database")]
  node_async_worker["Huey worker"]
  node_redis_coord[("Redis<br/>coordination-store")]
  node_qgis_runtime["QGIS runtime<br/>gis-server-runtime"]
end

subgraph group_group_build["Build pipeline"]
  node_deps_image["Deps image<br/>base-image"]
  node_ltr_deps_image["LTR deps<br/>base-image"]
  node_main_image["App image<br/>container-image"]
  node_ci_workflows["GitHub Actions<br/>ci-cd"]
end

subgraph group_group_config["Config and secrets"]
  node_app_settings["App settings<br/>config<br/>[settings_docker.py]"]
  node_qgis_config["QGIS config<br/>[QGIS3.ini]"]
  node_nginx_overrides["Nginx assets<br/>config"]
  node_secrets_mount[("Secrets<br/>secret-volume")]
  node_shared_volume["Shared volume<br/>runtime-volume"]
end

subgraph group_group_ops["Operations"]
  node_setup_entrypoint["Setup entry<br/>bootstrap-script<br/>[setup.sh]"]
  node_docker_entrypoint["App entrypoint<br/>entrypoint-script"]
  node_consumer_entrypoint["Worker entry<br/>entrypoint-script"]
  node_ssl_renewal["SSL renewal<br/>ops-script<br/>[renew-ssl.sh]"]
  node_db_ops["DB ops<br/>ops-script<br/>[db-backup.sh]"]
  node_debug_tools["Debug tools<br/>ops-tooling"]
end

node_docker_compose_main -->|"runs"| node_nginx_edge
node_docker_compose_main -->|"runs"| node_g3w_app
node_docker_compose_main -->|"uses"| node_db_postgis
node_docker_compose_main -->|"mounts"| node_secrets_mount
node_docker_compose_main -->|"mounts"| node_shared_volume
node_docker_compose_dev -->|"runs"| node_g3w_app
node_docker_compose_dev -->|"runs"| node_nginx_edge
node_docker_compose_consumer -->|"runs"| node_async_worker
node_async_worker -->|"coordinates with"| node_redis_coord
node_nginx_edge -->|"forwards to"| node_g3w_app
node_nginx_edge -.->|"serves"| node_qgis_runtime
node_g3w_app -->|"reads/writes"| node_db_postgis
node_g3w_app -->|"depends on"| node_qgis_runtime
node_g3w_app -->|"loads"| node_app_settings
node_g3w_app -->|"starts with"| node_setup_entrypoint
node_g3w_app -->|"starts with"| node_docker_entrypoint
node_async_worker -->|"starts with"| node_consumer_entrypoint
node_qgis_runtime -->|"configured by"| node_qgis_config
node_nginx_edge -->|"configured by"| node_nginx_overrides
node_g3w_app -->|"reads"| node_shared_volume
node_g3w_app -->|"reads"| node_secrets_mount
node_db_postgis -.->|"managed by"| node_db_ops
node_nginx_edge -.->|"managed by"| node_ssl_renewal
node_main_image -->|"built from"| node_deps_image
node_main_image -->|"packages"| node_g3w_app
node_ltr_deps_image -.->|"variant of"| node_deps_image
node_ci_workflows -->|"builds"| node_deps_image
node_ci_workflows -->|"builds"| node_main_image
node_ci_workflows -->|"builds"| node_ltr_deps_image
node_ci_workflows -.->|"tests"| node_docker_compose_main
node_debug_tools -.->|"attaches to"| node_g3w_app
node_db_ops -->|"operates on"| node_db_postgis

click node_docker_compose_main "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose.yml"
click node_docker_compose_dev "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-dev.yml"
click node_docker_compose_consumer "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-consumer.yml"
click node_nginx_edge "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/nginx/nginx.conf"
click node_g3w_app "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite.dockerfile"
click node_async_worker "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-consumer.yml"
click node_redis_coord "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-consumer.yml"
click node_qgis_runtime "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker/Dockerfile.qgis-server-oracle.dockerfile"
click node_deps_image "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite-deps.dockerfile"
click node_ltr_deps_image "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite-deps.ltr.dockerfile"
click node_main_image "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite.dockerfile"
click node_ci_workflows "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/.github/workflows/build_and_push_main_image.yml"
click node_app_settings "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/g3w-suite/settings_docker.py"
click node_qgis_config "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/qgis/QGIS3.ini"
click node_nginx_overrides "https://github.com/g3w-suite/g3w-suite-docker/tree/dev/config/nginx"
click node_secrets_mount "https://github.com/g3w-suite/g3w-suite-docker/tree/dev/secrets"
click node_shared_volume "https://github.com/g3w-suite/g3w-suite-docker/tree/dev/shared-volume"
click node_setup_entrypoint "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/setup.sh"
click node_docker_entrypoint "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/docker-entrypoint.sh"
click node_consumer_entrypoint "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/docker-consumer-entrypoint.sh"
click node_ssl_renewal "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/makefile/renew-ssl.sh"
click node_db_ops "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/makefile/db-backup.sh"
click node_debug_tools "https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/debugger/gunicorn_debugger.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_docker_compose_main,node_docker_compose_dev,node_docker_compose_consumer,node_nginx_edge,node_g3w_app,node_db_postgis,node_async_worker,node_redis_coord,node_qgis_runtime toneBlue
class node_deps_image,node_ltr_deps_image,node_main_image,node_ci_workflows toneAmber
class node_app_settings,node_qgis_config,node_nginx_overrides,node_secrets_mount,node_shared_volume toneMint
class node_setup_entrypoint,node_docker_entrypoint,node_consumer_entrypoint,node_ssl_renewal,node_db_ops,node_debug_tools toneRose
```

## Components

### Runtime stack

Containerized services and request/data flows

- [Compose stack](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose.yml): orchestration · Primary production deployment topology · `docker-compose.yml`
- [Dev stack](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-dev.yml): orchestration · Development-focused compose variant · `docker-compose-dev.yml`
- [Consumer stack](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-consumer.yml): orchestration · Batch/worker compose variant for async processing · `docker-compose-consumer.yml`
- [Nginx edge](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/nginx/nginx.conf): reverse-proxy · External HTTP/HTTPS entrypoint and routing layer · `config/nginx/nginx.conf`
- [G3W app](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite.dockerfile): web-app · Main application container running Gunicorn · `Dockerfile.g3wsuite.dockerfile`
- **PostGIS DB**: database · Persistent spatial data store for the platform
- [Huey worker](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-consumer.yml): worker · Background job consumer for batch processing · `docker-compose-consumer.yml`
- [Redis](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker-compose-consumer.yml): coordination-store · Async coordination/cache backend used by background work · `docker-compose-consumer.yml`
- [QGIS runtime](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/docker/Dockerfile.qgis-server-oracle.dockerfile): gis-server-runtime · QGIS server dependencies and vendor-specific runtime image · `docker/Dockerfile.qgis-server-oracle.dockerfile`

### Build pipeline

Image builds and CI workflows

- [Deps image](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite-deps.dockerfile): base-image · Shared dependency layer built before the app image · `Dockerfile.g3wsuite-deps.dockerfile`
- [LTR deps](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite-deps.ltr.dockerfile): base-image · Long-term-support dependency image variants · `Dockerfile.g3wsuite-deps.ltr.dockerfile`
- [App image](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/Dockerfile.g3wsuite.dockerfile): container-image · Final application image built from dependencies and app sources · `Dockerfile.g3wsuite.dockerfile`
- [GitHub Actions](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/.github/workflows/build_and_push_main_image.yml): ci-cd · Automated build, test, and push workflows · `.github/workflows/build_and_push_main_image.yml`

### Config and secrets

Mounted configuration, secrets, and runtime state

- [App settings](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/g3w-suite/settings_docker.py): config · Docker-specific application settings override · `config/g3w-suite/settings_docker.py`
- [QGIS config](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/config/qgis/QGIS3.ini): config · Mounted QGIS runtime configuration · `config/qgis/QGIS3.ini`
- [Nginx assets](https://github.com/g3w-suite/g3w-suite-docker/tree/dev/config/nginx): config · Nginx locations, SSL, and error-page assets · `config/nginx`
- [Secrets](https://github.com/g3w-suite/g3w-suite-docker/tree/dev/secrets): secret-volume · Host-provided passwords, service config, and auth database · `secrets`
- [Shared volume](https://github.com/g3w-suite/g3w-suite-docker/tree/dev/shared-volume): runtime-volume · Persistent runtime files including Gunicorn config · `shared-volume`

### Operations

Lifecycle, backup, SSL, and debugging tools

- [Setup entry](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/setup.sh): bootstrap-script · Container initialization and environment preparation · `scripts/setup.sh`
- [App entrypoint](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/docker-entrypoint.sh): entrypoint-script · Main container startup path before Gunicorn · `scripts/docker-entrypoint.sh`
- [Worker entry](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/docker-consumer-entrypoint.sh): entrypoint-script · Startup path for the consumer/batch container · `scripts/docker-consumer-entrypoint.sh`
- [SSL renewal](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/makefile/renew-ssl.sh): ops-script · Let’s Encrypt certificate renewal helper · `scripts/makefile/renew-ssl.sh`
- [DB ops](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/makefile/db-backup.sh): ops-script · Backup and restore helpers for the spatial database · `scripts/makefile/db-backup.sh`
- [Debug tools](https://github.com/g3w-suite/g3w-suite-docker/blob/dev/scripts/debugger/gunicorn_debugger.py): ops-tooling · Gunicorn debugger attachment utilities · `scripts/debugger/gunicorn_debugger.py`

## Connections

- Compose stack → Nginx edge: runs · Production compose stack starts the reverse proxy
- Compose stack → G3W app: runs · Production compose stack starts the application service
- Compose stack → PostGIS DB: uses · Application persists state in PostgreSQL/PostGIS
- Compose stack → Secrets: mounts · Stack injects host-managed secrets
- Compose stack → Shared volume: mounts · Stack shares durable runtime files
- Dev stack → G3W app: runs · Development variant runs the app with dev entrypoints
- Dev stack → Nginx edge: runs · Development variant can include proxy-facing routing
- Consumer stack → Huey worker: runs · Consumer compose starts the background worker
- Huey worker → Redis: coordinates with · Worker uses Redis for async coordination
- Nginx edge → G3W app: forwards to · Nginx proxies web requests to Gunicorn
- Nginx edge → QGIS runtime: serves · Edge layer exposes GIS-related runtime services through containerized backend components
- G3W app → PostGIS DB: reads/writes · Application stores domain and spatial data in PostGIS
- G3W app → QGIS runtime: depends on · Application stack depends on QGIS runtime and settings
- G3W app → App settings: loads · Docker-specific configuration overrides are mounted into the app
- G3W app → Setup entry: starts with · Container bootstrap begins with setup script
- G3W app → App entrypoint: starts with · Entrypoint hands off to Gunicorn startup
- Huey worker → Worker entry: starts with · Worker container uses dedicated entrypoint
- QGIS runtime → QGIS config: configured by · QGIS behavior is controlled by mounted ini config
- Nginx edge → Nginx assets: configured by · Nginx uses custom configs, SSL, and error assets
- G3W app → Shared volume: reads · App uses shared runtime state such as Gunicorn config
- G3W app → Secrets: reads · App consumes credentials and auth material from secrets
- PostGIS DB → DB ops: managed by · Backup and restore scripts operate on the database state
- Nginx edge → SSL renewal: managed by · Certificate renewal supports HTTPS termination
- App image → Deps image: built from · Final application image layers on shared dependencies
- App image → G3W app: packages · Main image packages the application runtime
- LTR deps → Deps image: variant of · LTR dependency image is a related base build
- GitHub Actions → Deps image: builds · CI automates dependency image builds
- GitHub Actions → App image: builds · CI automates main image build and push
- GitHub Actions → LTR deps: builds · CI automates LTR dependency variants
- GitHub Actions → Compose stack: tests · Workflow validates compose-based builds
- Debug tools → G3W app: attaches to · Debugger utilities target the Gunicorn app process
- DB ops → PostGIS DB: operates on · Database backup and restore target the spatial store
