diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 970cb025..0b35de65 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -26,11 +26,11 @@ jobs: run: | echo "Starting Blue-Green CI/CD Deploy pipeline..." - # 1. (제거됨: 호스트 볼륨에서의 불필요한 gradle 빌드 제외 - Dockerfile 내에서 이미 수행하므로 OOM 방지) + # 1. (?거?? ?스??볼륨?서??불필?한 gradle 빌드 ?외 - Dockerfile ?에???? ?행???OOM 방?) cd /app - # 3. 블루/그린 타겟 식별 + # 3. 블루/그린 ???별 IS_BLUE_RUNNING=$(docker ps --filter "name=ax_hub_mcp_tool-gateway-blue-1" --filter "status=running" -q) if [ ! -z "$IS_BLUE_RUNNING" ]; then @@ -43,10 +43,10 @@ jobs: OLD_TARGET="green" fi - # 3.5. 공통 인프라 (DB, Redis 등) 먼저 띄우기 (Nginx 제외) + # 3.5. 공통 ?프??(DB, Redis ?? 먼? ?우?(Nginx ?외) ACTIVE_PROFILE=dev docker compose up -d redis mci-mock dozzle - # 4. 신규 버전(TARGET) 컨테이너 기동 + # 4. ?규 버전(TARGET) 컨테?너 기동 echo "Building and starting $TARGET containers sequentially to prevent OOM..." ACTIVE_PROFILE=dev docker compose build gateway-$TARGET ACTIVE_PROFILE=dev docker compose build tool-sms-$TARGET @@ -64,7 +64,7 @@ jobs: sleep 5 ACTIVE_PROFILE=dev docker compose up -d tool-payment-$TARGET - # 4.5. 레거시 컨테이너 청소 (포트 충돌 방지, Nginx 제외) + # 4.5. ?거??컨테?너 ? (?트 충돌 방?, Nginx ?외) echo "Finding and killing legacy containers holding our ports..." for port in 8281 8282 8283 8284 8285; do cids=$(docker ps -q --filter "publish=$port") @@ -77,17 +77,17 @@ jobs: done done - # 4.6. Nginx 초기 설정 및 기동 + # 4.6. Nginx 초기 ?정 ?기동 mkdir -p ./nginx/conf.d echo "Initializing Nginx config to $TARGET..." cp ./nginx/${TARGET}.conf ./nginx/conf.d/default.conf ACTIVE_PROFILE=dev docker compose up -d nginx - # 5. Health Check (새 버전이 정상적으로 떴는지 확인) + # 5. Health Check (??버전???상?으??는지 ?인) echo "Waiting 30 seconds for services to fully start..." sleep 30 - # 신규 컨테이너가 죽지 않고 살아있는지 확인 + # ?규 컨테?너가 죽? ?고 ?아?는지 ?인 IS_TARGET_ALIVE=$(docker ps --filter "name=ax_hub_mcp_tool-gateway-${TARGET}-1" --filter "status=running" -q) if [ -z "$IS_TARGET_ALIVE" ]; then @@ -98,10 +98,10 @@ jobs: docker compose restart nginx || true echo "Stopping failed $TARGET containers..." docker compose stop gateway-$TARGET tool-sms-$TARGET tool-email-$TARGET tool-other-$TARGET tool-payment-$TARGET - exit 1 # 파이프라인 실패 처리 (구버전은 그대로 유지됨) + exit 1 # ?이?라???패 처리 (구버?? 그?????? fi - # 6. 트래픽 전환 (Nginx 설정 스위칭) + # 6. ?래???환 (Nginx ?정 ?위? echo "Health Check Passed! Switching traffic to $TARGET..." mkdir -p ./nginx/conf.d cp ./nginx/${TARGET}.conf ./nginx/conf.d/default.conf @@ -115,12 +115,13 @@ jobs: exit 1 fi - # 7. 구버전 종료 + # 7. 구버??종료 echo "Traffic switched successfully. Stopping old $OLD_TARGET containers..." docker compose stop gateway-$OLD_TARGET tool-sms-$OLD_TARGET tool-email-$OLD_TARGET tool-other-$OLD_TARGET tool-payment-$OLD_TARGET - # 가비지 청소 + # 가비? ? docker system prune -f docker image prune -f echo "Blue-Green CI/CD Deploy Success! Currently running: $TARGET" + diff --git a/docker-compose.yml b/docker-compose.yml index ce08f04d..bd4758fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,13 +46,13 @@ services: nginx: image: nginx:latest ports: - - "8281:8281" - - "8282:8282" + - "8282:8282" - "8283:8283" - "8284:8284" - "8285:8285" volumes: - ./nginx/conf.d:/etc/nginx/conf.d + - ./nginx/ssl:/etc/nginx/ssl depends_on: redis: condition: service_healthy @@ -172,6 +172,8 @@ services: build: context: . dockerfile: dap-gateway/Dockerfile + ports: + - "8281:8081" volumes: - ./:/src depends_on: @@ -270,4 +272,6 @@ services: - GLOW_COMMUNICATION_EXTMCI_PORT=8080 - GLOW_COMMUNICATION_EAI_HOMT=http://mci-mock - GLOW_COMMUNICATION_EAI_PORT=8080 - - SPRING_PROFILES_ACTIVE=${ACTIVE_PROFILE:-local} \ No newline at end of file + - SPRING_PROFILES_ACTIVE=${ACTIVE_PROFILE:-local} + + diff --git a/nginx/blue.conf b/nginx/blue.conf index a169be5d..57872179 100644 --- a/nginx/blue.conf +++ b/nginx/blue.conf @@ -15,7 +15,10 @@ upstream tool-payment { } server { - listen 8281 http2; + listen 8281 ssl; + ssl_certificate /etc/nginx/ssl/nginx.crt; + ssl_certificate_key /etc/nginx/ssl/nginx.key; + location / { proxy_pass http://gateway; proxy_http_version 1.1; @@ -28,7 +31,7 @@ server { } } server { - listen 8282 http2; + listen 8282; location / { proxy_pass http://tool-sms; proxy_http_version 1.1; @@ -41,7 +44,7 @@ server { } } server { - listen 8283 http2; + listen 8283; location / { proxy_pass http://tool-email; proxy_http_version 1.1; @@ -54,7 +57,7 @@ server { } } server { - listen 8284 http2; + listen 8284; location / { proxy_pass http://tool-other; proxy_http_version 1.1; @@ -67,7 +70,7 @@ server { } } server { - listen 8285 http2; + listen 8285; location / { proxy_pass http://tool-payment; proxy_http_version 1.1; diff --git a/nginx/green.conf b/nginx/green.conf index 5f54fa36..64971e7c 100644 --- a/nginx/green.conf +++ b/nginx/green.conf @@ -15,7 +15,10 @@ upstream tool-payment { } server { - listen 8281 http2; + listen 8281 ssl; + ssl_certificate /etc/nginx/ssl/nginx.crt; + ssl_certificate_key /etc/nginx/ssl/nginx.key; + location / { proxy_pass http://gateway; proxy_http_version 1.1; @@ -28,7 +31,7 @@ server { } } server { - listen 8282 http2; + listen 8282; location / { proxy_pass http://tool-sms; proxy_http_version 1.1; @@ -41,7 +44,7 @@ server { } } server { - listen 8283 http2; + listen 8283; location / { proxy_pass http://tool-email; proxy_http_version 1.1; @@ -54,7 +57,7 @@ server { } } server { - listen 8284 http2; + listen 8284; location / { proxy_pass http://tool-other; proxy_http_version 1.1; @@ -67,7 +70,7 @@ server { } } server { - listen 8285 http2; + listen 8285; location / { proxy_pass http://tool-payment; proxy_http_version 1.1;