From fd536129d03b24569f1d67d07d4517b569975314 Mon Sep 17 00:00:00 2001 From: jun02160 Date: Sun, 3 Mar 2024 12:11:51 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs:=20docker-compose.yml=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=B6=84=EB=A6=AC=20#131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/api-CD.yml | 2 +- .github/workflows/batch-CD.yml | 2 +- docker-compose.yml => docker-compose-api.yml | 25 ---------------- docker-compose-batch.yml | 30 ++++++++++++++++++++ scripts/api/deploy.sh | 20 ++++++------- scripts/batch/deploy.sh | 15 +++++----- 6 files changed, 49 insertions(+), 45 deletions(-) rename docker-compose.yml => docker-compose-api.yml (60%) create mode 100644 docker-compose-batch.yml diff --git a/.github/workflows/api-CD.yml b/.github/workflows/api-CD.yml index 6d44c65b..f0d7b7ae 100644 --- a/.github/workflows/api-CD.yml +++ b/.github/workflows/api-CD.yml @@ -98,7 +98,7 @@ jobs: host: ${{ secrets.RELEASE_SERVER_IP }} username: ${{ secrets.RELEASE_SERVER_USER }} key: ${{ secrets.RELEASE_SERVER_KEY }} - source: "./docker-compose.yml" + source: "./docker-compose-api.yml" target: "/home/ubuntu/" deploy-cd: # job#2 diff --git a/.github/workflows/batch-CD.yml b/.github/workflows/batch-CD.yml index 69097e4b..b1f64c9f 100644 --- a/.github/workflows/batch-CD.yml +++ b/.github/workflows/batch-CD.yml @@ -99,7 +99,7 @@ jobs: host: ${{ secrets.RELEASE_SERVER_IP }} username: ${{ secrets.RELEASE_SERVER_USER }} key: ${{ secrets.RELEASE_SERVER_KEY }} - source: "./docker-compose.yml" + source: "./docker-compose-batch.yml" target: "/home/ubuntu/" deploy-cd: # job#2 diff --git a/docker-compose.yml b/docker-compose-api.yml similarity index 60% rename from docker-compose.yml rename to docker-compose-api.yml index da2b2dfd..80c3880a 100644 --- a/docker-compose.yml +++ b/docker-compose-api.yml @@ -22,19 +22,6 @@ services: # networks: # - motivoo-net - blue-batch: - container_name: blue-batch - image: yejunpark1/motivoo-batch-server - expose: - - 8081 - ports: - - "8081:8081" - environment: - - TZ=Asia/Seoul -# networks: -# - motivoo-net - - green-api: container_name: green-api image: yejunpark1/motivoo-api-server @@ -47,18 +34,6 @@ services: depends_on: - redis # networks: -# - motivoo-net - - green-batch: - container_name: green-batch - image: yejunpark1/motivoo-batch-server - expose: - - 8081 - ports: - - "8083:8081" - environment: - - TZ=Asia/Seoul -# networks: # - motivoo-net #networks: diff --git a/docker-compose-batch.yml b/docker-compose-batch.yml new file mode 100644 index 00000000..3981304b --- /dev/null +++ b/docker-compose-batch.yml @@ -0,0 +1,30 @@ +version: '3.8' +services: + + blue-batch: + container_name: blue-batch + image: yejunpark1/motivoo-batch-server + expose: + - 8081 + ports: + - "8081:8081" + environment: + - TZ=Asia/Seoul +# networks: +# - motivoo-net + + green-batch: + container_name: green-batch + image: yejunpark1/motivoo-batch-server + expose: + - 8081 + ports: + - "8083:8081" + environment: + - TZ=Asia/Seoul +# networks: +# - motivoo-net + +#networks: +# motivoo-net: +# driver: bridge \ No newline at end of file diff --git a/scripts/api/deploy.sh b/scripts/api/deploy.sh index 95517764..2e056b76 100644 --- a/scripts/api/deploy.sh +++ b/scripts/api/deploy.sh @@ -17,9 +17,9 @@ WEB_HEALTH_CHECK_URL=/actuator/health if [ -z "$IS_REDIS_ACTIVATE" ];then echo "###### REDIS ######" echo "[$NOW_TIME] Redis 도커 이미지 pull" - docker-compose pull redis + docker-compose -f docker-compose-api.yml pull redis echo "[$NOW_TIME] Redis 컨테이너 Up (빌드 & 실행)" - docker-compose up -d redis + docker-compose -f docker-compose-api.yml up -d redis fi # 실행 중인 서버 포트 확인 @@ -54,9 +54,9 @@ if [ -z $IS_GREEN_ACTIVATE ]; then CURRENT_SERVER_PORT=8082 echo "[$NOW_TIME] Green 도커 이미지 pull" - docker-compose pull green-api + docker-compose -f docker-compose-api.yml pull green-api echo "[$NOW_TIME] Green 컨테이너 Up (빌드 & 실행)" - docker-compose up -d green-api + docker-compose -f docker-compose-api.yml up -d green-api echo "[$NOW_TIME] 15초 후 Health Check 시작" sleep 15 @@ -78,7 +78,7 @@ if [ -z $IS_GREEN_ACTIVATE ]; then if [ $retry_count -eq 15 ]; then echo "[$NOW_TIME] Health check 실패.." echo "[$NOW_TIME] Nginx에 연결하지 않고 배포를 종료합니다." - docker-compose stop green-api + docker-compose -f docker-compose-api.yml stop green-api exit 1 fi done; @@ -91,7 +91,7 @@ if [ -z $IS_GREEN_ACTIVATE ]; then sudo nginx -s reload echo "[$NOW_TIME] 스위칭 후 실행 중인 Port: $(sudo cat /etc/nginx/conf.d/service-url.inc)" echo "[$NOW_TIME] Blue 컨테이너 중단" - docker-compose stop blue-api + docker-compose -f docker-compose-api.yml stop blue-api # Blue Up else @@ -101,9 +101,9 @@ else CURRENT_SERVER_PORT=8080 echo "[$NOW_TIME] Blue 도커 이미지 pull" - docker-compose pull blue-api + docker-compose -f docker-compose-api.yml pull blue-api echo "[$NOW_TIME] Blue 컨테이너 Up (빌드 & 실행)" - docker-compose up -d blue-api + docker-compose -f docker-compose-api.yml up -d blue-api echo "[$NOW_TIME] 15초 후 Health Check 시작" sleep 15 @@ -126,7 +126,7 @@ else if [ $retry_count -eq 15 ]; then echo "[$NOW_TIME] Health check 실패.." echo "[$NOW_TIME] Nginx에 연결하지 않고 배포를 종료합니다." - docker-compose stop blue-api + docker-compose -f docker-compose-api.yml stop blue-api exit 1 fi done; @@ -139,7 +139,7 @@ else sudo nginx -s reload echo "[$NOW_TIME] 스위칭 후 실행 중인 Port: $(sudo cat /etc/nginx/conf.d/service-url.inc)" echo "[$NOW_TIME] Green 컨테이너 중단" - docker-compose stop green-api + docker-compose -f docker-compose-api.yml stop green-api fi echo "----------------------------------------------------------------------" diff --git a/scripts/batch/deploy.sh b/scripts/batch/deploy.sh index fad1cb81..cdc89827 100644 --- a/scripts/batch/deploy.sh +++ b/scripts/batch/deploy.sh @@ -45,9 +45,9 @@ if [ -z $IS_GREEN_ACTIVATE ]; then CURRENT_SERVER_PORT=8083 echo "[$NOW_TIME] Green 도커 이미지 pull" - docker-compose pull green-batch + docker-compose -f docker-compose-batch.yml pull green-batch echo "[$NOW_TIME] Green 컨테이너 Up (빌드 & 실행)" - docker-compose up -d green-batch + docker-compose -f docker-compose-batch.yml up -d green-batch echo "[$NOW_TIME] 10초 후 Health Check 시작" sleep 10 @@ -81,7 +81,7 @@ if [ -z $IS_GREEN_ACTIVATE ]; then sudo nginx -s reload echo "[$NOW_TIME] 스위칭 후 실행 중인 Port: $(sudo cat /etc/nginx/conf.d/service-url-batch.inc)" echo "[$NOW_TIME] Blue 컨테이너 중단" - docker-compose stop blue-batch + docker-compose -f docker-compose-batch.yml stop blue-batch # Blue Up else @@ -91,9 +91,9 @@ else CURRENT_SERVER_PORT=8081 echo "[$NOW_TIME] Blue 도커 이미지 pull" - docker-compose pull blue-batch + docker-compose -f docker-compose-batch.yml pull blue-batch echo "[$NOW_TIME] Blue 컨테이너 Up (빌드 & 실행)" - docker-compose up -d blue-batch + docker-compose -f docker-compose-batch.yml up -d blue-batch echo "[$NOW_TIME] 10초 후 Health Check 시작" sleep 10 @@ -128,7 +128,7 @@ else sudo nginx -s reload echo "[$NOW_TIME] 스위칭 후 실행 중인 Port: $(sudo cat /etc/nginx/conf.d/service-url-batch.inc)" echo "[$NOW_TIME] Green 컨테이너 중단" - docker-compose stop green-batch + docker-compose -f docker-compose-batch.yml stop green-batch fi echo "----------------------------------------------------------------------" @@ -145,5 +145,4 @@ else echo "[$NOW_TIME] 서버 변경 실패" echo "[$NOW_TIME] 서버 응답 결과: ${RESPONSE}" exit 1 -fi - +fi \ No newline at end of file