forked from mapfish/mapfish-print
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.html
More file actions
180 lines (162 loc) · 6.41 KB
/
Copy pathdocker.html
File metadata and controls
180 lines (162 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<h4 id="docker_image">
Image
<a class="headerlink" href="#docker_image" title="Permalink to this headline">¶</a>
</h4>
<p>
Docker Hub contains a
<a href="https://hub.docker.com/r/camptocamp/mapfish_print/">repository with images</a>
that can be used.
</p>
<p>
You can mount your print apps in
<code>/usr/local/tomcat/webapps/ROOT/print-apps</code>.
</p>
<p>
You can mount additional font in
<code>core/docker/usr/share/fonts/truetype/[font-file]</code>, and verity that she is correctly installed by
opening the view <code>[base URL]/print/fonts</code>.
</p>
<h4 id="docker_tunings">
Tunings
<a class="headerlink" href="#docker_tunings" title="Permalink to this headline">¶</a>
</h4>
<p>The docker image can be tuned with several environment variables:</p>
<ul>
<li><code>CATALINA_OPTS</code>: Java startup parameters.</li>
<li>
<code>CONTEXT_PATH</code>: Optional external URL prefix (sub path) when the service is exposed behind a
reverse proxy under a sub path (for example <code>/print</code> or <code>/foo/bar</code>). When set, the
container entrypoint will:
<ul>
<li>
Prefix the servlet mappings (for example <code>/metrics</code> becomes <code>/print/metrics</code>).
</li>
<li>
Copy the UI assets (index + icons) under the sub path (for example <code>/print/index.html</code>).
</li>
<li>
Inject a <code><base href="/print/"></code> tag into the copied UI page so relative
links work.
</li>
</ul>
This mode is intended for proxies/ingresses that forward the prefixed path as-is (no path rewrite).
</li>
<li><code>DEFAULT_LOG_LEVEL</code>: Set the default log level (defaults to <code>INFO</code>)</li>
<li><code>TOMCAT_LOG_LEVEL</code>: Set the tomcat log level (defaults to <code>INFO</code>)</li>
<li><code>LOG_LEVEL</code>: Set the mapfish print log level (defaults to <code>INFO</code>)</li>
<li><code>SPRING_LOG_LEVEL</code>: Set the Spring log level (defaults to <code>WARN</code>)</li>
<li><code>JASPER_LOG_LEVEL</code>: Set the JasperReports log level (defaults to <code>WARN</code>)</li>
<li><code>APACHE_LOG_LEVEL</code>: Set the Apache log level (defaults to <code>WARN</code>)</li>
<li><code>SQL_LOG_LEVEL</code>: Set the SQL (Hibernate) log level (defaults to <code>WARN</code>)</li>
<li><code>SENTRY_LOG_LEVEL</code>: Set the Sentry log level (defaults to <code>ERROR</code>)</li>
<li>
<code>SENTRY_REPORTING_LOG_LEVEL</code>: Starting from what log level to report to Sentry (defaults to
<code>WARN</code>)
</li>
<li>
<code>TOMCAT_LOG_TYPE</code>:
<ul>
<li>
<code>classic</code> (default): The logs are human readable. Access logs are going to stdout and the
other logs are going to stderr.
</li>
<li>
<code>json</code>: 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.
</li>
<li>
<code>logstash</code>: 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:
<ul>
<li><code>TOMCAT_LOG_HOST</code>: the target host</li>
<li><code>TOMCAT_LOG_PORT</code>: the target port</li>
</ul>
</li>
</ul>
</li>
<li>
<code>EXTRA_JARS</code>: If set, directory where extra JAR files are taken from. Can be used, for example,
to add fonts.
</li>
<li>
<code>PRINT_YAML_MAX_ALIASES</code>: Set the YAML max alias,
<a
href="https://www.javadoc.io/doc/org.yaml/snakeyaml/latest/org/yaml/snakeyaml/LoaderOptions.html#setMaxAliasesForCollections-int-"
>
see also</a
>
(defaults to <code>50</code>).
</li>
</ul>
<h4 id="docker_filesystem">
Filesystem writes
<a class="headerlink" href="#docker_filesystem" title="Permalink to this headline">¶</a>
</h4>
<p>
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 <code>emptyDir</code> or other
volume), or use an init container to copy the webapp content to a writable volume.
</p>
<ul>
<li><code>/usr/local/tomcat/webapps/ROOT/print-apps</code>: created at startup (print apps directory).</li>
<li>
<code>/usr/local/tomcat/temp/mapfish-print/ROOT</code>: used by the graceful shutdown mechanism (<code
>docker-pre-stop-print</code
>
creates <code>stop</code>/<code>stopped</code> files here).
</li>
<li>
If <code>CONTEXT_PATH</code> is set:
<ul>
<li>
<code>/usr/local/tomcat/webapps/ROOT/WEB-INF/web.xml</code>: rewritten at startup to prefix URL
mappings.
</li>
<li>
<code>/usr/local/tomcat/webapps/ROOT<CONTEXT_PATH></code>: created and populated with UI assets
(for example <code>/usr/local/tomcat/webapps/ROOT/print</code>).
</li>
</ul>
</li>
</ul>
<p>
If you want to tune properties from
<a
href="https://github.com/mapfish/mapfish-print/blob/master/core/src/main/resources/mapfish-spring.properties"
>mapfish-spring.properties</a
>
You can override them by adding <code>-D</code> options to the <code>CATALINA_OPTS</code> environment
variable.
</p>
<h4 id="docker_sentry">
Sentry integration
<a class="headerlink" href="#docker_sentry" title="Permalink to this headline">¶</a>
</h4>
<p>
You can enable Sentry crash reports by adding a parameter to the
<code>CATALINA_OPTS</code> environment variable with the DSN provided by sentry:
<code>-Dsentry.dsn=https://public:private@host:port/project_id</code>
</p>
<p>
Other parameters are documented here:
<a href="https://docs.sentry.io/clients/java/config/">https://docs.sentry.io/clients/java/config/</a>
</p>
<h4 id="stop">
Graceful stop
<a class="headerlink" href="#stop" title="Permalink to this headline">¶</a>
</h4>
<p>
The container can be stopped gracefully by calling the <code>docker-pre-stop-print</code> script. This
script will trigger a graceful stop, by stopping starting new jobs and waiting for the current jobs to
finish.
</p>
<p>In Kubernetes you can set it as a preStop hook</p>
<pre><code>
lifecycle:
preStop:
exec:
command:
- /usr/local/tomcat/bin/docker-pre-stop-print
- $(PRINT_TERMINATION_GRACE_PERIOD_SECONDS)
</code></pre>