-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.sh
executable file
·37 lines (24 loc) · 993 Bytes
/
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
#!/bin/bash
DOCKER_APP_NAME=mymap
EXIST_BLUE=$(docker-compose -p ${DOCKER_APP_NAME}-blue -f docker-compose.blue.yml ps | grep Up)
if [ -z "$EXIST_BLUE" ]; then
echo "blue up"
docker-compose -p ${DOCKER_APP_NAME}-blue -f docker-compose.blue.yml up -d
sleep 20
RES_CODE=$(curl -o /dev/null -w "%{http_code}" "localhost:3001")
if [ $RES_CODE -eq 200 ]; then
docker-compose -p ${DOCKER_APP_NAME}-green -f docker-compose.green.yml down
else
docker-compose -p ${DOCKER_APP_NAME}-blue -f docker-compose.blue.yml down
fi
else
echo "green up"
docker-compose -p ${DOCKER_APP_NAME}-green -f docker-compose.green.yml up -d
sleep 20
RES_CODE=$(curl -o /dev/null -w "%{http_code}" "localhost:3002")
if [ $RES_CODE -eq 200 ]; then
docker-compose -p ${DOCKER_APP_NAME}-blue -f docker-compose.blue.yml down
else
docker-compose -p ${DOCKER_APP_NAME}-green -f docker-compose.green.yml down
fi
fi