-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
75 lines (70 loc) · 1.98 KB
/
deploy.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
#! /bin/bash
sudo apt update
sudo apt install redis
sudo apt install python3
sudo apt-get install python3-venv
sudo apt install nginx
sudo service nginx restart
python3 -m venv venv
source venv/bin/activate
sudo apt install pyhton3-pip
pip3 install flask
pip3 install -r requirements.txt
flask db migrate
pip3 install SQLAlchemy==1.3.5
flask db init
sudo apt-get install libpq-dev
flask db migrate
pip3 install psycopg2
flask db migrate
flask db upgrade
sudo apt install ufw
sudo ufw app list
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'OpenSSH'
sudo ufw status
sudo ufw enable
pip3 install gunicorn
sudo bash -c 'cat > /etc/nginx/conf.d/virtual.conf <<EOF
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
EOF'
sudo service nginx restart
sudo bash -c 'cat > /etc/systemd/system/slack_guni_test.service <<EOF
[Unit]
Description=slack_clone application
After=network.target
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/slack-clone-project-gursharan
Environment="PATH=/home/ubuntu/slack-clone-project-gursharan/venv/bin"
ExecStart=/home/ubuntu/slack-clone-project-gursharan/venv/bin/gunicorn -b localhost:8000 -w 4 slack_clone:slack_app_instance
Restart=always
[Install]
WantedBy=multi-user.target
EOF'
sudo bash -c 'cat > /etc/systemd/system/slack_celery_test.service <<EOF
[Unit]
Description=slack_clone application
After=network.target
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/slack-clone-project-gursharan
Environment="PATH=/home/ubuntu/slack-clone-project-gursharan/venv/bin"
ExecStart=/home/ubuntu/slack-clone-project-gursharan/venv/bin/celery -A app.celery worker --loglevel=info
Restart=always
[Install]
WantedBy=multi-user.target
EOF'
sudo systemctl daemon-reload
echo "starting service slack_guni_test"
sudo systemctl start slack_guni_test
echo "started service slack_guni_test"
echo "starting service slack_celery_test"
sudo systemctl start slack_celery_test
echo "started service slack_celery_test"
echo "successfully install slack_clone application"