diff --git a/core/docker/usr/local/tomcat/bin/docker-pre-stop-print b/core/docker/usr/local/tomcat/bin/docker-pre-stop-print index 8fc6b53095..4ed3b46665 100755 --- a/core/docker/usr/local/tomcat/bin/docker-pre-stop-print +++ b/core/docker/usr/local/tomcat/bin/docker-pre-stop-print @@ -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 diff --git a/core/docker/usr/local/tomcat/bin/docker-start-watch b/core/docker/usr/local/tomcat/bin/docker-start-watch index a6434fb166..4c40997b51 100755 --- a/core/docker/usr/local/tomcat/bin/docker-start-watch +++ b/core/docker/usr/local/tomcat/bin/docker-start-watch @@ -3,6 +3,7 @@ import os import subprocess from threading import Lock, Timer +import argparse import inotify.adapters @@ -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"]) diff --git a/docs/src/main/resources/templates/docker.html b/docs/src/main/resources/templates/docker.html index c616772cb7..860a72df1a 100644 --- a/docs/src/main/resources/templates/docker.html +++ b/docs/src/main/resources/templates/docker.html @@ -104,3 +104,25 @@
+ The container can be stopped gracefully by calling the docker-pre-stop-print
script. This
+ script will trigger a graceful stop, by stopping starting new jobs and waiting for the current jobs to
+ finish.
+
In Kubernetes you can set it as a preStop hook
+ +
+ lifecycle:
+ preStop:
+ exec:
+ command:
+ - /usr/local/tomcat/bin/docker-pre-stop-print
+ - $(PRINT_TERMINATION_GRACE_PERIOD_SECONDS)
+