forked from PnX-SI/TaxHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_app.sh
executable file
·67 lines (51 loc) · 2.02 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
. settings.ini
#Création des répertoires systèmes
. create_sys_dir.sh
create_sys_dir || exit 1
echo "Création du fichier de configuration ..."
if [ ! -f apptax/config.py ]; then
cp apptax/config.py.sample apptax/config.py || exit 1
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:$db_port\/$db_name\"/" apptax/config.py
# rendre la commande nvm disponible
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#installation de node et npm et des librairies JS
cd static/
nvm install || exit 1
nvm use || exit 1
npm ci || exit 1
cd ..
#Installation du virtual env
echo "Installation du virtual env..."
python3 -m venv $venv_dir || exit 1
source $venv_dir/bin/activate
pip install --upgrade pip || exit 1
if [ "${mode}" = "dev" ]; then
pip install -r requirements-dev.txt || exit 1
else
pip install -r requirements.txt || exit 1
fi
pip install -e . || exit 1
deactivate
#création d'un fichier de configuration
if [ ! -f static/app/constants.js ]; then
echo 'Fichier de configuration non existant'
cp static/app/constants.js.sample static/app/constants.js || exit 1
fi
#affectation des droits sur le répertoire static/medias
chmod -R 775 static/medias || exit 1
#Lancement de l'application
export TAXHUB_DIR=$(readlink -e "${0%/*}")
# Configuration systemd
envsubst '${USER} ${TAXHUB_DIR}' < taxhub.service | sudo tee /etc/systemd/system/taxhub.service || exit 1
sudo systemctl daemon-reload || exit 1
# Configuration apache
envsubst '${TAXHUB_DIR}' < taxhub_apache.conf | sudo tee /etc/apache2/conf-available/taxhub.conf || exit 1
sudo a2enmod proxy || exit 1
sudo a2enmod proxy_http || exit 1
# you may need to restart apache2 if proxy & proxy_http was not already enabled
echo "Vous pouvez maintenant démarrer TaxHub avec la commande : sudo systemctl start taxhub"