2025-12-02 17:48:33 -03:00

289 lines
8.9 KiB
YAML

x-variables:
environment: &common_env
SPRING_PROFILES_ACTIVE: "pgconfig,acl"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
# ============================================================================
# DEPLOYMENT MODE CONFIGURATION
# ============================================================================
# GeoServer Cloud supports two deployment modes:
#
# 1. CONFIG SERVER MODE (used here):
# - Uses Spring Cloud Config Server for centralized configuration
# - Properties are provided via config server overrides (see below)
# - Enables dynamic scaling and service discovery
# - Best for Docker Compose deployments
#
# 2. STANDALONE MODE:
# - No config server, each service is self-contained
# - Uncomment the variables below and set them on each GeoServer service
# - Uses Kubernetes Services for service discovery
# - Best for Kubernetes deployments
#
# To switch to standalone mode:
# 1. Uncomment the variables below (in the common_env anchor)
# 2. Add them to each GeoServer service (wms, wfs, webui, etc.)
# 3. Change SPRING_PROFILES_ACTIVE to include "standalone"
# 4. Remove or disable the config and discovery services
# ============================================================================
#ACL_URL: http://acl:8080/acl/api
#ACL_USERNAME: admin
#ACL_PASSWORD: s3cr3t
#PGCONFIG_HOST: geoserverdb
#PGCONFIG_PORT: 5432
#PGCONFIG_DATABASE: geoserver
#PGCONFIG_USERNAME: geoserver
#PGCONFIG_PASSWORD: geoserver
# the schema is created at startup
#PGCONFIG_SCHEMA: pgconfig
x-config-server-overrides:
environment: &config-server-overrides
# ============================================================================
# CONFIG SERVER PROPERTY OVERRIDES
# ============================================================================
# These overrides ensure that all GeoServer services receive the correct
# configuration during their bootstrap phase, before they attempt to connect
# to databases or other services.
#
# HOW IT WORKS:
# - The config server reads these SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_* variables
# - It provides them as property overrides to all client applications
# - These values take precedence over default configuration files
# - Available during bootstrap phase, solving timing issues
#
# WHEN TO USE:
# - Docker Compose deployments with config server
# - When you need centralized configuration management
# - When scaling services dynamically
#
# ALTERNATIVE:
# - For Kubernetes: Use ConfigMaps/Secrets with standalone profile instead
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_ACL_URL: http://acl:8080/acl/api
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_ACL_USERNAME: admin
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_ACL_PASSWORD: s3cr3t
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_HOST: geoserverdb
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_PORT: 5432
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_DATABASE: geoserver
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_USERNAME: geoserver
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_PASSWORD: geoserver
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_SCHEMA: pgconfig
SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_INITIALIZE: true
x-gs-dependencies: &gs-dependencies
rabbitmq:
condition: service_healthy
discovery:
condition: service_healthy
geoserverdb:
condition: service_started
config:
condition: service_healthy
acl:
condition: service_healthy
volumes:
geowebcache_data: # Stores GeoWebCache tile data
geoserverdb_data: # Stores PostgreSQL data for pgconfig backend and acl
services:
geoserverdb:
# hosts the ACL service database and the pgconfig catalog backend data
# use an image with linux/amd64 and linux/arm64 support. Doesn't need to be postgis
image: imresamu/postgis:17-3.5
shm_size: 2g
environment:
POSTGRES_DB: geoserver
POSTGRES_USER: geoserver
POSTGRES_PASSWORD: geoserver
healthcheck:
test: ["CMD-SHELL", "pg_isready -U geoserver"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- geoserverdb_data:/var/lib/postgresql/data
deploy:
resources:
limits:
cpus: '4.0'
memory: 4G
acl:
image: geoservercloud/geoserver-acl:2.4.0
user: "1000:1000"
depends_on:
geoserverdb:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
PG_HOST: geoserverdb
PG_PORT: 5432
PG_DB: geoserver
PG_USERNAME: geoserver
PG_PASSWORD: geoserver
# the schema is created at startup
PG_SCHEMA: acl
'ACL_USERS_ADMIN_PASSWORD': '{noop}s3cr3t'
'ACL_USERS_GEOSERVER_PASSWORD': '{noop}s3cr3t'
GEOSERVER_BUS_ENABLED: true
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: 5672
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
deploy:
resources:
limits:
cpus: '4.0'
memory: 2G
rabbitmq:
image: rabbitmq:4-management-alpine
user: "1000:1000"
restart: unless-stopped
tmpfs:
- /var/lib/rabbitmq:size=512m,mode=1777 # Store RabbitMQ data in memory
healthcheck:
test: rabbitmq-diagnostics is_running
start_period: 10s
interval: 15s
timeout: 30s
retries: 3
deploy:
resources:
limits:
cpus: '4.0'
memory: 2G
# Spring Cloud Config service, provides centralized configuration to all
# microservices. Being a Discovery First Bootstrap configuration, it'll
# register itself with the Eureka discovery service and can be scaled
config:
image: geoservercloud/geoserver-cloud-config:2.28.1.1
user: 1000:1000 # set the userid:groupid the container runs as
environment:
<<: *config-server-overrides
# default to `native` loading the config embedded in /etc/geoserver
# use `git` to fetch the config from a git repository, and CONFIG_GIT_URI to change
# the default repository https://github.com/geoserver/geoserver-cloud-config.git
SPRING_PROFILES_ACTIVE: native
# If using the `git` profile, get the config from this tag
SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT_LABEL: v2.28.1.1
# Uncomment to bind to a local filesystem directory if using the 'native' profile
#volumes:
# - ./config:/etc/geoserver
deploy:
resources:
limits:
cpus: '2.0'
memory: 256M
discovery:
image: geoservercloud/geoserver-cloud-discovery:2.28.1.1
user: "1000:1000"
depends_on:
- config
ports:
- 8761:8761
deploy:
resources:
limits:
cpus: '2.0'
memory: 256M
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/cloud/wms, http://localhost:9090/geoserver/cloud/wfs, etc)
gateway:
image: geoservercloud/geoserver-cloud-gateway:2.28.1.1
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
discovery:
condition: service_healthy
environment:
# eat our own dogfood and set a base path
GEOSERVER_BASE_PATH: /geoserver/cloud
ports:
- 9090:8080
deploy:
resources:
limits:
cpus: '4.0'
memory: 1G
# GeoServer template service configuration
geoserver_template:
image: geoservercloud/geoserver-cloud-webui:2.28.1.1
user: "1000:1000"
environment:
<<: *common_env
volumes:
- geowebcache_data:/data/geowebcache
deploy:
mode: replicated
replicas: 0
resources:
limits:
cpus: '2.0'
memory: 1G
# GeoServer microservices
wfs:
image: geoservercloud/geoserver-cloud-wfs:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1
wms:
image: geoservercloud/geoserver-cloud-wms:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1
wcs:
image: geoservercloud/geoserver-cloud-wcs:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1
wps:
image: geoservercloud/geoserver-cloud-wps:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1
restconfig:
image: geoservercloud/geoserver-cloud-rest:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1
webui:
image: geoservercloud/geoserver-cloud-webui:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1
gwc:
image: geoservercloud/geoserver-cloud-gwc:2.28.1.1
extends:
service: geoserver_template
depends_on: *gs-dependencies
deploy:
replicas: 1