Docker

Image ��

Docker Hub contains a repository with images that can be used. You can use it directly with a data-only container exporting a VOLUME containing your print apps in /usr/local/tomcat/webapps/ROOT/print-apps.

Or you can derive another image from it and add your own configurations in it with a Dockerfile like that:

FROM camptocamp/mapfish_print:{version}
ADD {MyApps} ${CATALINA_HOME}/webapps/ROOT/print-apps/

Tunings ��

The docker image can be tuned with several environment variables:

  • CATALINA_OPTS: Java startup parameters.
  • DEFAULT_LOG_LEVEL: Set the default log level (defaults to INFO)
  • TOMCAT_LOG_LEVEL: Set the tomcat log level (defaults to INFO)
  • LOG_LEVEL: Set the mapfish print log level (defaults to INFO)
  • SPRING_LOG_LEVEL: Set the Spring log level (defaults to WARN)
  • JASPER_LOG_LEVEL: Set the JasperReports log level (defaults to WARN)
  • APACHE_LOG_LEVEL: Set the Apache log level (defaults to WARN)
  • SQL_LOG_LEVEL: Set the SQL (Hibernate) log level (defaults to WARN)
  • SENTRY_LOG_LEVEL: Set the Sentry log level (defaults to ERROR)
  • SENTRY_REPORTING_LOG_LEVEL: Starting from what log level to report to Sentry (defaults to WARN)
  • 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 host
      • TOMCAT_LOG_PORT: the target port

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/

Multi-instance ��

You can enable multi-instance by adding those to CATALINA_OPTS:

  • -Ddb.username=...: The PostgresQL username
  • -Ddb.password=...: The PostgresQL password
  • -Ddb.host=...: The PostgresQL host name
  • -Ddb.name=...: The PostgresQL database name

The container will then automatically wait on the DB to be up before starting tomcat.

The DB polling can be tuned with those two environment variables:

  • PRINT_CANCEL_OLD_POLL_INTERVAL: How often in seconds the DB is polled for jobs to be cancelled (default=60s)
  • PRINT_POLL_INTERVAL: How often in seconds the DB is polled for new jobs (default=0.5s)