From a79f0c4d71c2805b784f8f282d28dafdb55e70c5 Mon Sep 17 00:00:00 2001 From: Scanner Date: Thu, 26 Oct 2023 12:31:31 -0700 Subject: [PATCH] We were getting some spurious failures connecting to redis on initial bring-up The problem was recovered automatically, but it still was producing events for sentry.io. --- app/scripts/start_app.sh | 3 +++ app/scripts/start_smtpd.sh | 2 ++ app/scripts/start_worker.sh | 1 + docker-compose.yml | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/scripts/start_app.sh b/app/scripts/start_app.sh index d7611dc..3a2479a 100755 --- a/app/scripts/start_app.sh +++ b/app/scripts/start_app.sh @@ -4,6 +4,9 @@ set -o errexit set -o pipefail set -o nounset +wait-for-it --service redis:6379 -- echo "Redis available" +# XXX We collectstatic in the docker image build step so we should probably +# remove this. /venv/bin/python /app/manage.py collectstatic --clear --no-input --verbosity 0 /venv/bin/python /app/manage.py migrate /venv/bin/gunicorn config.asgi --bind 0.0.0.0:8000 --chdir=/app -w 4 -k uvicorn.workers.UvicornWorker diff --git a/app/scripts/start_smtpd.sh b/app/scripts/start_smtpd.sh index dc248dc..b93846e 100755 --- a/app/scripts/start_smtpd.sh +++ b/app/scripts/start_smtpd.sh @@ -4,6 +4,8 @@ set -o errexit set -o pipefail set -o nounset +wait-for-it --service redis:6379 -- echo "Redis available" + echo "Running django migrations.." /venv/bin/python /app/manage.py migrate diff --git a/app/scripts/start_worker.sh b/app/scripts/start_worker.sh index 12125ba..17e9543 100755 --- a/app/scripts/start_worker.sh +++ b/app/scripts/start_worker.sh @@ -4,5 +4,6 @@ set -o errexit set -o pipefail set -o nounset +wait-for-it --service redis:6379 -- echo "Redis available" /venv/bin/python /app/manage.py migrate /venv/bin/python /app/manage.py run_huey diff --git a/docker-compose.yml b/docker-compose.yml index 32d4d63..870b149 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,7 +69,7 @@ services: - mailhog ports: - "11578:8000" - command: /app/manage.py runserver_plus --cert-file /mnt/ssl/ssl_crt.pem --key-file /mnt/ssl/ssl_key.pem 0.0.0.0:8000 + command: wait-for-it --service redis:6379 -- /app/manage.py runserver_plus --cert-file /mnt/ssl/ssl_crt.pem --key-file /mnt/ssl/ssl_key.pem 0.0.0.0:8000 restart: always env_file: .env volumes: