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