-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuwsgi.sh
73 lines (63 loc) · 2.42 KB
/
uwsgi.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
68
69
70
71
72
#!/bin/bash
echo "running uwsgi.sh file!"
echo "User: $USER"
echo "Present Dir: $PWD"
# Activate & install uwsgi in the python env
source env/bin/activate
pip3 install uwsgi
# Check if '/var/lib/jenkins/workspace/teachatty_chat_app/logs/teachatty_uwsgi.log' file exist, otherwise create the file
if [ -e /var/lib/jenkins/workspace/teachatty_chat_app/logs/teachatty_uwsgi.log ]
then
echo "teachatty_uwsgi.log file exists"
else
echo "teachatty_uwsgi.log file doesn't exists"
touch logs/teachatty_uwsgi.log
echo "Created the teachatty_uwsgi.log file into path: $PWD/logs/teachatty_uwsgi.log"
fi
# Check if the 'vassals' dir exists, otherwise create the dir
if [ -d /etc/uwsgi/vassals ]
then
echo "vassals dir exists"
else
echo "vassals dir doesn't exists"
sudo mkdir /etc/uwsgi/vassals
echo "Created '/etc/uwsgi/vassals' dir!"
fi
sudo chown -R jenkins /etc/uwsgi/vassals
# Check if the '/etc/uwsgi/emperor.ini' file exists, otherwise create the file
if [ -e /etc/uwsgi/emperor.ini ]
then
echo "emperor.ini file exists"
else
echo "emperor.ini file doesn't exists"
sudo cp -rf emperor.ini /etc/uwsgi/emperor.ini
echo "Copied the emperor.ini file into path: /etc/uwsgi/emperor.ini"
fi
sudo chown -R jenkins /etc/uwsgi/emperor.ini
# Check if the '/etc/systemd/system/emperor.uwsgi.service' file exists, otherwise create the file
if [ -e /etc/systemd/system/emperor.uwsgi.service ]
then
echo "emperor.uwsgi.service file exists"
else
echo "emperor.uwsgi.service file doesn't exists"
sudo cp -rf emperor.uwsgi.service /etc/systemd/system/emperor.uwsgi.service
echo "Copied emperor.uwsgi.service file into path: /etc/systemd/system/emperor.uwsgi.service"
fi
sudo chown -R jenkins /etc/systemd/system/emperor.uwsgi.service
# Check if the '/etc/uwsgi/teachatty.ini' file exists, otherwise create the file
if [ -e /etc/uwsgi/vassals/teachatty.ini ]
then
echo "teachatty.ini file exists"
else
echo "teachatty.ini file doesn't exists"
sudo cp -rf teachatty.ini /etc/uwsgi/vassals/teachatty.ini
fi
sudo cp -rf teachatty.ini /etc/uwsgi/vassals/teachatty.ini
echo "Copied teachatty.ini file to path: /etc/uwsgi/vassals/teachatty.ini"
sudo chown -R jenkins /etc/uwsgi/vassals/teachatty.ini
sudo systemctl daemon-reload
sudo systemctl restart uwsgi.service
sudo systemctl status uwsgi.service
sudo systemctl restart emperor.uwsgi.service
sudo systemctl status emperor.uwsgi.service
echo "Uwsgi setup finished!"