Update config service to use the embedded /etc/geoserver config by default

This commit is contained in:
Gabriel Roldan 2024-10-21 12:39:38 -03:00
parent c383efdab1
commit a9021f6a67
No known key found for this signature in database
GPG Key ID: 697E8F9DF72128E1
11 changed files with 80 additions and 148 deletions

View File

@ -23,7 +23,6 @@ DISCOVERY_SERVER_DEFAULT_PROFILES=${LOGGING_PROFILE}
# For more information, see https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html#_git_backend
CONFIG_SERVER_DEFAULT_PROFILES=${LOGGING_PROFILE},native,standalone
JAVA_OPTS_DEFAULT=-XX:MaxRAMPercentage=80 -XshowSettings:system -Dlogging.config=file:/etc/geoserver/logback-spring.xml
JAVA_OPTS_DISCOVERY=$JAVA_OPTS_DEFAULT

View File

@ -72,13 +72,13 @@ services:
resources:
limits:
cpus: "1.0"
memory: 512M
memory: 256M
config:
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
memory: 256M
wms:
deploy:
resources:

View File

@ -52,9 +52,6 @@ services:
rabbitmq:
condition: service_healthy
required: true
ports:
- 9000:8080
- 9001:8081
deploy:
resources:
limits:
@ -70,21 +67,18 @@ services:
environment:
JAVA_OPTS: "${JAVA_OPTS_CONFIG}"
SPRING_PROFILES_ACTIVE: "${CONFIG_SERVER_DEFAULT_PROFILES}"
# '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
# override with the local copy to test config changes during development
- config:/etc/geoserver
ports:
# not needed in production, exposed for local development
- 8888:8080
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
memory: 256M
# Eureka service discovery. This is a Discovery First Bootstrap configuration.
# The discovery service is the only fixed entry point.
@ -104,7 +98,7 @@ services:
resources:
limits:
cpus: '2.0'
memory: 512M
memory: 256M
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/wms, http://localhost:9090/geoserver/wfs, etc)

View File

@ -4,20 +4,14 @@
services:
discovery:
restart: no
environment:
SPRING_PROFILES_ACTIVE: "standalone"
entrypoint: echo "discovery-service disabled."
config:
restart: no
environment:
SPRING_PROFILES_ACTIVE: "standalone"
entrypoint: echo "config-service disabled."
admin:
restart: no
environment:
SPRING_PROFILES_ACTIVE: "standalone"
entrypoint: echo "admin-service disabled for standalone mode, requires discovery-service."
gateway:

View File

@ -84,13 +84,13 @@ geotools:
nonProxyHosts: ${https.nonProxyHosts:${geotools.httpclient.proxy.http.nonProxyHosts}}
```
### Configure HTTP proxy with environment variables in docker-compose.yml
### Configure HTTP proxy with environment variables in compose.yml
As mentioned above, regular JVM proxy configuration works with Java System properties
but not with Operating System environment variables.
The above `geotools.httpclient.proxy` config properties though allow to do so
easily as in the following `docker-compose.yml` snippet:
easily as in the following `compose.yml` snippet:
```yaml
version: "3.8"
@ -142,4 +142,4 @@ To use GeoServer ACL with GeoServer Cloud, you need to do the following steps:
## Use OAuth authentication
You can enable OAuth authentication by replacing the default `gateway` image by the geOrchestra gateway (for example `georchestra/gateway:23.1-RC1`).
You can enable OAuth authentication by replacing the default `gateway` image by the geOrchestra gateway (for example `georchestra/gateway:23.1-RC1`).

View File

@ -9,8 +9,8 @@ These instructions assume you have Docker Engine, Docker CLI, and the [Compose P
Here are three `docker compose` based deployment examples to try out:
* Our preferred option, the [pgconfig](stable/pgconfig/compose.yml) Catalog back-end, specifically developed for GeoServer Cloud with scalability in mind, storing all Catalog and GeoServer configuration in a PostgreSQL database.
* A shared [data-directory](stable/shared_datadir/docker-compose.yml) option, using a mounted volume to share a traditional GeoServer data directory across all services.
* And a **deprecated** [jdbcconfig](jdbcconfig/docker-compose.yml) option, using the GeoServer [jdbcconfig](https://docs.geoserver.org/main/en/user/community/jdbcconfig/index.html) and [jdbcstore](https://docs.geoserver.org/main/en/user/community/jdbcstore/index.html) community modules.
* A shared [data-directory](stable/datadir/compose.yml) option, using a mounted volume to share a traditional GeoServer data directory across all services.
* And a **deprecated** [jdbcconfig](jdbcconfig/compose.yml) option, using the GeoServer [jdbcconfig](https://docs.geoserver.org/main/en/user/community/jdbcconfig/index.html) and [jdbcstore](https://docs.geoserver.org/main/en/user/community/jdbcstore/index.html) community modules.
Open a terminal and enter the directory where you just downloaded that file, and run `docker compose pull` to fetch the docker images from [Dockerhub](https://hub.docker.com/u/geoservercloud/):

View File

@ -10,9 +10,6 @@ volumes:
#device: $PWD/datadir
rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container
geowebcache_data: # used by gwc and web-ui to locate the default gwc tile cache directory
networks:
gs-cloud-network:
services:
rabbitmq:
@ -21,31 +18,23 @@ services:
restart: unless-stopped
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- gs-cloud-network
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:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
ports:
- 8761:8761
networks:
- gs-cloud-network
restart: unless-stopped
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
memory: 256M
# Spring Cloud Config service, provides centralized configuration to all
# microservices. Being a Discovery First Bootstrap configuration, it'll
@ -57,30 +46,20 @@ services:
- discovery
- rabbitmq
environment:
# 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: git
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config.git
# get the config for this release from the v1.8.12 tag
# default to `native` loading the config embedded in /etc/geoserver
# use `git` to fetch the config from a git reposiroty, 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: v1.8.12
# where to store the cloned repository, if unset, it'll use /tmp/config-repo-<randomid>
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
# avoid stack trace due to jgit not being able of creating a .config dir at $HOME
XDG_CONFIG_HOME: /tmp
networks:
- gs-cloud-network
# Uncoment to bind to a local filesystem directory if using the 'native' profile
#volumes:
# - ./config:/tmp/config
# - ./config:/etc/geoserver
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
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)
@ -94,8 +73,6 @@ services:
GEOSERVER_BASE_PATH: /geoserver/cloud
ports:
- 9090:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -113,8 +90,6 @@ services:
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -134,8 +109,6 @@ services:
volumes:
- shared_data_directory:/opt/app/data_directory
- geowebcache_data:/data/geowebcache
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -153,8 +126,6 @@ services:
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -172,8 +143,6 @@ services:
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
mode: replicated
replicas: 1
@ -195,8 +164,6 @@ services:
volumes:
- shared_data_directory:/opt/app/data_directory
- geowebcache_data:/data/geowebcache
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -211,8 +178,6 @@ services:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
networks:
- gs-cloud-network
volumes:
- shared_data_directory:/opt/app/data_directory
- geowebcache_data:/data/geowebcache

View File

@ -2,9 +2,6 @@ volumes:
postgresql_config_data: # volume for postgresql data, used to store the geoserver config through jdbcconfig
rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container
geowebcache_data: # used by gwc and web-ui to locate the default gwc tile cache directory
networks:
gs-cloud-network:
services:
rabbitmq:
@ -13,8 +10,6 @@ services:
restart: unless-stopped
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -23,13 +18,11 @@ services:
database:
# be sure geoserver.backend.jdbcconfig.initdb is set to true in application.yml at lease for the first app run
image: postgres:13-alpine
image: postgres:15-alpine
environment:
POSTGRES_DB: geoserver_config
POSTGRES_USER: geoserver
POSTGRES_PASSWORD: geo5erver
networks:
- gs-cloud-network
volumes:
- postgresql_config_data:/var/lib/postgresql/data
deploy:
@ -38,23 +31,15 @@ services:
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:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
ports:
- 8761:8761
networks:
- gs-cloud-network
restart: unless-stopped
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
memory: 256M
# Spring Cloud Config service, provides centralized configuration to all
# microservices. Being a Discovery First Bootstrap configuration, it'll
@ -65,32 +50,21 @@ services:
depends_on:
- discovery
- rabbitmq
- database
environment:
# 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: git
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config.git
# get the config for this release from the v1.8.12 tag
# default to `native` loading the config embedded in /etc/geoserver
# use `git` to fetch the config from a git reposiroty, 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: v1.8.12
# where to store the cloned repository, if unset, it'll use /tmp/config-repo-<randomid>
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
# avoid stack trace due to jgit not being able of creating a .config dir at $HOME
XDG_CONFIG_HOME: /tmp
networks:
- gs-cloud-network
# Uncoment to bind to a local filesystem directory if using the 'native' profile
#volumes:
# - ./config:/tmp/config
# - ./config:/etc/geoserver
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
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)
@ -104,8 +78,6 @@ services:
GEOSERVER_BASE_PATH: /geoserver/cloud
ports:
- 9090:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -117,11 +89,12 @@ services:
image: geoservercloud/geoserver-cloud-wfs:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
config:
condition: service_started
database:
condition: service_started
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -133,14 +106,15 @@ services:
image: geoservercloud/geoserver-cloud-wms:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
config:
condition: service_started
database:
condition: service_started
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
volumes:
- geowebcache_data:/data/geowebcache
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -152,11 +126,12 @@ services:
image: geoservercloud/geoserver-cloud-wcs:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
config:
condition: service_started
database:
condition: service_started
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -168,11 +143,12 @@ services:
image: geoservercloud/geoserver-cloud-rest:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
config:
condition: service_started
database:
condition: service_started
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
mode: replicated
replicas: 1
@ -186,14 +162,15 @@ services:
image: geoservercloud/geoserver-cloud-webui:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- rabbitmq
config:
condition: service_started
database:
condition: service_started
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
volumes:
- geowebcache_data:/data/geowebcache
networks:
- gs-cloud-network
deploy:
resources:
limits:
@ -203,12 +180,13 @@ services:
image: geoservercloud/geoserver-cloud-gwc:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
config:
condition: service_started
database:
condition: service_started
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
networks:
- gs-cloud-network
volumes:
- geowebcache_data:/data/geowebcache
deploy:

View File

@ -74,10 +74,6 @@ services:
cpus: '4.0'
memory: 2G
# 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:1.8.12
user: 1000:1000
@ -89,7 +85,7 @@ services:
resources:
limits:
cpus: '2.0'
memory: 512M
memory: 256M
# Spring Cloud Config service, provides centralized configuration to all
# microservices. Being a Discovery First Bootstrap configuration, it'll
@ -98,28 +94,20 @@ services:
image: geoservercloud/geoserver-cloud-config:1.8.12
user: 1000:1000 # set the userid:groupid the container runs as
environment:
# 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: git
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config.git
# get the config for this release from the v1.8.12 tag
SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT_LABEL: master
# where to store the cloned repository, if unset, it'll use /tmp/config-repo-<randomid>
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
# avoid stack trace due to jgit not being able of creating a .config dir at $HOME
XDG_CONFIG_HOME: /tmp
# default to `native` loading the config embedded in /etc/geoserver
# use `git` to fetch the config from a git reposiroty, 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: v1.8.12
# Uncoment to bind to a local filesystem directory if using the 'native' profile
#volumes:
# - ./config:/tmp/config
# - ./config:/etc/geoserver
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
memory: 256M
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/wms, http://localhost:9090/geoserver/wfs, etc)

View File

@ -230,7 +230,7 @@ The "local" spring profile in each `config/<service>.yml` file sets a different
* `restconfig-v1`: [9105](http://localhost:9105)
* `web-ui`: [9106](http://localhost:9106)
At startup time, as configured in its `src/main/resources/bootstrap.yml` file, the service will contact the `discovery-service` at the default `http://localhost:8761/eureka` location, given there's no `eureka.server.url` configuration property set (which is otherwise provided by `docker-compose.yml`).
Since `docker-compose.yml` exposes the `discovery-service` at the local port `8761`, that's all the service being run locally needs to engage in the cluster. The discovery service will provide it with the location of any other service it needs to contact, starting with the `config-service`, where it will ultimatelly get the rest of the application configuration from.
At startup time, as configured in its `src/main/resources/bootstrap.yml` file, the service will contact the `discovery-service` at the default `http://localhost:8761/eureka` location, given there's no `eureka.server.url` configuration property set (which is otherwise provided by `compose.yml`).
Since `compose.yml` exposes the `discovery-service` at the local port `8761`, that's all the service being run locally needs to engage in the cluster. The discovery service will provide it with the location of any other service it needs to contact, starting with the `config-service`, where it will ultimatelly get the rest of the application configuration from.

View File

@ -20,6 +20,20 @@ COPY --from=builder spring-boot-loader/ ./
RUN true
COPY --from=builder application/ ./
# Where jgit will try to create a .config directory
ENV XDG_CONFIG_HOME=/tmp
# Either 'git' or 'native'.
ENV SPRING_PROFILES_ACTIVE=native
# 'native' profile config, use the default config embedded in the Docker image.
# Feel free to override with a mounted volume
ENV CONFIG_NATIVE_PATH=/etc/geoserver
# Config for the 'git' profile
# Uses the default sample git repository to download the services configuration from
ENV CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config.git
# Override to get the config from the appropriate release TAG or branch
ENV SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT_LABEL: master
# where to store the cloned repository, if unset, it'll use /tmp/config-repo-<randomid>
ENV CONFIG_GIT_BASEDIR: /tmp/git_config
# avoid stack trace due to jgit not being able of creating a .config dir at $HOME
ENV XDG_CONFIG_HOME: /tmp