fix: Nginx SSL support for Apache proxy
This commit is contained in:
@@ -26,11 +26,11 @@ jobs:
|
||||
run: |
|
||||
echo "Starting Blue-Green CI/CD Deploy pipeline..."
|
||||
|
||||
# 1. (제거됨: 호스트 볼륨에서의 불필요한 gradle 빌드 제외 - Dockerfile 내에서 이미 수행하므로 OOM 방지)
|
||||
# 1. (?œê±°?? ?¸ìФ??볼륨?<3F>서??불필?”한 gradle 빌드 ?œì™¸ - Dockerfile ?´ì—<C3AC>???´ë? ?˜í–‰?˜ë?ë¡?OOM ë°©ì?)
|
||||
|
||||
cd /app
|
||||
|
||||
# 3. 블루/그린 타겟 식별
|
||||
# 3. 블루/그린 ?€ê²??<3F>별
|
||||
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) 컨테?´ë„ˆ 기ë<C2B0>™
|
||||
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. ?ˆê±°??컨테?´ë„ˆ ì²?†Œ (?¬íЏ ì¶©ë<C2A9>Œ ë°©ì?, 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 초기 ?¤ì • ë°?기ë<C2B0>™
|
||||
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 (??ë²„ì „???•ìƒ<C3AC>?<3F>으ë¡??´ëŠ”ì§€ ?•ì<E280A2>¸)
|
||||
echo "Waiting 30 seconds for services to fully start..."
|
||||
sleep 30
|
||||
|
||||
# 신규 컨테이너가 죽지 않고 살아있는지 확인
|
||||
# ? ê·œ 컨테?´ë„ˆê°€ 죽ì? ?Šê³ ?´ì•„?ˆëŠ”ì§€ ?•ì<E280A2>¸
|
||||
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 # ?Œì<C592>´?„ë<E2809E>¼???¤íŒ¨ 처리 (구버?„ì? ê·¸ë?ë¡?? ì???
|
||||
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"
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ services:
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- "8281:8281"
|
||||
- "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:
|
||||
@@ -271,3 +273,5 @@ services:
|
||||
- GLOW_COMMUNICATION_EAI_HOMT=http://mci-mock
|
||||
- GLOW_COMMUNICATION_EAI_PORT=8080
|
||||
- SPRING_PROFILES_ACTIVE=${ACTIVE_PROFILE:-local}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user