forked from PnX-SI/UsersHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_app.sh
executable file
·52 lines (37 loc) · 1.21 KB
/
install_app.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
45
46
47
48
49
50
51
52
#!/bin/bash
. config/settings.ini
# Création des fichiers de configuration
cd config
echo "Création du fichier de configuration ..."
if [ ! -f config.py ]; then
cp config.py.sample config.py
fi
echo "préparation du fichier config.py..."
sed -i "s/SQLALCHEMY_DATABASE_URI = .*$/SQLALCHEMY_DATABASE_URI = \"postgresql:\/\/$user_pg:$user_pg_pass@$db_host:$pg_port\/$db_name\"/" config.py
url_application="${url_application//\//\\/}"
# on enleve le / final
if [ "${url_application: -1}" = '/' ]
then
url_application="${url_application::-1}"
fi
sed -i "s/URL_APPLICATION =.*$/URL_APPLICATION ='$url_application'/g" config.py
cd ..
# Installation de l'environement python
echo "Installation du virtual env..."
virtualenv -p /usr/bin/python3 venv
source venv/bin/activate
pip install -r requirements.txt
deactivate
# Installation de l'environement javascript
cd app/static
npm install
cd ../..
#Lancement de l'application
DIR=$(readlink -e "${0%/*}")
sudo -s cp usershub-service.conf /etc/supervisor/conf.d/
sudo -s sed -i "s%APP_PATH%${DIR}%" /etc/supervisor/conf.d/usershub-service.conf
# activate proxy apache extension
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo -s supervisorctl reread
sudo -s supervisorctl reload