From 743bc8522cc24c8f7684c4671a2a29477fae73b6 Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Fri, 3 Nov 2017 10:36:58 -0700 Subject: [PATCH] Force start mailman inside the container. Even though the 'master.lck' is supposed to prevent race conditions, it needs to be manually removed if the container did not shutdown gracefully. Remove the manual check for the lock file and force mailman to remove it. Also, set the stop_grace_period to 30s, which would allow Core to stop gracefully and not leave the lock file over. Default value in case of Docker is 10s. --- core/Dockerfile | 2 +- core/docker-entrypoint.sh | 9 --------- docker-compose.yaml | 1 + 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/core/Dockerfile b/core/Dockerfile index b3408cc..6e21e51 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -26,4 +26,4 @@ EXPOSE 8001 8024 ENV MAILMAN_CONFIG_FILE /etc/mailman.cfg ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["master"] +CMD ["master", "--force"] diff --git a/core/docker-entrypoint.sh b/core/docker-entrypoint.sh index 1b4bd9a..a8d5e26 100755 --- a/core/docker-entrypoint.sh +++ b/core/docker-entrypoint.sh @@ -1,15 +1,6 @@ #! /bin/bash set -e -# Check if the master lock exists for the mailman. -# It means that that either some other mailman process is running or -# the last time mailman did not exit clean. -if [[ -e /opt/mailman/var/locks/master.lck ]]; then - echo "The mailman's master lock file still exists at /opt/mailman/core/var/locks/master.lck" - echo "Please remove the lock file before trying to run this container again." - exit 1 -fi - function wait_for_postgres () { # Check if the postgres database is up and accepting connections before # moving forward. diff --git a/docker-compose.yaml b/docker-compose.yaml index a4b2200..b88a5a9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,6 +7,7 @@ services: hostname: mailman-core volumes: - /opt/mailman/core:/opt/mailman/ + stop_grace_period: 30s links: - database:database depends_on: