Move development docker compose files to ./compose/*yml and improve documentation

This commit is contained in:
Gabriel Roldan 2024-01-24 18:53:38 -03:00
parent b6edaf1a82
commit fe115443c2
17 changed files with 658 additions and 542 deletions

201
README.md
View File

@ -21,19 +21,6 @@ This project is an opinionated effort to split *GeoServer*'s geospatial services
As such, it builds on top of existing *GeoServer* software components, adapting and/or extending them in an attempt to achieve functional decomposition by business capability; which roughly means each OWS service, the Web UI, the REST API, and probably other components such as the *Catalog and Configuration subsystem*, become self-contained, individually deployable and scalable micro-services.
## Quick start
You can easily deploy and test locally GeoServer Cloud after cloning this repository on your computer by running the following command:
```bash
docker-compose -f docker-compose.yml -f docker-compose-shared_datadir.yml up -d
```
This will start a GeoServer Cloud stack using a file based backend as catalog system.
Browse to [http://localhost:9090/geoserver/cloud](http://localhost:9090/geoserver/cloud) to access the GeoServer UI.
## Architecture
The following diagram depicts the system's general architecture.
@ -78,14 +65,41 @@ OAuth is available by using the geOrchestra Gateway in replacement of the GeoSer
*GeoServer Cloud* licensed under the [GPLv2](LICENSE.txt).
## Distribution and deployment
Docker images for all the services are available on DockerHub, under the [GeoServer Cloud organization](https://hub.docker.com/u/geoservercloud/).
You can find production-suitable deployment files for docker-compose and podman under the [docs/deploy](docs/deploy) folder.
Also, a base Helm chart and examples for Kubernetes is available at the [camptocamp/helm-geoserver-cloud](https://github.com/camptocamp/helm-geoserver-cloud) Github repository.
## Contributing
Please read [the contribution guidelines](CONTRIBUTING.md) before contributing pull requests to the GeoServer Cloud project.
Follow the [developer's guide](docs/develop/index.md) to know more about the project's technical details.
## Status
`v1.5.2` released against GeoServer `2.24.1`.
Read the [changelog](https://github.com/geoserver/geoserver-cloud/releases/) for more information.
## Bugs
*GeoServer Cloud*'s issue tracking is at this [GitHub](https://github.com/geoserver/geoserver-cloud/issues) repository.
## Roadmap
Follow the development progress on these [GitHub Kanban boards](https://github.com/geoserver/geoserver-cloud/projects)
## Building
Requirements:
* Java >= 17 JDK
* [Maven](https://maven.apache.org/) >= `3.6.3`
* [Docker](https://docs.docker.com/engine/install/) version >= `19.03.3`
* [docker-compose](https://docs.docker.com/compose/) version >= `1.26.2`
* A recent [Docker](https://docs.docker.com/engine/install/) version with the [Compose](https://docs.docker.com/compose/) plugin.
The simple `make` command from the project root directory will build, test, and install all the project artifacts, and build the GeoServer-Cloud Docker images. So for a full build just run:
@ -105,16 +119,6 @@ and run tests with
make test
```
### Custom upstream GeoServer version
*GeoServer Cloud* depends on a custom GeoServer branch, `gscloud/gs_version/integration`, which contains patches to upstream GeoServer that have not yet been integrated into the mainstream `main` branch.
Additionally, this branch changes the artifact versions (e.g. from `2.23-SNAPSHOT` to `2.23.0-CLOUD`), to avoid confusing maven if you also work with vanilla GeoServer, and to avoid your IDE downloading the latest `2.23-SNAPSHOT` artifacts from the OsGeo maven repository, overriding your local maven repository ones, and having confusing compilation errors that would require re-building the branch we need.
The `gscloud/gs_version/integration` branch is checked out as a submodule on the (camptocamp/geoserver-cloud-geoserver)[https://github.com/camptocamp/geoserver-cloud-geoserver] repository, which publishes the custom geoserver maven artifacts to the Github maven package registry.
The root pom adds this additional maven repository, so no further action is required for the geoserver-cloud build to use those dependencies.
### Build the docker images
As mentioned above, a `make` with no arguments will build everything.
@ -125,6 +129,11 @@ But to build only the docker images, run:
make build-image
```
This runs the `build-base-images`, `build-image-infrastructure`, and `build-image-geoserver` targets,
which you can also run individually during development depending on your needs. Usually,
you'd run `make build-image-geoserver` to speed up the process when made a change and want
to test the geoserver containers, without having to rebuild the base and infra images.
### Targeted builds
*GeoServer Cloud*-specific modules source code is under the `src/` directory.
@ -143,74 +152,120 @@ $ cd src/
$ ../mvnw clean install
```
### Development runs
### Note on custom upstream GeoServer version
To run the development docker composition using a shared data directory.
*GeoServer Cloud* depends on a custom GeoServer branch, `gscloud/gs_version/integration`, which contains patches to upstream GeoServer that have not yet been integrated into the mainstream `main` branch.
GeoServer-Cloud can start from an empty directory.
Additionally, this branch changes the artifact versions (e.g. from `2.23-SNAPSHOT` to `2.23.0-CLOUD`), to avoid confusing maven if you also work with vanilla GeoServer, and to avoid your IDE downloading the latest `2.23-SNAPSHOT` artifacts from the OsGeo maven repository, overriding your local maven repository ones, and having confusing compilation errors that would require re-building the branch we need.
Edit your ```.env``` file to set the ```GS_USER``` variable to your user id and group,
then do:
The `gscloud/gs_version/integration` branch is checked out as a submodule on the (camptocamp/geoserver-cloud-geoserver)[https://github.com/camptocamp/geoserver-cloud-geoserver] repository, which publishes the custom geoserver maven artifacts to the Github maven package registry.
```bash
$ mkdir docker-compose_datadir
$ alias dcd="docker-compose -f docker-compose.yml -f docker-compose-shared_datadir.yml"
$ dcd up -d
The root pom adds this additional maven repository, so no further action is required for the geoserver-cloud build to use those dependencies.
## Development runs
The `./compose` folder contains docker-compose files intended only for **development**.
For instructions on running GeoServer Cloud in your environment, follow the [Quick Start](https://geoserver.org/geoserver-cloud/#quick-start) guide on the user guide.
### Run as non-root
First thing first, edit the `.env` file to set the `GS_USER` variable to the user and group ids
the applications should run as.
Usually the GID and UID of your user, such as:
```
echo `id -g`:`id -u`
1000:1000
```
Verify the services are running with `dcd ps`.
Healthchecks use `curl` hitting the `http:localhost:8081/actuator/health`.
Healthchecks use `curl` hitting the `http://localhost:8081/actuator/health` spring-boot actuator endpoint, which
also provides Kubernetes liveness and readiness probes at `/actuator/health/liveness` and `/actuator/health/readiness`
respectively.
The services run on the `8080` port, and are exposed using different host ports. The spring-boot-actuator is set up at port `8081`.
The `gateway-service` proxies requests from the `9090` local port:
### Choose your Catalog and Configuration back-end
You need to run `compose.yml` and pick one compose override file for a given GeoServer Catalog
and Configuration back-end.
#### DataDirectory Catalog back-end
The `datadir` spring boot profile enables the traditional "data directory" catalog back-end,
with all GeoServer containers sharing the same directory. On a k8s deployment you would need a
`ReadWriteMany` persistent volume.
GeoServer-Cloud can start from an empty data directory.
The `catalog-datadir.yml` docker compose override enables the `datadir` profile and
initializes a volume with the default GeoServer release data directory.
Run with:
```bash
$ alias dcd="docker compose -f compose.yml -f catalog-datadir.yml"
$ dcd up -d
```
$ curl "http://localhost:9090/geoserver/cloud/ows?request=getcapabilities&service={WMS,WFS,WCS}"
#### PostgreSQL Catalog back-end
The `pgconfig` spring boot profile enables the PostgreSQL catalog back-end.
This is the preferred Catalog back-end for production deployments,
and requires a PostgreSQL 15.0+ database
The `catalog-pgconfig.yml` docker compose override enables the `pgconfig` profile and
sets up a PostgreSQL container named `pgconfigdb`.
> On a production deployment, it is expected that the database is a provided service
and not part of the GeoServer Cloud deployment.
Run with:
```bash
$ alias dcp="docker compose -f compose.yml -f catalog-pgconfig.yml"
$ dcp up -d
```
**PGBouncer**:
Given the `pgconfig` catalog back-end will set up a database connection pool on each container,
when scaling out you might run out of available connections in the Postgres server. A good way
to avoid that and make better use of resources is to use a connection pooling service, such
as [pgbouncer](https://www.pgbouncer.org/).
Use the `catalog-pgconfig.yml` in combination with the `pgbouncer.yml` docker compose override. `pgbouncer.yml`
will override the three database containers with separate pgbouncer instances for each:
* `pgconfigdb` becomes a `pgbouncer` container pointing to the `pgconfigdb_pg` container.
* `acldb` becomes a `pgbouncer` container pointing to the `acldb_pg` container, and holds the [GeoServer ACL](https://github.com/geoserver/geoserver-acl) database
* `postgis` becomes a `pgbouncer` container pointing to the `postgis_pg` container.
> The `postgis` is container used to host sample data, it is not required but useful during development.
`v1.6.0` released against GeoServer `2.24.2`.
Read the [changelog](https://github.com/geoserver/geoserver-cloud/releases/tag/v1.6.0) for more information.
#### Access GeoServer
Verify the services are running with `dcd ps` or `dcp ps` as appropriate.
```
$ curl "http://localhost:9090/geoserver/cloud/ows?request=getcapabilities&service={WMS,WFS,WCS,WPS}"
$ curl -u admin:geoserver "http://localhost:9090/geoserver/cloud/rest/workspaces.json"
```
Browse to [http://localhost:9090/geoserver/cloud/](http://localhost:9090/geoserver/cloud/)
> Note the `/geoserver/cloud` context path is set up in the `gateway-service`'s externalized
> configuration, and enforced through the `GEOSERVER_BASE_PATH` in `docker-compose.yml`.
> configuration, and enforced through the `GEOSERVER_BASE_PATH` in `compose.yml`.
> You can change it to whatever you want. The default [config/gateway-service.yml](config/gateway-service.yml)
> configuration file does not set up a context path at all, and hence GeoServer will
> be available at the root URL.
To test GeoServer Cloud with different catalog backends, change the alias to replace the `docker-compose-shared_datadir.yml` file by one of the following:
- Use `docker-compose-jdbcconfig.yml` for a JDBC based catalog backend (uses jdbc config and jdbc store modules)
- Use `docker-compose-pgconfig.yml` for a JNDI based catalog backend
You can also run `docker-compose -f docker-compose.yml -f docker-compose-discovery-ha.yml` to run extra discovery service instances for HA.
## Deployment
Docker images for all the services are available on DockerHub, under the GeoServer Cloud organization (https://hub.docker.com/u/geoservercloud/).
You can find production-suitable deployment files for docker-compose and podman under the [docs/deploy](docs/deploy) folder.
Also, a ready-to-use Helm chart for Kubernetes is available at the [camptocamp/helm-geoserver-cloud](https://github.com/camptocamp/helm-geoserver-cloud) Github repository.
## Contributing
Please read [the contribution guidelines](CONTRIBUTING.md) before contributing pull requests to the GeoServer Cloud project.
Follow the [developer's guide](docs/develop/index.md) to know more about the project's technical details.
## Status
`v1.6.0` released against GeoServer `2.24.2`.
Read the [changelog](https://github.com/geoserver/geoserver-cloud/releases/tag/v1.6.0) for more information.
## Bugs
*GeoServer Cloud*'s issue tracking is at this [GitHub](https://github.com/geoserver/geoserver-cloud/issues) repository.
## Roadmap
Follow the development progress on these [GitHub Kanban boards](https://github.com/geoserver/geoserver-cloud/projects)

View File

@ -1,12 +1,12 @@
# docker-compose default environment variable values
COMPOSE_PROJECT_NAME=gscloud
COMPOSE_PROJECT_NAME=gscloud_dev
TAG=1.7-SNAPSHOT
ACL_TAG=2.0-SNAPSHOT
GS_USER="1000:1000"
BASE_PATH=/geoserver/cloud
GEOSERVER_DEFAULT_PROFILES="acl"
GEOSERVER_DEFAULT_PROFILES="default,debug"
ACL_DEFAULT_PROFILES="acl"
#GEOSERVER_DEFAULT_PROFILES="acl,acl_debug"

View File

@ -7,11 +7,12 @@
YJP_OPTS=-agentpath:/usr/local/YourKit-JavaProfiler-2023.9/bin/linux-x86-64/libyjpagent.so=broker_url=https://broker.yourkit.com/<broker-id>/,broker_token=<broker-token>
WFS_JAVA_OPTS=$YJP_OPTS,sessionname=wfs-service
WMS_JAVA_OPTS=$YJP_OPTS,sessionname=wms-service
WCS_JAVA_OPTS=$YJP_OPTS,sessionname=wcs-service
WPS_JAVA_OPTS=$YJP_OPTS,sessionname=wps-service
REST_JAVA_OPTS=$YJP_OPTS,sessionname=rest-service
WEBUI_JAVA_OPTS=$YJP_OPTS,sessionname=webui-service
GWC_JAVA_OPTS=$YJP_OPTS,sessionname=gwc-service
JAVA_OPTS=-XX:MaxRAMPercentage=80
WFS_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=wfs-service
WMS_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=wms-service
WCS_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=wcs-service
WPS_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=wps-service
REST_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=rest-service
WEBUI_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=webui-service
GWC_JAVA_OPTS=$JAVA_OPTS $YJP_OPTS,sessionname=gwc-service

BIN
compose/catalog-datadir.tgz Normal file

Binary file not shown.

View File

@ -0,0 +1,85 @@
version: "3.8"
#
# Configures all geoserver services to use a shared data directory as catalog backend.
# Run with `docker compose -f compose.yml -f catalog-datadir.yml up -d`
# Note the default data directory location is /opt/app/data_directory
# To set it to a different path, change the mount point and add the following env variable: GEOSERVER_DATA_DIR: </path/to/data_directory>
volumes:
datadir:
# driver_opts:
# type: none
# o: bind
# device: $PWD/docker-compose_datadir
services:
init-datadir:
image: alpine:3.18.4
user: ${GS_USER}
command: sh -c "cd /opt/app/data_directory; if [ ! -f global.xml ]; then tar xfvz /tmp/datadir.tgz; fi"
volumes:
- datadir:/opt/app/data_directory
- ./catalog-datadir.tgz:/tmp/datadir.tgz
wfs:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory
wms:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory
wcs:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory
wps:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory
rest:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory
webui:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory
gwc:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
depends_on:
init-datadir:
condition: service_completed_successfully
volumes:
- datadir:/opt/app/data_directory

View File

@ -5,7 +5,7 @@ volumes:
#
# Configures all geoserver services to use the postgresql database server with jdbcconfig as catalog backend.
# Run with `docker-compose --compatibility -f docker-compose.yml -f docker-compose-jdbcconfig.yml up -d`
# Run with `docker compose -f compose.yml -f catalog-jdbcconfig.yml up -d`
#
services:
@ -18,8 +18,6 @@ services:
POSTGRES_PASSWORD: "${JDBCCONFIG_PASSWORD}"
ports:
- 54321:5432
networks:
- gs-cloud-network
volumes:
- postgresql_config_data:/var/lib/postgresql/data
deploy:

View File

@ -4,69 +4,72 @@ volumes:
pgconfigdb_data: # volume for postgresql data, used to store the geoserver config through pgsqlconfig backend
#
# Configures all geoserver services to use the postgresql database server with jdbcconfig as catalog backend.
# Run with `docker-compose --compatibility -f docker-compose.yml -f docker-compose-jdbcconfig.yml up -d`
# Configures all geoserver services to use the postgresql database server with pgconfig as catalog backend.
# Run with `docker compose -f compose.yml -f catalog-pgconfig.yml up -d`
#
services:
pgconfigdb:
image: postgres:15
shm_size: 2g
environment:
POSTGRES_DB: pgconfig
POSTGRES_USER: pgconfig
POSTGRES_PASSWORD: pgconfig
ports:
- 54322:5432
networks:
- gs-cloud-network
extends:
file: templates.yml
service: pgconfigdbtemplate
volumes:
- pgconfigdb_data:/var/lib/postgresql/data
deploy:
resources:
limits:
cpus: '4.0'
memory: 4G
ports:
- 8432:5432
wfs:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true
wms:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true
wcs:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true
rest:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true
webui:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true
gwc:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true
wps:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},pgconfig"
depends_on:
- pgconfigdb
pgconfigdb:
condition: service_started
required: true

160
compose/compose.yml Normal file
View File

@ -0,0 +1,160 @@
version: "3.8"
include:
- ./infra.yml
volumes:
geowebcache_data:
config:
driver_opts:
type: none
o: bind
device: $PWD/../config
services:
acl:
image: geoservercloud/geoserver-acl:${ACL_TAG}
volumes:
- ${PWD}/../config/acl-service.yml:/opt/app/bin/acl.yml
environment:
SPRING_PROFILES_ACTIVE: "${ACL_DEFAULT_PROFILES}"
depends_on:
acldb:
condition: service_started
ports:
- 9000:8080
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:${TAG}
user: ${GS_USER}
environment:
JAVA_OPTS: "${CONFIG_JAVA_OPTS}"
# Either 'git' or 'native'. Use the default sample git repository to download the services configuration from
# If 'git', BEWARE config server will look for a branch called "master", and github changed the default branch name to "main"
# For more information, see https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html#_git_backend
SPRING_PROFILES_ACTIVE: native,standalone
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
restart: unless-stopped
volumes:
- config:/tmp/config
ports:
- 8888:8080
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
# Eureka service discovery. This is a Discovery First Bootstrap configuration.
# The discovery service is the only fixed entry point.
# Browse to http://localhost:8761 to check all services are registered.
discovery:
image: geoservercloud/geoserver-cloud-discovery:${TAG}
user: ${GS_USER}
environment:
JAVA_OPTS: "${DISCOVERY_JAVA_OPTS}"
ports:
- 8761:8761 # for development, so services can be run from localhost and find the discovery service running on docker
restart: unless-stopped
depends_on:
- config
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/wms, http://localhost:9090/geoserver/wfs, etc)
gateway:
image: geoservercloud/geoserver-cloud-gateway:${TAG}
user: ${GS_USER}
depends_on:
discovery:
condition: service_healthy
environment:
JAVA_OPTS: ${GATEWAY_JAVA_OPTS}
SPRING_PROFILES_ACTIVE: dev #exposes the catalog and config API at /api/v1/**
# eat our own dogfood and set a base path
GEOSERVER_BASE_PATH: ${BASE_PATH}
ports:
- 9090:8080
deploy:
resources:
limits:
cpus: '4.0'
memory: 1G
wfs:
extends:
file: templates.yml
service: gstemplate
image: geoservercloud/geoserver-cloud-wfs:${TAG}
environment:
JAVA_OPTS: "${WFS_JAVA_OPTS}"
wms:
image: geoservercloud/geoserver-cloud-wms:${TAG}
extends:
file: templates.yml
service: gstemplate
environment:
JAVA_OPTS: "${WMS_JAVA_OPTS}"
deploy:
resources:
limits:
memory: 4G
wcs:
extends:
file: templates.yml
service: gstemplate
image: geoservercloud/geoserver-cloud-wcs:${TAG}
environment:
JAVA_OPTS: "${WCS_JAVA_OPTS}"
wps:
extends:
file: templates.yml
service: gstemplate
image: geoservercloud/geoserver-cloud-wps:${TAG}
environment:
JAVA_OPTS: "${WPS_JAVA_OPTS}"
gwc:
extends:
file: templates.yml
service: gstemplate
image: geoservercloud/geoserver-cloud-gwc:${TAG}
environment:
JAVA_OPTS: "${GWC_JAVA_OPTS}"
rest:
extends:
file: templates.yml
service: gstemplate
image: geoservercloud/geoserver-cloud-rest:${TAG}
environment:
JAVA_OPTS: "${REST_JAVA_OPTS}"
webui:
extends:
file: templates.yml
service: gstemplate
image: geoservercloud/geoserver-cloud-webui:${TAG}
environment:
JAVA_OPTS: "${WEBUI_JAVA_OPTS}"

62
compose/infra.yml Normal file
View File

@ -0,0 +1,62 @@
version: "3.8"
volumes:
#rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container
postgis_data:
acl_data:
services:
postgis:
extends:
file: templates.yml
service: postgistemplate
volumes:
- postgis_data:/var/lib/postgresql/data
ports:
- 6432:5432
acldb:
extends:
file: templates.yml
service: acldbtemplate
volumes:
- acl_data:/var/lib/postgresql/data
rabbitmq:
image: rabbitmq:3.12.12
user: ${GS_USER}
tmpfs:
- /var/lib/rabbitmq
#volumes:
# - rabbitmq_data:/var/lib/rabbitmq
ports:
- "5672:5672"
- "15672:15672"
deploy:
resources:
limits:
cpus: '4.0'
memory: 1G
restart: unless-stopped
healthcheck:
test: rabbitmq-diagnostics is_running
start_period: 10s
interval: 15s
timeout: 30s
retries: 3
admin:
image: geoservercloud/geoserver-cloud-admin-server:${TAG}
user: ${GS_USER}
depends_on:
discovery:
condition: service_healthy
ports:
- 9091:8080
deploy:
mode: replicated
replicas: 0
resources:
limits:
cpus: '2.0'
memory: 512M

82
compose/pgbouncer.yml Normal file
View File

@ -0,0 +1,82 @@
version: "3.8"
# for simplicity, use one pgbouncer instance per databse
# postgis -> postgis_pg
# acldb -> acldb_pg
# pgconfigdb -> pgconfigdb_pg
services:
postgis:
extends:
file: templates.yml
service: pgbouncertemplate
environment:
PGBOUNCER_DATABASE: postgis
POSTGRESQL_HOST: postgis_pg
POSTGRESQL_DATABASE: postgis
POSTGRESQL_USERNAME: postgis
POSTGRESQL_PASSWORD: postgis
depends_on:
postgis_pg:
condition: service_started
ports:
- 6432:5432
acldb:
extends:
file: templates.yml
service: pgbouncertemplate
environment:
PGBOUNCER_DATABASE: acl
POSTGRESQL_HOST: acldb_pg
POSTGRESQL_DATABASE: acl
POSTGRESQL_USERNAME: acl
POSTGRESQL_PASSWORD: acls3cr3t
depends_on:
acldb_pg:
condition: service_started
ports:
- 7432:5432
pgconfigdb:
extends:
file: templates.yml
service: pgbouncertemplate
environment:
PGBOUNCER_DATABASE: pgconfig
POSTGRESQL_HOST: pgconfigdb_pg
POSTGRESQL_DATABASE: pgconfig
POSTGRESQL_USERNAME: pgconfig
POSTGRESQL_PASSWORD: pgconfig
depends_on:
pgconfigdb_pg:
condition: service_started
ports:
- 8432:5432
postgis_pg:
extends:
file: templates.yml
service: postgistemplate
volumes:
- postgis_data:/var/lib/postgresql/data
ports:
- 6433:5432
acldb_pg:
extends:
file: templates.yml
service: acldbtemplate
volumes:
- acl_data:/var/lib/postgresql/data
ports:
- 7433:5432
pgconfigdb_pg:
extends:
file: templates.yml
service: pgconfigdbtemplate
volumes:
- pgconfigdb_data:/var/lib/postgresql/data
ports:
- 8433:5432

View File

@ -1,12 +1,5 @@
version: "3.8"
volumes:
config:
driver_opts:
type: none
o: bind
device: $PWD/config
services:
discovery:
environment:

101
compose/templates.yml Normal file
View File

@ -0,0 +1,101 @@
version: "3.8"
services:
gstemplate:
user: ${GS_USER}
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
depends_on:
rabbitmq:
condition: service_started
required: true
discovery:
condition: service_started
required: true
volumes:
- geowebcache_data:/data/geowebcache
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: '2.0'
memory: 2G
postgrestemplate:
image: postgres:15
shm_size: 512m
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
restart: unless-stopped
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
postgistemplate:
extends:
service: postgrestemplate
image: postgis/postgis:latest
environment:
POSTGRES_DB: postgis
POSTGRES_USER: postgis
POSTGRES_PASSWORD: postgis
POSTGIS_GDAL_ENABLED_DRIVERS: ENABLE_ALL
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgis"]
acldbtemplate:
extends:
service: postgistemplate
environment:
POSTGRES_DB: acl
POSTGRES_USER: acl
POSTGRES_PASSWORD: acls3cr3t
healthcheck:
test: ["CMD-SHELL", "pg_isready -U acl"]
pgconfigdbtemplate:
extends:
service: postgrestemplate
shm_size: 1g
environment:
POSTGRES_DB: pgconfig
POSTGRES_USER: pgconfig
POSTGRES_PASSWORD: pgconfig
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pgconfig"]
deploy:
resources:
limits:
cpus: '4.0'
memory: 2G
pgbouncertemplate:
image: bitnami/pgbouncer:latest
environment:
PGBOUNCER_MAX_CLIENT_CONN: 2000
PGBOUNCER_POOL_MODE: transaction
PGBOUNCER_MAX_PREPARED_STATEMENTS: 100
PGBOUNCER_DEFAULT_POOL_SIZE: 50
PGBOUNCER_AUTH_TYPE: plain
PGBOUNCER_PORT: 5432
POSTGRESQL_PORT: 5432
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "PGPASSWORD=$$POSTGRES_PASSWORD psql -d $$POSTGRESQL_DATABASE -U $$POSTGRESQL_USERNAME -c 'select 1'"]
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: '2.0'
memory: 64M

2
config

@ -1 +1 @@
Subproject commit 17fde7b458db62b6ef2e674e69ae8b534daa2e27
Subproject commit f58f551cbe4119e785ec9e66b614015668f72f12

View File

@ -1,54 +0,0 @@
version: "3.8"
services:
# Eureka service discovery. This is a Discovery First Bootstrap configuration.
# Since the discovery service are fixed entry points, we're setting up two peer aware eureka instances for HA.
# Browse to http://localhost:8761 and http://localhost:8762 to verify they see each
# other and all services are registered at both eureka instances.
# See http://cloud.spring.io/spring-cloud-static/spring-cloud.html#_peer_awareness
discovery:
container_name: discovery
environment:
EUREKA_INSTANCE_HOSTNAME: discovery-1
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://discovery-2:8761/eureka
discovery2:
image: geoservercloud/geoserver-cloud-discovery:${TAG}
container_name: discovery-2
environment:
SERVER_PORT: 8761
EUREKA_INSTANCE_HOSTNAME: discovery-2
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://discovery-1:8761/eureka
JAVA_OPTS: ${DISCOVERY_JAVA_OPTS}
ports:
- 8762:8761
networks:
- gs-cloud-network
config:
image: geoservercloud/geoserver-cloud-config:${TAG}
depends_on:
- discovery
- discovery2
environment:
EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka
gateway:
environment:
EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka
wfs:
environment:
EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka
wms:
environment:
EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka
wcs:
environment:
EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka
# wps:
# environment:
# EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka
rest:
environment:
EUREKA_SERVER_URL: http://discovery-1:8761/eureka, http://discovery-2:8761/eureka

View File

@ -1,58 +0,0 @@
version: "3.8"
#
# Configures all geoserver services to use a shared data directory as catalog backend.
# Run with `docker-compose --compatibility -f docker-compose.yml -f docker-compose-shared_datadir.yml up -d`
# NOTE: Not ready for direct usage until deciding on a strategy to easily set up the shared data directory.
# Note the default data directory locatio is /opt/app/data_directory
# To set it to a different path, change the mount point and add the following env variable: GEOSERVER_DATA_DIR: </path/to/data_directory>
volumes:
test_shared_data_directory:
driver_opts:
type: none
o: bind
device: $PWD/docker-compose_datadir
services:
wfs:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory
wms:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory
wcs:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory
wps:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory
rest:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory
webui:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory
gwc:
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES},datadir"
volumes:
- test_shared_data_directory:/opt/app/data_directory

View File

@ -1,312 +0,0 @@
version: "3.8"
volumes:
rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container
postgis_data:
geowebcache_data:
acl_data:
networks:
gs-cloud-network:
# driver: bridge
services:
postgis:
image: postgis/postgis:latest
environment:
POSTGRES_DB: postgis
POSTGRES_USER: postgis
POSTGRES_PASSWORD: postgis
POSTGIS_GDAL_ENABLED_DRIVERS: ENABLE_ALL
networks:
- gs-cloud-network
volumes:
- postgis_data:/var/lib/postgresql/data
ports:
- 5432:5432
restart: unless-stopped
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
acldb:
image: postgis/postgis:latest
environment:
- POSTGRES_DB=acl
- POSTGRES_USER=acl
- POSTGRES_PASSWORD=acls3cr3t
networks:
- gs-cloud-network
volumes:
- acl_data:/var/lib/postgresql/data
ports:
- 6432:5432
restart: unless-stopped
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
rabbitmq:
image: rabbitmq:3.11-management
user: ${GS_USER}
restart: unless-stopped
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- gs-cloud-network
ports:
- "5672:5672"
- "15672:15672"
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# Eureka service discovery. This is a Discovery First Bootstrap configuration.
# The discovery service is the only fixed entry point.
# Browse to http://localhost:8761 to check all services are registered.
# Run docker-compose -f docker-compose.yml -f docker-compose-discovery-ha.yml to run extra discovery service instances for HA
discovery:
image: geoservercloud/geoserver-cloud-discovery:${TAG}
user: ${GS_USER}
environment:
JAVA_OPTS: "${DISCOVERY_JAVA_OPTS}"
ports:
- 8761:8761 # for development, so services can be run from localhost and find the discovery service running on docker
networks:
- gs-cloud-network
depends_on:
- config
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
# 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:${TAG}
user: ${GS_USER}
environment:
JAVA_OPTS: "${CONFIG_JAVA_OPTS}"
# Either 'git' or 'native'. Use the default sample git repository to download the services configuration from
# If 'git', BEWARE config server will look for a branch called "master", and github changed the default branch name to "main"
# For more information, see https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html#_git_backend
SPRING_PROFILES_ACTIVE: native
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
networks:
- gs-cloud-network
volumes:
- ./config:/tmp/config
ports:
- 8888:8080
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
admin:
image: geoservercloud/geoserver-cloud-admin-server:${TAG}
user: ${GS_USER}
depends_on:
- discovery
ports:
- 9091:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/wms, http://localhost:9090/geoserver/wfs, etc)
gateway:
image: geoservercloud/geoserver-cloud-gateway:${TAG}
user: ${GS_USER}
depends_on:
- discovery
environment:
JAVA_OPTS: ${GATEWAY_JAVA_OPTS}
SPRING_PROFILES_ACTIVE: dev #exposes the catalog and config API at /api/v1/**
RETRY_MAX_ATTEMPTS: 100
# eat our own dogfood and set a base path
GEOSERVER_BASE_PATH: ${BASE_PATH}
ports:
- 9090:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '4.0'
memory: 1G
acl:
image: geoservercloud/geoserver-acl:${ACL_TAG}
volumes:
- ./config/acl-service.yml:/opt/app/bin/acl.yml
environment:
SPRING_PROFILES_ACTIVE: "${ACL_DEFAULT_PROFILES}"
depends_on:
- acldb
networks:
- gs-cloud-network
ports:
- 9000:8080
deploy:
resources:
limits:
cpus: '4.0'
memory: 2G
# WFS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wfs=5)
wfs:
image: geoservercloud/geoserver-cloud-wfs:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${WFS_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
#tmpfs: #TODO: avoid runs creating volumes at all
# - /tmp
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
# WMS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wms=5)
wms:
image: geoservercloud/geoserver-cloud-wms:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${WMS_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
# WCS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wcs=5)
wcs:
image: geoservercloud/geoserver-cloud-wcs:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${WCS_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
# WPS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wps=5)
wps:
image: geoservercloud/geoserver-cloud-wps:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${WPS_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
# REST config microservice, port dynamically allocated to allow scaling (e.g docker-compose scale rest=5)
rest:
image: geoservercloud/geoserver-cloud-rest:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${REST_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: '1.5'
memory: 2G
# WEB UI microservice
webui:
image: geoservercloud/geoserver-cloud-webui:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${WEBUI_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
volumes:
- geowebcache_data:/data/geowebcache
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
gwc:
image: geoservercloud/geoserver-cloud-gwc:${TAG}
user: ${GS_USER}
depends_on:
- rabbitmq
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${GWC_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
volumes:
- geowebcache_data:/data/geowebcache
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G