master
1#!/bin/bash
2source settings.sh
3
4apt-get -y install python3-tornado nginx supervisor psmisc python3-reportlab git
5git config --global core.editor "vim"
6
7#File install
8rm -Rf $INSTALLDIR
9git archive master $APPDIR | tar -x --overwrite -C $SITEPACKAGES
10
11#Supervisor Install
12systemctl stop supervisor.service
13killall supervisord >/dev/null 2>&1
14sleep 1
15rm -f /var/run/supervisor.sock >/dev/null 2>&1
16cat $INSTALLRES/supervisor.conf |
17 sed s/NAME/$NAME/g |
18 sed s#INSTALLDIR#$INSTALLDIR#g |
19 sed s/STARTPORT/$STARTPORT/g |
20 sed s/DEBUGPORT/$DEBUGPORT/g |
21 sed s/NUMPROCS/$NUMPROCS/g \
22 > /etc/supervisor/conf.d/$NAME.conf
23
24systemctl start supervisor.service
25sleep 1
26supervisorctl update
27supervisorctl stop $NAME:*
28rm -f /var/log/$NAME*
29rm -f /var/log/supervisor/$NAME*
30supervisorctl start $NAME:*
31
32#NGINX Install
33unlink /etc/nginx/sites-enabled/default > /dev/null 2>&1
34cat $INSTALLRES/nginx.conf |
35 sed -n '/BACKENDS/q;p' \
36 > /etc/nginx/conf.d/$NAME.conf
37let ENDPORT=$STARTPORT+$NUMPROCS-1
38for i in `seq $STARTPORT $ENDPORT`; do
39echo -e "\tserver 127.0.0.1:$i;" \
40 >> /etc/nginx/conf.d/$NAME.conf
41done
42cat $INSTALLRES/nginx.conf |
43 sed 'N; s|^.*BACKENDS\(.*\)$||' \
44 >> /etc/nginx/conf.d/$NAME.conf
45systemctl restart nginx.service