-
Notifications
You must be signed in to change notification settings - Fork 20
/
run
45 lines (32 loc) · 976 Bytes
/
run
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
45
#!/bin/bash -e
export TBPWEB_MODE=production
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
# ==== OLD, replaced with HKN like settings
# cd ~/public_html/tbpweb
# rvm use
# source ~/public_html/tbpweb/.venv/bin/activate
# PYTHONPATH=~/public_html/tbpweb/src:$PYTHONPATH
export DJANGO_SETTINGS_MODULE=settings
export DJANGO_WSGI_MODULE=settings.wsgi
DJANGO_DIR=~/tbpweb/prod/current
SOCKFILE=/srv/apps/$(whoami)/tbp.sock
NUM_WORKERS=4
PYTHONPATH=$DJANGO_DIR:$PYTHONPATH
cd $DJANGO_DIR
rvm use
source ~/.bashrc
conda activate tbpweb-prod
# exec gunicorn -w $NUM_WORKERS -b unix:$SOCKFILE \
# --log-file - settings.wsgi:application
exec gunicorn \
-w $NUM_WORKERS \
-b unix:"$SOCKFILE" \
--log-level debug \
--log-file - \
$DJANGO_WSGI_MODULE:application