From 67089dde746540ebb3281d173e1bdddfa6edf84f Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Mon, 10 Apr 2017 01:26:10 -0700 Subject: [PATCH] Directly run the master runner as CMD, instead of mailman start. `mailman start` command does not nothing but parses the configuration and starts the appropriate runners. The start command is implemented such that it forks the master runner, which in-turn starts the all the rest of the runners. It turns out that `master` is also exported as an console script which can directly be started instead of running `mailman start` command. This makes containerizing mailman much more easier. --- core/Dockerfile | 2 ++ core/assets/run.sh | 19 +------------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/core/Dockerfile b/core/Dockerfile index 6cb6779..046f097 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -19,3 +19,5 @@ WORKDIR /opt/mailman EXPOSE 8001 ENTRYPOINT ["/opt/run.sh"] + +CMD ["/usr/local/bin/master", "-C", "/config/mailman.cfg"] diff --git a/core/assets/run.sh b/core/assets/run.sh index dfc518f..8331159 100755 --- a/core/assets/run.sh +++ b/core/assets/run.sh @@ -117,21 +117,4 @@ api_key: $HYPERKITTY_API_KEY EOF -# SIGTERM Handler so that the container shuts down gracefully. -function term_handler () { - echo "Stopping mailman ..." - mailman stop - exit 143 # SIGTERM -} - -# Set the trap for SIGTERM. -trap 'kill ${!}; term_handler' SIGTERM - -# Start the mailman server. Mailman will start the master runner and then exit. -mailman -C /config/mailman.cfg start --force & - -# wait forever. -while true -do - tail -f /dev/null & wait ${!} -done +exec "$@"