-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·52 lines (49 loc) · 1.62 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
#!/bin/bash
set -e
echo "Switching to main branch..."
git checkout main
echo "Pulling latest changes..."
git pull origin main
while true; do
read -p "Do you wish to rebuild and restart the containers? (y/n) " yn
case $yn in
[Yy]* )
while true; do
read -p "Is this being deployed in the development server? (y/n) " dev_yn
case $dev_yn in
[Yy]* )
export NGINX_HTTP=5001
export NGINX_HTTPS=5002
export NGINX_SSL=false
break;;
[Nn]* )
export NGINX_HTTP=80
export NGINX_HTTPS=443
export NGINX_SSL=true
break;;
* ) echo "Please answer y or n.";;
esac
done
docker-compose down
docker-compose build
docker-compose up -d
break;;
[Nn]* ) exit;;
* ) echo "Please answer y or n.";;
esac
done
while true; do
read -p "Do you wish to set up a ping cronjob to keep the app warm? (y/n) " cron_yn
case $cron_yn in
[Yy]* )
if ! (crontab -l 2>/dev/null | grep -q "curl http://jike.moe/healthz"); then
(crontab -l 2>/dev/null ; echo "* * * * * /usr/bin/curl http://jike.moe/healthz") | crontab -
echo "Cronjob set up successfully!"
else
echo "Cronjob already exists."
fi
break;;
[Nn]* ) exit;;
* ) echo "Please answer y or n.";;
esac
done