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.
This commit is contained in:
Abhilash Raj
2017-04-10 01:26:10 -07:00
parent 57d33dfafa
commit 67089dde74
2 changed files with 3 additions and 18 deletions

View File

@@ -19,3 +19,5 @@ WORKDIR /opt/mailman
EXPOSE 8001
ENTRYPOINT ["/opt/run.sh"]
CMD ["/usr/local/bin/master", "-C", "/config/mailman.cfg"]

View File

@@ -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 "$@"