From 4dced587ad5404d0083e7a4e2353c205b04acdc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Brunner?=
Other parameters are documented here:
https://docs.sentry.io/clients/java/config/
- In this mode several instances of the print will collaborate together to handle the print jobs. The state is - stored in a database. You need to add the following parameters 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-Ddb.port=...
: The PostgresQL database port (defaults to 5432
)Example:
- -
-docker run --name=mapfish-print-test --publish=8080:8080
---env=TOMCAT_LOG_TYPE=json
---env=CATALINA_OPTS="-Ddb.name=mydb -Ddb.host=myserver -Ddb.username=myuser -Ddb.password=mypwd -Ddb.port=5432"
-mydockerhub/mapfish-print:latest
-
-
-- The necessary tables are created automatically (print_accountings, print_job_results, print_job_statuses). - In this mode the container will wait for the database to be reachable before actually starting the tomcat - server. -
- -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 canceled
- (default=60
s)
- PRINT_POLL_INTERVAL
: How often in seconds the DB is polled for new jobs
- (default=0.5
s)
- + The print has a state containing the job queue and each job's state. To enable horizontal scaling, these + states must be persisted. +
++ To store the state we use a PostgreSQL database, the database connection should be configured with the + following Java system properties: +
+ +db.host
: The database server host namedb.port
: The database server port (defaults to 5432
)db.username
: The username to connect to the databasedb.password
: The password to connect to the databasedb.name
: The name of the databasedb.schema
: The schema to use (defaults to public
)
+ The schema should exist, and the necessary tables are created automatically (print_accountings
,
+ print_job_results
, print_job_statuses
). In this mode, the container will wait for
+ the database to be reachable before actually starting the tomcat server.
+
The DB polling can be tuned with these two environment variables:
+PRINT_CANCEL_OLD_POLL_INTERVAL
: How often in seconds the DB is polled for jobs to be canceled
+ (default=60
s)
+ PRINT_POLL_INTERVAL
: How often in seconds the DB is polled for new jobs
+ (default=0.5
s)
+
+ In a Docker environment, the system properties should be added in the CATALINA_OPTS
environment
+ variable Like that: -D<property name>=<property value>
.
+
In Kubernetes, you can reuse an environment variable with:
+
+ env:
+ - name: PROPERTY_VALUE
+ value: test
+ - name: CATALINA_OPTS
+ value: -D<property name>==$(PROPERTY_VALUE)
+
+
+The order is important.
+ +Full example where we get the database credentials from a secret:
+ +
+
+env:
+ - name: PGHOST
+ valueFrom:
+ secretKeyRef:
+ key: hostname
+ name: database-credential-secret
+ - name: PGPORT
+ valueFrom:
+ secretKeyRef:
+ key: port
+ name: database-credential-secret
+ - name: PGUSER
+ valueFrom:
+ secretKeyRef:
+ key: username
+ name: database-credential-secret
+ - name: PGPASSWORD
+ valueFrom:
+ secretKeyRef:
+ key: password
+ name: database-credential-secret
+ - name: PGDATABASE
+ valueFrom:
+ secretKeyRef:
+ key: database
+ name: database-credential-secret
+ - name: PGSCHEMA
+ value: print
+ - name: PGOPTIONS
+ value: '-c statement_timeout=30000'
+ - name: PRINT_POLL_INTERVAL
+ value: '1'
+ - name: CATALINA_OPTS
+ value: >-
+ -Ddb.host=$(PGHOST)
+ -Ddb.port=$(PGPORT)
+ -Ddb.username=$(PGUSER)
+ -Ddb.password=$(PGPASSWORD)
+ -Ddb.name=$(PGDATABASE)
+ -Ddb.schema=$(PGSCHEMA)
+
+