forked from xchem/fragalysis-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch-stack.sh
44 lines (42 loc) · 1.17 KB
/
launch-stack.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
37
38
39
40
41
42
43
44
#!/bin/bash
/bin/bash /code/makemigrations.sh
echo "Creating superuser..."
# Automatically create the superuser...
script="
from django.contrib.auth.models import User
username = '$WEB_DJANGO_SUPERUSER_NAME'
password = '$WEB_DJANGO_SUPERUSER_PASSWORD'
email = '$WEB_DJANGO_SUPERUSER_EMAIL'
if not username or not password:
username = 'admin'
password = 'UNSECURED'
if User.objects.filter(username=username).count()==0:
User.objects.create_superuser(username, email, password)
print('Superuser created.')
else:
print('Superuser creation skipped.')
"
printf "$script" | python manage.py shell
# Prepare log files and start outputting logs to stdout
touch /srv/logs/gunicorn.log
touch /srv/logs/access.log
tail -n 0 -f /srv/logs/*.log &
# Start the NPM build
echo "Starting..."
# Start Gunicorn processes
cd /code/
echo "Starting Gunicorn...."
cd /code
gunicorn fragalysis.wsgi:application \
--daemon \
--name fragalysis \
--bind unix:django_app.sock \
--timeout 300 \
--workers 3 \
--log-level=debug \
--log-file=/srv/logs/gunicorn.log \
--access-logfile=/srv/logs/access.log
echo "Testing nginx config..."
nginx -t
echo "Running nginx..."
nginx