Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile.django-alpine
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ COPY \
docker/wait-for-it.sh \
docker/secret-file-loader.sh \
docker/reach_database.sh \
docker/reach_broker.sh \
docker/certs/* \
/
COPY wsgi.py manage.py docker/unit-tests.sh ./
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.django-debian
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ COPY \
docker/wait-for-it.sh \
docker/secret-file-loader.sh \
docker/reach_database.sh \
docker/reach_broker.sh \
docker/certs/* \
/
COPY wsgi.py manage.py docker/unit-tests.sh ./
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.integration-tests-debian
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ COPY --from=openapitools /opt/openapi-generator/modules/openapi-generator-cli/ta
COPY docker/wait-for-it.sh \
docker/secret-file-loader.sh \
docker/reach_database.sh \
docker/reach_broker.sh \
docker/entrypoint-integration-tests.sh \
/

Expand Down
2 changes: 2 additions & 0 deletions docker/entrypoint-celery-beat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e # needed to handle "exit" correctly

. /secret-file-loader.sh
. /reach_database.sh
. /reach_broker.sh

umask 0002

Expand All @@ -23,6 +24,7 @@ if [ "$NUM_FILES" -gt 0 ]; then
fi

wait_for_database_to_be_reachable
wait_for_broker_to_be_reachable
echo

# do the check with Django stack
Expand Down
2 changes: 2 additions & 0 deletions docker/entrypoint-celery-worker-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ set -e # needed to handle "exit" correctly

. /secret-file-loader.sh
. /reach_database.sh
. /reach_broker.sh

wait_for_database_to_be_reachable
wait_for_broker_to_be_reachable
echo

if [ "${DD_CELERY_WORKER_POOL_TYPE}" = "prefork" ]; then
Expand Down
2 changes: 2 additions & 0 deletions docker/entrypoint-celery-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -e # needed to handle "exit" correctly

. /secret-file-loader.sh
. /reach_database.sh
. /reach_broker.sh

# Allow for bind-mount multiple settings.py overrides
FILES=$(ls /app/docker/extra_settings/* 2>/dev/null || true)
Expand All @@ -22,6 +23,7 @@ if [ "$NUM_FILES" -gt 0 ]; then
fi

wait_for_database_to_be_reachable
wait_for_broker_to_be_reachable
echo

if [ "${DD_CELERY_WORKER_POOL_TYPE}" = "prefork" ]; then
Expand Down
2 changes: 2 additions & 0 deletions docker/entrypoint-uwsgi-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ set -e # needed to handle "exit" correctly

. /secret-file-loader.sh
. /reach_database.sh
. /reach_broker.sh

wait_for_database_to_be_reachable
wait_for_broker_to_be_reachable
echo

cd /app || exit
Expand Down
2 changes: 2 additions & 0 deletions docker/entrypoint-uwsgi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -e # needed to handle "exit" correctly

. /secret-file-loader.sh
. /reach_database.sh
. /reach_broker.sh

# Allow for bind-mount multiple settings.py overrides
FILES=$(ls /app/docker/extra_settings/* 2>/dev/null || true)
Expand All @@ -18,6 +19,7 @@ if [ "$NUM_FILES" -gt 0 ]; then
fi

wait_for_database_to_be_reachable
wait_for_broker_to_be_reachable
echo

umask 0002
Expand Down
30 changes: 30 additions & 0 deletions docker/reach_broker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

wait_for_broker_to_be_reachable() {
echo -n "Waiting for broker to be reachable "
failure_count=0
DD_BROKER_READINESS_TIMEOUT=${DD_BROKER_READINESS_TIMEOUT:-10}
while true;
do
set +e
celery --app=dojo status 2>/dev/null >/dev/null
BROKER_TEST=$?
set -e
if [[ "$BROKER_TEST" == "0" ]]; then
echo "Broker test was successful. Broker and at least one worker is connected."
break
fi
if [[ "$BROKER_TEST" == "69" ]]; then
echo "Broker test was successful. Broker is up. No worker is connected (but we are not testing that here)."
break
fi
echo -n "."
failure_count=$((failure_count + 1))
if [ $DD_BROKER_READINESS_TIMEOUT = $failure_count ]; then
echo "Broker test was failed:"
# One more time with output
celery --app=dojo status
exit 1
fi
done
}