-
Notifications
You must be signed in to change notification settings - Fork 19
/
setupServer.sh
executable file
·49 lines (38 loc) · 1.17 KB
/
setupServer.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
#!/bin/bash
echo "Installing Dependecy Packages..."
echo ""
sudo apt install apache2 libapache2-mod-wsgi-py3 python3 python3-flask python3-pip -y
echo "Enabling Apache2 WSGI Module..."
sudo a2enmod wsgi
echo ""
echo "Installing Python3 Dependency Modules with PIP"
python3 -m pip install -r requirements.txt
echo ""
echo
echo "Please input Port Number for WA API Server"
read serverPort
echo ""
if [ $serverPort = "80" ]
then
sudo cat apache2script > /etc/apache2/sites-available/000-default.conf
else
sudo cat apache2script >> /etc/apache2/sites-available/000-default.conf
sudo echo Listen $serverPort >> /etc/apache2/ports.conf
fi
curDirectory=$(pwd)
sudo sed -i "s|varDirectory|$curDirectory|g" $curDirectory/flask_app.wsgi
sudo sed -i "s|varDirectory|$curDirectory|g" /etc/apache2/sites-available/000-default.conf
sudo sed -i "s|varPort|$serverPort|g" /etc/apache2/sites-available/000-default.conf
echo ""
echo "Setup Done..!"
echo ""
echo "Start API Server from now? (y/n)"
read doStart
echo ""
if [ $doStart = "y" ]
then
sudo /etc/init.d/apache2 start
else
echo "You can start API Server manually with this command : /etc/init.d/apache2 start"
echo ""
fi