Skip to content

Commit

Permalink
Merge pull request #3380 from mapfish/doc
Browse files Browse the repository at this point in the history
Add documentation about the `docker-pre-stop-print` script
  • Loading branch information
sbrunner authored Aug 28, 2024
2 parents 5db375c + eb63592 commit 6142050
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/docker/usr/local/tomcat/bin/docker-pre-stop-print
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash -e

# By default 1 day
TIMEOUT="${1:-86400}"
echo "Notify the print to stop and wait ${TIMEOUT}s"
cd /usr/local/tomcat/temp/mapfish-print/ROOT
Expand Down
4 changes: 4 additions & 0 deletions core/docker/usr/local/tomcat/bin/docker-start-watch
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import subprocess
from threading import Lock, Timer
import argparse

import inotify.adapters

Expand All @@ -27,6 +28,9 @@ def start():


def main():
parser = argparse.ArgumentParser("This script is used in debug mode to restart the print after a compilation")
parser.parse_args()

global timer, process
process = subprocess.Popen(["catalina.sh", "run"])

Expand Down
22 changes: 22 additions & 0 deletions docs/src/main/resources/templates/docker.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,25 @@ <h4 id="docker_sentry">
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>

0 comments on commit 6142050

Please sign in to comment.