-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·35 lines (32 loc) · 1012 Bytes
/
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
# !/bin/sh
if [ -z "$1" ]; then
echo "Please provide a user name"
exit 1
fi
if [ -z "$2" ]; then
echo "Please provide a secret key"
exit 1
fi
USER=$1
SECRET_KEY=$2
mkdir -p ./source
sudo mkdir -p /var/www
sudo chmod 777 /var/www
if [ ! -d "/var/www/html/deb" ]; then
sudo rm -rf /var/www/html
sudo mkdir -p /var/www/html
fi
sudo apt update -y
sudo apt install -y python3-pip nginx gcc dpkg-dev gpg rpm gnupg supervisor createrepo-c
pip install -r requirements.txt
sudo cp ./nginx.conf /etc/nginx/sites-available/default
sudo service nginx restart
BASE_PATH=$(pwd)
supervisor_cnf=$(cat "./supervisor.conf" | sed "s|USER|$USER|g")
supervisor_cnf=$(echo "$supervisor_cnf" | sed "s|BASE_PATH|$BASE_PATH|g")
supervisor_cnf=$(echo "$supervisor_cnf" | sed "s|SECRET_KEY_HERE|$SECRET_KEY|g")
sudo rm -f /etc/supervisor/conf.d/distributions.conf
echo "$supervisor_cnf" | sudo tee /etc/supervisor/conf.d/distributions.conf
sudo service supervisor restart
sleep 5
sudo supervisorctl restart all