-
Notifications
You must be signed in to change notification settings - Fork 31
/
install_app.sh
executable file
·58 lines (44 loc) · 1.91 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
#!/usr/bin/env bash
. settings.ini
echo "Création du fichier de configuration ..."
if [ ! -f config/taxhub_config.toml ]; then
cp config/taxhub_config.toml.sample config/taxhub_config.toml || exit 1
fi
echo "préparation du fichier config/taxhub_config.toml..."
sed -i "s/SQLALCHEMY_DATABASE_URI = .*$/SQLALCHEMY_DATABASE_URI = \"postgresql:\/\/$user_pg:$user_pg_pass@$db_host:$db_port\/$db_name\"/" config/taxhub_config.toml
#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
# before 2.0.1 - Déplacement des fichiers médias de taxhub
# !! ne marche pas si la variable MEDIA_FOLDER est surcouchée
if [ ! -d "media/taxhub" ];then
mkdir -p "media/taxhub"
if [ -d "static/medias/" ];then
mv static/medias/* media/taxhub/
rm -r static/medias/
fi
fi
#Lancement de l'application
export TAXHUB_DIR=$(readlink -e "${0%/*}")
# Configuration systemd
envsubst '${USER}' < tmpfiles-taxhub.conf | sudo tee /etc/tmpfiles.d/taxhub.conf || exit 1
sudo systemd-tmpfiles --create /etc/tmpfiles.d/taxhub.conf || exit 1
envsubst '${USER} ${TAXHUB_DIR}' < taxhub.service | sudo tee /etc/systemd/system/taxhub.service || exit 1
sudo systemctl daemon-reload || exit 1
# Configuration logrotate
envsubst '${USER}' < log_rotate | sudo tee /etc/logrotate.d/taxhub
# 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 (re)démarrer TaxHub avec la commande : sudo systemctl restart taxhub"