forked from PnX-SI/GeoNature-atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_app.sh
More file actions
executable file
·110 lines (93 loc) · 3.96 KB
/
Copy pathinstall_app.sh
File metadata and controls
executable file
·110 lines (93 loc) · 3.96 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
if [ ! -f ./main/configuration/settings.ini ]; then
cp ./main/configuration/settings.ini.sample ./main/configuration/settings.ini
fi
. main/configuration/settings.ini
if [ "$(id -u)" == "0" ]; then
echo -e "\e[91m\e[1mThis script should NOT be run as root but your user needs sudo rights\e[0m" >&2
exit 1
fi
echo "Stopping application..."
sudo -s supervisorctl stop atlas
echo "Creating and activating Virtual env..."
virtualenv $venv_dir
. $venv_dir/bin/activate
echo "Installing requirements..."
pip install -r requirements.txt
echo "Creating configuration files if they dont already exist"
if [ ! -f ./main/configuration/config.py ]; then
cp ./main/configuration/config.py.sample ./main/configuration/config.py
fi
sudo sed -i "s/database_connection = .*$/database_connection = \"postgresql:\/\/$user_pg:$user_pg_pass@$db_host:$db_port\/$db_name\"/" ./main/configuration/config.py
echo "Launching application..."
DIR=$(readlink -e "${0%/*}")
sudo -s cp atlas-service.conf /etc/supervisor/conf.d/
sudo -s sed -i "s%APP_PATH%${DIR}%" /etc/supervisor/conf.d/atlas-service.conf
sudo -s supervisorctl reread
sudo -s supervisorctl reload
echo "Creating custom images folder if it doesnt already exist"
if [ ! -d ./static/custom/images/ ]; then
mkdir -p ./static/custom/images/
fi
echo "Creating customisation files if they dont already exist"
if [ ! -f ./static/custom/templates/footer.html ]; then
cp ./static/custom/templates/footer.html.sample ./static/custom/templates/footer.html
fi
if [ ! -f ./static/custom/templates/introduction.html ]; then
cp ./static/custom/templates/introduction.html.sample ./static/custom/templates/introduction.html
fi
if [ ! -f ./static/custom/templates/presentation.html ]; then
cp ./static/custom/templates/presentation.html.sample ./static/custom/templates/presentation.html
fi
if [ ! -f ./static/custom/templates/credits.html ]; then
cp ./static/custom/templates/credits.html.sample ./static/custom/templates/credits.html
fi
if [ ! -f ./static/custom/templates/mentions-legales.html ]; then
cp ./static/custom/templates/mentions-legales.html.sample ./static/custom/templates/mentions-legales.html
fi
if [ ! -f ./static/custom/custom.css ]; then
cp ./static/custom/custom.css.sample ./static/custom/custom.css
fi
if [ ! -f ./static/custom/glossaire.json ]; then
cp ./static/custom/glossaire.json.sample ./static/custom/glossaire.json
fi
if [ ! -f ./static/custom/images/favicon.ico ]; then
cp ./static/images/sample.favicon.ico ./static/custom/images/favicon.ico
fi
if [ ! -f ./static/custom/images/accueil-intro.jpg ]; then
cp ./static/images/sample.accueil-intro.jpg ./static/custom/images/accueil-intro.jpg
fi
if [ ! -f ./static/custom/images/logo-structure.png ]; then
cp ./static/images/sample.logo-structure.png ./static/custom/images/logo-structure.png
fi
if [ ! -f ./static/custom/images/logo_patrimonial.png ]; then
cp ./static/images/sample.logo_patrimonial.png ./static/custom/images/logo_patrimonial.png
fi
if [ ! -f ./static/custom/maps-custom.js ]; then
cp ./static/custom/maps-custom.js.sample ./static/custom/maps-custom.js
fi
echo "Creating GIS files if they dont already exist"
if [ ! -f ./data/ref/communes.dbf ]; then
cp ./data/ref/communes.dbf.sample ./data/ref/communes.dbf
fi
if [ ! -f ./data/ref/communes.prj ]; then
cp ./data/ref/communes.prj.sample ./data/ref/communes.prj
fi
if [ ! -f ./data/ref/communes.shp ]; then
cp ./data/ref/communes.shp.sample ./data/ref/communes.shp
fi
if [ ! -f ./data/ref/communes.shx ]; then
cp ./data/ref/communes.shx.sample ./data/ref/communes.shx
fi
if [ ! -f ./data/ref/territoire.dbf ]; then
cp ./data/ref/territoire.dbf.sample ./data/ref/territoire.dbf
fi
if [ ! -f ./data/ref/territoire.prj ]; then
cp ./data/ref/territoire.prj.sample ./data/ref/territoire.prj
fi
if [ ! -f ./data/ref/territoire.shp ]; then
cp ./data/ref/territoire.shp.sample ./data/ref/territoire.shp
fi
if [ ! -f ./data/ref/territoire.shx ]; then
cp ./data/ref/territoire.shx.sample ./data/ref/territoire.shx
fi