Docker
Image ¶
Docker Hub contains a repository with images that can be used.
You can mount your print apps in
/usr/local/tomcat/webapps/ROOT/print-apps.
You can mount additional font in
core/docker/usr/share/fonts/truetype/[font-file], and verity that she is correctly installed by
opening the view [base URL]/print/fonts.
Tunings ¶
The docker image can be tuned with several environment variables:
CATALINA_OPTS: Java startup parameters.-
CONTEXT_PATH: Optional external URL prefix (sub path) when the service is exposed behind a reverse proxy under a sub path (for example/printservice). When set, the container entrypoint will:-
Prefix all servlet mappings:
/metricsbecomes/printservice/metrics/print/*becomes/printservice/print/*/sec/print/*becomes/printservice/sec/print/*
-
Copy the UI assets (index + icons) under the sub path (for example
/printservice/index.html). -
Inject a
<base href="/printservice/">tag into the copied UI page so relative links work.
The value must start with/and may contain only alphanumeric characters, dots (.), underscores (_), hyphens (-) and slashes (/) (for example/printserviceor/api/v1/print). InvalidCONTEXT_PATHvalues will cause the container to exit with error code2during startup. -
Prefix all servlet mappings:
DEFAULT_LOG_LEVEL: Set the default log level (defaults toINFO)TOMCAT_LOG_LEVEL: Set the tomcat log level (defaults toINFO)LOG_LEVEL: Set the mapfish print log level (defaults toINFO)SPRING_LOG_LEVEL: Set the Spring log level (defaults toWARN)JASPER_LOG_LEVEL: Set the JasperReports log level (defaults toWARN)APACHE_LOG_LEVEL: Set the Apache log level (defaults toWARN)SQL_LOG_LEVEL: Set the SQL (Hibernate) log level (defaults toWARN)SENTRY_LOG_LEVEL: Set the Sentry log level (defaults toERROR)-
SENTRY_REPORTING_LOG_LEVEL: Starting from what log level to report to Sentry (defaults toWARN) -
TOMCAT_LOG_TYPE:-
classic(default): The logs are human readable. Access logs are going to stdout and the other logs are going to stderr. -
json: The logs will be formatted in a JSON suitable for logstash. Access logs are going to stdout and the other logs are going to stderr. -
logstash: The logs will be formatted in a JSON suitable for logstash (@cee) and sent by syslog/UDP. The access logs are going to stdout in json format. More variables are available for this mode:TOMCAT_LOG_HOST: the target hostTOMCAT_LOG_PORT: the target port
-
-
EXTRA_JARS: If set, directory where extra JAR files are taken from. Can be used, for example, to add fonts. -
PRINT_YAML_MAX_ALIASES: Set the YAML max alias, see also (defaults to50).
Filesystem writes ¶
The container expects to be able to write to some paths at runtime. If you run with a read-only root
filesystem, ensure those locations are writable (for example by mounting an emptyDir or other
volume), or use an init container to copy the webapp content to a writable volume.
/usr/local/tomcat/webapps/ROOT/print-apps: created at startup (print apps directory).-
/usr/local/tomcat/temp/mapfish-print/ROOT: used by the graceful shutdown mechanism (docker-pre-stop-printcreatesstop/stoppedfiles here). -
If
CONTEXT_PATHis set:-
/usr/local/tomcat/webapps/ROOT/WEB-INF/web.xml: rewritten at startup to prefix URL mappings. -
/usr/local/tomcat/webapps/ROOT<CONTEXT_PATH>: created and populated with UI assets (for example/usr/local/tomcat/webapps/ROOT/printservice).
-
If you want to tune properties from
mapfish-spring.properties
You can override them by adding -D options to the CATALINA_OPTS environment
variable.
Sentry integration ¶
You can enable Sentry crash reports by adding a parameter to the
CATALINA_OPTS environment variable with the DSN provided by sentry:
-Dsentry.dsn=https://public:private@host:port/project_id
Other parameters are documented here: https://docs.sentry.io/clients/java/config/
Graceful stop ¶
The container can be stopped gracefully by calling the docker-pre-stop-print script. This
script will trigger a graceful stop, by stopping starting new jobs and waiting for the current jobs to
finish.
In Kubernetes you can set it as a preStop hook
lifecycle:
preStop:
exec:
command:
- /usr/local/tomcat/bin/docker-pre-stop-print
- $(PRINT_TERMINATION_GRACE_PERIOD_SECONDS)