2019-03-19 07:54:41 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
# docker-pinry /start script
|
|
|
|
|
#
|
|
|
|
|
# Will setup database and static files if they don't exist already, if they do
|
|
|
|
|
# just continues to run docker-pinry.
|
|
|
|
|
#
|
|
|
|
|
# Authors: Isaac Bythewood
|
|
|
|
|
# Updated: Aug 19th, 2014
|
|
|
|
|
# -----------------------------------------------------------------------------
|
2019-12-19 19:51:28 +08:00
|
|
|
PROJECT_ROOT="/pinry"
|
2019-03-19 07:54:41 +08:00
|
|
|
|
2019-12-19 19:58:06 +08:00
|
|
|
bash ${PROJECT_ROOT}/docker/scripts/bootstrap.sh
|
2019-03-19 07:54:41 +08:00
|
|
|
|
|
|
|
|
# If static files don't exist collect them
|
2019-12-19 19:51:28 +08:00
|
|
|
cd ${PROJECT_ROOT}
|
2019-12-19 20:22:33 +08:00
|
|
|
python manage.py collectstatic --noinput --settings=pinry.settings.docker
|
2019-03-19 07:54:41 +08:00
|
|
|
|
|
|
|
|
# If database doesn't exist yet create it
|
|
|
|
|
if [ ! -f /data/production.db ]
|
|
|
|
|
then
|
2019-12-19 19:51:28 +08:00
|
|
|
cd ${PROJECT_ROOT}
|
2019-03-19 07:54:41 +08:00
|
|
|
python manage.py migrate --noinput --settings=pinry.settings.docker
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Fix all settings after all commands are run
|
|
|
|
|
chown -R www-data:www-data /data
|
|
|
|
|
|
|
|
|
|
# start all process
|
|
|
|
|
/usr/sbin/nginx
|
|
|
|
|
|
2019-12-19 19:51:28 +08:00
|
|
|
cd ${PROJECT_ROOT}
|
|
|
|
|
./docker/scripts/_start_gunicorn.sh
|