introduce health checks for GeoServer and postgis

pull/38/head
Andre Henn 2023-12-11 14:20:01 +01:00
parent 493e819734
commit 4d96f6f19c
No known key found for this signature in database
GPG Key ID: 776670F973DDECAA
3 changed files with 11 additions and 1 deletions

View File

@ -95,6 +95,7 @@ ENV ROOT_WEBAPP_REDIRECT=false
ENV POSTGRES_JNDI_ENABLED=false ENV POSTGRES_JNDI_ENABLED=false
ENV CONFIG_DIR=/opt/config ENV CONFIG_DIR=/opt/config
ENV CONFIG_OVERRIDES_DIR=/opt/config_overrides ENV CONFIG_OVERRIDES_DIR=/opt/config_overrides
ENV HEALTHCHECK_URL=http://localhost:8080/geoserver/web/wicket/resource/org.geoserver.web.GeoServerBasePage/img/logo.png
EXPOSE 8080 EXPOSE 8080
@ -126,3 +127,6 @@ RUN chmod +x /opt/*.sh
ENTRYPOINT ["/opt/startup.sh"] ENTRYPOINT ["/opt/startup.sh"]
WORKDIR /opt WORKDIR /opt
HEALTHCHECK --interval=1m --timeout=20s --retries=3 \
CMD curl --fail $HEALTHCHECK_URL || exit 1

View File

@ -184,6 +184,7 @@ Following is the list of the all the environment variables that can be passed do
| ADDITIONAL_FONTS_DIR | Sets the directory for additional fonts used by GeoServer | `/opt/additional_fonts/` | | ADDITIONAL_FONTS_DIR | Sets the directory for additional fonts used by GeoServer | `/opt/additional_fonts/` |
| SKIP_DEMO_DATA | Indicates whether to skip the installation of demo data provided by GeoServer | `false` | | SKIP_DEMO_DATA | Indicates whether to skip the installation of demo data provided by GeoServer | `false` |
| ROOT_WEBAPP_REDIRECT | Indicates whether to issue a permanent redirect to the web interface | `false` | | ROOT_WEBAPP_REDIRECT | Indicates whether to issue a permanent redirect to the web interface | `false` |
| HEALTHCHECK_URL | URL to the resource / endpoint used for `docker` health checks | `http://localhost:8080/geoserver/web/wicket/resource/org.geoserver.web.GeoServerBasePage/img/logo.png` |
The following values cannot really be safely changed (as they are used to download extensions and community modules as the docker image first starts up). The following values cannot really be safely changed (as they are used to download extensions and community modules as the docker image first starts up).
| VAR NAME | DESCRIPTION | SAMPLE VALUE | | VAR NAME | DESCRIPTION | SAMPLE VALUE |

View File

@ -8,7 +8,7 @@ services:
- CORS_ENABLED=true - CORS_ENABLED=true
- CORS_ALLOWED_METHODS=GET,POST,PUT,HEAD,OPTIONS - CORS_ALLOWED_METHODS=GET,POST,PUT,HEAD,OPTIONS
ports: ports:
- 80:8080 - "80:8080"
environment: environment:
- INSTALL_EXTENSIONS=true - INSTALL_EXTENSIONS=true
- STABLE_EXTENSIONS=wps,csw - STABLE_EXTENSIONS=wps,csw
@ -32,3 +32,8 @@ services:
POSTGRES_PASSWORD: geoserver POSTGRES_PASSWORD: geoserver
volumes: volumes:
- ./postgis/postgresql_data:/var/lib/postgresql/data:Z - ./postgis/postgresql_data:/var/lib/postgresql/data:Z
healthcheck:
test: pg_isready -U geoserver -h localhost -t 5 || exit 1
interval: 10s
retries: 5
timeout: 10s