-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.prod.sh
executable file
·44 lines (34 loc) · 1.33 KB
/
entrypoint.prod.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/sh
NAME="MunkiWebAdmin" # Name of the application
DJANGODIR=/home/app/web # Django project directory
SOCKFILE=/home/app/gunicorn.sock # we will communicte using this unix socket
USER=root # the user to run as
GROUP=root # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=munkiwebadmin.settings # which settings file should Django use
# mount azure blob storage
if [ "$AZURE_STORAGE_BLOB_ENDPOINT" != "" ]; then
blobfuse2 mount /munkirepo/
fi
if [ "$DATABASE" == "postgres" ]; then
echo "Waiting for postgres..."
while ! nc -z $SQL_HOST $SQL_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
fi
# migrate database
python manage.py makemigrations catalogs, process, pkgsinfo, manifests, icons, santa, munkiwebadmin
python manage.py migrate
echo "Starting $NAME as `whoami`"
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
# Start your Django Unicorn
gunicorn munkiwebadmin.wsgi:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--bind=unix:$SOCKFILE \
--log-level=warn \
--log-file=/home/app/gunicorn.log \
--daemon
exec nginx -g "daemon off;"