-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_script.sh
More file actions
32 lines (23 loc) · 879 Bytes
/
Copy pathdeploy_script.sh
File metadata and controls
32 lines (23 loc) · 879 Bytes
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
#!/bin/bash
DRY_RUN=$1
echo "cd backend..."
# Skip actual git pull in dry run
[ "$DRY_RUN" != "true" ] && cd backend
echo "Installing pipenv..."
# Skip actual installation in dry run
[ "$DRY_RUN" != "true" ] && sudo -H pip install -U pipenv
echo "Installing dependencies..."
# Skip actual installation in dry run
[ "$DRY_RUN" != "true" ] && pipenv install
echo "Running migrations..."
# Skip actual migrations in dry run
[ "$DRY_RUN" != "true" ] && pipenv run python manage.py migrate
echo "Install screen"
sudo apt install screen
echo "Runserver..."
# Skip actual restart in dry run
[ "$DRY_RUN" != "true" ] && screen -d -m pipenv run python manage.py runserver 0.0.0.0:8000
echo "Redirect port..."
# Skip actual restart in dry run
[ "$DRY_RUN" != "true" ] && sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
echo "Deployment complete."