Skip to content

Commit

Permalink
Docker: init RabbitMQ earlier
Browse files Browse the repository at this point in the history
This is needed, because the general Celery initialization otherwise can
wait indefinitely for a connection (in a blocking fashion).
  • Loading branch information
tomka committed Oct 27, 2023
1 parent a6c9827 commit 30203a5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions scripts/docker/catmaid-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 &
Expand Down

0 comments on commit 30203a5

Please sign in to comment.