Hello,
In my pgconfig
database, I can see entries like this in the resourcestore
table:
I would like to know how I can preload my own configuration (such as a custom gwc-gs.xml
file) into the database when starting GeoServer Cloud for the first time. From my tests, I noticed that the database gets populated automatically when the web-ui
service starts. So it seems the initialization happens at that point.
See my compose file:
# Define shared environment variables for all services
x-variables:
environment: &common_env
SPRING_PROFILES_ACTIVE: "pgconfig,acl"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
# GEOSERVER_DATA_DIRECTORY_ENABLE: "true"
# SPRING_PROFILES_ACTIVE: "fileconfig"
#GEOSERVER_DATA_DIRECTORY_ENABLE: true
ACL_URL: http://acl:8080/acl/api
ACL_USERNAME: admin
ACL_PASSWORD: s3cr3t
x-gs-dependencies: &gs-dependencies
rabbitmq:
condition: service_healthy
discovery:
condition: service_healthy
pgconfigdb:
condition: service_started
config:
condition: service_healthy
acl:
condition: service_healthy
volumes:
geowebcache_data: # Stores GeoWebCache tile data
pgconfigdb_data: # Stores PostgreSQL data for pgconfig backend
services:
pgconfigdb:
# 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: pgconfig
POSTGRES_USER: pgconfig
POSTGRES_PASSWORD: pgconfig
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pgconfig"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- pgconfigdb_data:/var/lib/postgresql/data
ports:
- "5433:5432" # expose le port PostgreSQL à l'hôte
deploy:
resources:
limits:
cpus: '4.0'
memory: 4G
acl:
image: geoservercloud/geoserver-acl:2.3.1
user: "1000:1000"
depends_on:
pgconfigdb:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
PG_HOST: pgconfigdb
PG_PORT: 5432
PG_DB: pgconfig
PG_SCHEMA: acl
PG_USERNAME: pgconfig
PG_PASSWORD: pgconfig
'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.27.0.0
user: 1000:1000 # set the userid:groupid the container runs as
environment:
# 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.27.0.0
# 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.27.0.0
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.27.0.0
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:
image: geoservercloud/geoserver-cloud-webui:2.27.0.0
user: "1000:1000"
environment:
<<: *common_env
volumes:
- geowebcache_data:/data/geowebcache
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: '2.0'
memory: 1G