forked from swm-standard/phote-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
39 lines (28 loc) · 772 Bytes
/
deploy.sh
File metadata and controls
39 lines (28 loc) · 772 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
33
34
35
36
37
38
39
#!/bin/bash
IS_GREEN=$(docker ps | grep green)
DEFAULT_CONF=" /etc/nginx/nginx.conf"
if [ -z $IS_GREEN ];then
echo "### GREEN => BLUE ###"
echo "1. get blue image"
docker compose pull blue
echo "2. blue container up"
docker compose up -d blue
while [ 1 = 1 ]; do
echo "3. blue health check..."
sleep 3
REQUEST=$(curl http://127.0.0.1:8080)
if [ -n "$REQUEST" ]; then
echo "health check success"
break ;
fi
done;
echo "4. reload nginx"
sudo cp /etc/nginx/nginx.blue.conf /etc/nginx/nginx.conf
sudo nginx -s rel
echo "5. green container down"
docker compose stop green
else
echo "### BLUE => GREEN ###"
echo "1. get green image"
docker compose pull green
echo "2. green container up"