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
16 changes: 16 additions & 0 deletions edrop-cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,21 @@ export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
mkdir -p /edrop/logs

# When a new container is being created, eDROP Connector takes a long time to startup because all dependencies
# need to be installed first. The cron job, however, needs all dependencies to be installed before it can start up.
# Since we know that once eDROP Connector is up and running, all dependencies are installed, we just wait till we
# get a 200 response from the web app before starting the cron job.
# Using the autorestart property of Supervisor does not seem to work when deployed in production, hence this work around.
while true; do
sleep 5;
http_response=$(curl -s -o /dev/null -I -w "%{http_code}\n" http://localhost:8000/$APP_ROOT);
if [ $http_response == "200" ]; then
break
else
echo "eDROP Connector is not yet responding."
fi
done
echo "eDROP Connector has started successfully"

# start the cron job
python manage.py runapscheduler
2 changes: 1 addition & 1 deletion supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ stopasgroup=true

; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998
priority=997

[program:edrop-cron]
command=/edrop/edrop-cron.sh
Expand Down