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:
@@ -19,3 +19,5 @@ WORKDIR /opt/mailman
|
|||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
|
|
||||||
ENTRYPOINT ["/opt/run.sh"]
|
ENTRYPOINT ["/opt/run.sh"]
|
||||||
|
|
||||||
|
CMD ["/usr/local/bin/master", "-C", "/config/mailman.cfg"]
|
||||||
|
|||||||
@@ -117,21 +117,4 @@ api_key: $HYPERKITTY_API_KEY
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# SIGTERM Handler so that the container shuts down gracefully.
|
exec "$@"
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user