-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathrun_koe_app.sh
36 lines (28 loc) · 916 Bytes
/
run_koe_app.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
unset http_proxy
unset https_proxy
cd /code
IS_TENSORFLOW=$1
python maintenance.py --probe-database
if test "$RESET_DB" = "true"; then
python maintenance.py --restore-database --file=initial.zip
else
# Always back-up the database
mkdir -p backups/mysql
chmod 777 backups/mysql
DB_BACKUP_NAME=backups/mysql/backup-`date "+%Y-%m-%d_%H-%M-%S"`.sql
python maintenance.py --backup-database --file="$DB_BACKUP_NAME"
chmod 666 "$DB_BACKUP_NAME"
python manage.py migrate --database=default
fi
# Always clear the cache
python manage.py cache --action=clear --pattern='template.cache.*'
celery -A koe worker -l info -c 1 --logfile=logs/celery.log&
sleep 1
python manage.py resume_unfinished_task
if [ "$IS_TENSORFLOW" = "tensorflow" ]; then
python manage.py shell_plus --notebook &
uwsgi --ini settings/uwsgi.ini:tensorflow
else
uwsgi --ini settings/uwsgi.ini:prod
fi