-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswap_builds.sh
37 lines (26 loc) · 1.1 KB
/
swap_builds.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
#!/bin/sh
is_blue=`systemctl is-active derpy-tools-blue`
is_green=`systemctl is-active derpy-tools-green`
if [ "$is_blue" != "active" ] && [ $is_green != "active" ]; then
sudo sed -i "s/reverse_proxy localhost:400./reverse_proxy localhost:4002/g" /etc/caddy/Caddyfile
sudo systemctl start derpy-tools-blue
sudo systemctl enable --now derpy-tools-blue
sudo systemctl restart caddy
echo "blue"
elif [ "$is_blue" = "active" ]; then
sudo sed -i "s/reverse_proxy localhost:400./reverse_proxy localhost:4003/g" /etc/caddy/Caddyfile
sudo systemctl stop derpy-tools-blue
sudo systemctl disable derpy-tools-blue
sudo systemctl start derpy-tools-green
sudo systemctl enable --now derpy-tools-green
sudo systemctl restart caddy
echo "green"
else
sudo sed -i "s/reverse_proxy localhost:400./reverse_proxy localhost:4002/g" /etc/caddy/Caddyfile
sudo systemctl stop derpy-tools-green
sudo systemctl disable derpy-tools-green
sudo systemctl start derpy-tools-blue
sudo systemctl enable --now derpy-tools-blue
sudo systemctl restart caddy
echo "blue"
fi