From 30203a5f8803478f6016f1ebed0f7642a1812e6a Mon Sep 17 00:00:00 2001 From: Tom Kazimiers Date: Fri, 27 Oct 2023 16:42:58 +0200 Subject: [PATCH] Docker: init RabbitMQ earlier This is needed, because the general Celery initialization otherwise can wait indefinitely for a connection (in a blocking fashion). --- scripts/docker/catmaid-entry.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/docker/catmaid-entry.sh b/scripts/docker/catmaid-entry.sh index 5dfaa94c77..888c3624b0 100644 --- a/scripts/docker/catmaid-entry.sh +++ b/scripts/docker/catmaid-entry.sh @@ -170,6 +170,16 @@ init_catmaid () { /home/scripts/createuser.sh ${DB_NAME} ${DB_USER} ${DB_PASS} | runuser -l postgres -c 'psql -h "${DB_HOST}" -p "${DB_PORT}"' fi + if [[ "$CM_RUN_CELERY" = true || "$CM_RUN_ASGI" = true ]]; then + echo "Starting RabbitMQ" + mkdir -p /var/run/rabbitmq + chown rabbitmq /var/run/rabbitmq + service rabbitmq-server start + until wget --spider -t1 -T1 -O /dev/null -q 127.0.0.1:5672; do + sleep 0.1 + done + fi + # Migrate the database, collect static files and create a superuser. echo "Migrating databse" python manage.py migrate --noinput @@ -232,16 +242,6 @@ init_catmaid () { }" >> mysite/settings.py fi - if [[ "$CM_RUN_CELERY" = true || "$CM_RUN_ASGI" = true ]]; then - echo "Starting RabbitMQ" - mkdir -p /var/run/rabbitmq - chown rabbitmq /var/run/rabbitmq - service rabbitmq-server start - until wget --spider -t1 -T1 -O /dev/null -q 127.0.0.1:5672; do - sleep 0.1 - done - fi - # First start supervisor in background and optionally start Celery and Daphne. echo "Starting CATMAID" supervisord -n -c /etc/supervisor/supervisord.conf &