-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
77 lines (57 loc) · 2.17 KB
/
setup.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
73
74
75
76
77
#!/bin/sh
echo "Installing python 3..."
yum install -y python3
echo "Python Version Installed: `python3 --version`"
echo "Adding NodeSource repository for NodeJS installation..."
curl –sL https://rpm.nodesource.com/setup_15.x | bash -
echo "Installing NodeJS..."
yum install -y nodejs
echo "Node Version Installed: `node --version`"
echo "Installing Angular CLI..."
npm install -g @angular/cli
echo "Angular Version Installed:\n`ng version`"
echo "Installing Nginx..."
yum install -y epel-release
yum install -y nginx
echo "Nginx Version Installed: `nginx -v`"
cd ./back-end
echo "Creating virtual environment for python packages..."
python3 -m venv venv
echo "Activating virtual environment for package installation..."
source ./venv/bin/activate
echo "Installing necessary python packages..."
pip install -r requirements.txt
echo "Initializing MySQL database..."
python3 db_init.py
echo "Deactivating virtual environment..."
deactivate
echo "Copying Nginx configuration to /etc/nginx/nginx.conf"
cp ../config/nginx.conf /etc/nginx/nginx.conf
echo "Copying Gunicorn system service for Flask backend to /etc/systemd/system/bdmparse.service"
cp ../config/bdmparse.service /etc/systemd/system/bdmparse.service
echo "Copying SSL certificates to /etc/ssl/certs and /etc/ssl/private"
mkdir /etc/ssl/certs
mkdir /etc/ssl/private
cp ../config/nginx-selfsigned.crt /etc/ssl/certs/nginx-selfsigned.crt
cp ../config/nginx-selfsigned.key /etc/ssl/private/nginx-selfsigned.key
cd ../front-end
echo "Installing Angular dependencies..."
npm install
echo "Building Angular project..."
ng build --prod
echo "Elevating privileges to read/execute for Nginx..."
chmod -R 755 ..
chmod og+x /home/admin
echo "Updating firewall to allow http and https traffic..."
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
echo "Starting and enabling Nginx system service..."
systemctl start nginx
systemctl enable nginx
echo "Starting and enabling firewalld system service..."
systemctl start firewalld
systemctl enable firewalld
echo "Starting and enabling bdmparse system service..."
systemctl start bdmparse
systemctl enable bdmparse