Skip to content

Commit

Permalink
8693650ha: Fix startup issue on a fresh install.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Dec 8, 2023
1 parent a53be1a commit 368bab9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
volumes:
- ./webapp/api/core:/home/api/core
- ./webapp/api/api:/home/api/api
- ./webapp/run.sh:/home/run.sh
- ./webapp/scripts/run.sh:/home/scripts/run.sh
- ./configs:/home/configs
- api-media:/home/api/media
- api-static:/home/api/static
Expand Down
1 change: 1 addition & 0 deletions webapp/api/api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def ready(self):
if resubmit_all is not None and resubmit_all.lower() in ('1', 'y', 'true'):
logger.info('Found env var RESUBMIT_ALL_ON_STARTUP is True. '
'Attempting to resubmit all currently submitted state documents')

projects = ProjectAnnotateEntities.objects.all()
for project in projects:
if project.project_status == 'A':
Expand Down
7 changes: 7 additions & 0 deletions webapp/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# run db backup script before doing anything
/home/scripts/backup_db.sh

# env vars that should only be on for app running...
TMP_RESUBMIT_ALL_VAR=$RESUBMIT_ALL_ON_STARTUP
export RESUBMIT_ALL_ON_STARTUP=0

# Collect static files and migrate if needed
python /home/api/manage.py collectstatic --noinput
python /home/api/manage.py makemigrations --noinput
Expand All @@ -23,4 +27,7 @@ if [ $LOAD_EXAMPLES ]; then
python /home/scripts/load_examples.py &
fi

# RESET any Env vars to original stat
export RESUBMIT_ALL_ON_STARTUP=$TMP_RESUBMIT_ALL_VAR

uwsgi --http-timeout 360s --http :8000 --master --chdir /home/api/ --module core.wsgi

0 comments on commit 368bab9

Please sign in to comment.