I am working with GeoServer and I'm interested in storing its configuration data outside of the default file-based catalog. Specifically, I want to manage and persist configurations like:
Workspaces: Workspace names and settings. Stores: Data store connections and details. Layers: Layer definitions, styles, and associated data stores. Styles: SLD styles and style configurations. Groups: User groups and roles (if relevant to external configuration). Services Configuration: Settings for WMS, WFS, WCS, etc.
I want to use kartoza/docker-geoserver - https://github.com/kartoza/docker-geoserver and in its docs it says- The image uses kartoza/postgis as a database backend. You can use any other PostgreSQL image but adjust the environment variables accordingly.
postgis - https://github.com/kartoza/docker-postgis
geoserver - https://github.com/kartoza/docker-geoserver
Will it be possible, i need docker-compose file run so that it will save all the detail in postgres not in file based database. Thank you
here is my docker file for postgis
version: "3.7"
services:
db:
image: kartoza/postgis:latest # Using Kartoza PostGIS image
environment:
POSTGRES_USER: geoserver # Username for PostgreSQL (consistent for both DBs)
POSTGRES_PASSWORD: geoserver # Password for PostgreSQL (consistent for both DBs)
POSTGRES_DB: geoserver_data # Database for your spatial data (e.g., layers)
ports:
- "5432:5432" # Optional: Expose PostgreSQL port for external access (e.g., psql)
volumes:
- db_data:/var/lib/postgresql/data # Persist PostgreSQL data using a named volume
volumes:
db_data: # Named volume for PostgreSQL data persistence
docker file for geoserver
version: "3.7"
services:
geoserver:
image: kartoza/geoserver:latest # Using Kartoza Geoserver image
ports:
- "8080:8080" # Expose Geoserver web interface on port 8080
environment:
# --- JDBC Config Extension Settings for PostgreSQL Catalog ---
GEOSERVER_CATALOG_DB_TYPE: postgresql # Specify PostgreSQL for catalog
GEOSERVER_CATALOG_DB_HOST: db # 'db' service name resolves to PostgreSQL container
GEOSERVER_CATALOG_DB_PORT: 5432 # PostgreSQL default port
GEOSERVER_CATALOG_DB_DATABASE: geoserver_data # Database for Geoserver's configuration catalog (typo in original request corrected to 'geoserver_catalog' if intended to be different from data DB, but currently using data DB name)
GEOSERVER_CATALOG_DB_USER: geoserver # Use the same PostgreSQL user
GEOSERVER_CATALOG_DB_PASS: geoserver # Use the same PostgreSQL password
# --- Optional: Configure default database for data sources (e.g., PostGIS layers) ---
# GEOSERVER_POSTGRES_DB: geoserver_data # Uncomment to set 'geoserver_data' as default DB
This is working for me
geoserver:
image: kartoza/geoserver:2.26.1
container_name: geoserver
environment:
DB_BACKEND: POSTGRES
HOST: postgis
POSTGRES_PORT: 5432
POSTGRES_DB: geoserver_backend
POSTGRES_USER: postgres
POSTGRES_PASS: root
SSL_MODE: allow
POSTGRES_SCHEMA: public
DISK_QUOTA_SIZE: 5
COMMUNITY_EXTENSIONS: jdbcconfig-plugin,jdbcstore-plugin
GEOSERVER_ADMIN_PASSWORD: geoserver
GEOSERVER_ADMIN_USER: admin
SAMPLE_DATA: TRUE
USE_DEFAULT_CREDENTIALS: TRUE
volumes:
- geoserver_data:/opt/geoserver/data_dir
- ./web-conf.xml:/usr/local/tomcat/conf/web.xml
- ./web-inner.xml:/usr/local/tomcat/webapps/geoserver/WEB-INF/web.xml
ports:
- "8080:8080"