-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
23 lines (20 loc) · 773 Bytes
/
start.sh
File metadata and controls
23 lines (20 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
DIR="/var/www/elexifier-api/migrations"
if [ ! -d "$DIR" ]; then
echo "Initializing database and migrating models"
python /var/www/elexifier-api/manage.py db init &&
python /var/www/elexifier-api/manage.py db migrate &&
python /var/www/elexifier-api/manage.py db upgrade
else
echo "Migration folder exists, checking if database migrations are needed"
output=$(python /var/www/elexifier-api/manage.py db migrate 2>&1)
if [[ ! $output == *"No changes in schema detected." ]] ; then
echo "Upgrading database"
python /var/www/elexifier-api/manage.py db upgrade
else
echo "No database upgrade required"
fi
fi
mkdir /var/www/elexifier-api/app/media
echo "Starting the gunicorn server"
gunicorn -b 0.0.0.0:8080 wsgi:app --timeout 12000