-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker.html
More file actions
393 lines (341 loc) · 13.8 KB
/
docker.html
File metadata and controls
393 lines (341 loc) · 13.8 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MapFish Print 3 Documentation - Docker</title>
<link rel="stylesheet" href="css/sphinx_rtd_theme.css" type="text/css" />
<link rel="stylesheet" href="css/readthedocs-doc-embed.css" type="text/css" />
<link rel="stylesheet" href="css/custom.css" type="text/css" />
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> MapFish Print 3</a>
</div>
<div
class="wy-menu wy-menu-vertical"
data-spy="affix"
role="navigation"
aria-label="main navigation"
>
<ul class="current">
<li class="toctree-l1 ">
<a class="reference internal " href="index.html">Introduction</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="jasperreports.html"
>JasperReports</a
>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="api.html">Web API</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="properties.html">Properties</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="configuration.html"
>Configuration</a
>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="attributes.html">Attributes</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="layers.html">Map Layers</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="processors.html">Processors</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="fileloaders.html">File-Loaders</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="outputformats.html"
>Output Formats</a
>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="styles.html">Styles</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="tableimages.html"
>Images in tables</a
>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="download.html">Download</a>
</li>
<li class="toctree-l1 current">
<a class="reference internal current" href="docker.html">Docker</a>
</li>
<li class="toctree-l1 ">
<a class="reference internal " href="scaling.html">Horizontal scaling</a>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">MapFish Print 3</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Docker</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/mapfish/mapfish-print" class="fa fa-github">
mapfish/mapfish-print</a
>
</li>
</ul>
<hr />
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Docker</h1>
<div class="section"><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>/printservice</code>). When set, the container
entrypoint will:
<ul>
<li>
Prefix <strong>all</strong> servlet mappings:
<ul>
<li><code>/metrics</code> becomes <code>/printservice/metrics</code></li>
<li><code>/print/*</code> becomes <code>/printservice/print/*</code></li>
<li><code>/sec/print/*</code> becomes <code>/printservice/sec/print/*</code></li>
</ul>
</li>
<li>
Copy the UI assets (index + icons) under the sub path (for example
<code>/printservice/index.html</code>).
</li>
<li>
Inject a <code><base href="/printservice/"></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).<br />
The value must start with <code>/</code> and may contain only alphanumeric characters, dots
(<code>.</code>), underscores (<code>_</code>), hyphens (<code>-</code>) and slashes (<code>/</code>) (for
example <code>/printservice</code> or <code>/api/v1/print</code>). Invalid
<code>CONTEXT_PATH</code> values will cause the container to exit with error code <code>2</code> during
startup.
</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/printservice</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>
</div>
</div>
</div>
<footer>
<hr />
<div role="contentinfo">
<p>
<a href="https://www.camptocamp.com/geospatial_solutions" target="_blank" rel="noopener"
>Camptocamp</a
>
<br />
<span class="commit">
Revision
<code
><a
href="https://github.com/mapfish/mapfish-print/commit/08be7847edf67f1eed18f18c85839370bd9e1015"
target="_blank"
>08be7847</a
></code
>.
</span>
</p>
</div>
Theme based on a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">template</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.5.2/jquery-migrate.min.js"
integrity="sha512-BzvgYEoHXuphX+g7B/laemJGYFdrq4fTKEo+B3PurSxstMZtwu28FHkPKXu6dSBCzbUWqz/rMv755nUwhjQypw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.7/underscore-min.js"
integrity="sha512-dvWGkLATSdw5qWb2qozZBRKJ80Omy2YN/aF3wTUVC5+D1eqbA+TjWpPpoj8vorK5xGLMa2ZqIeWCpDZP/+pQGQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
type="text/javascript"
src="js/theme.js"
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>