Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ jobs:
# 1. Active 슬롯 확인 (upstream.conf 기준)
UPSTREAM_PORT=$(grep -oE "server 127\.0\.0\.1:[0-9]+" /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE "[0-9]+$" || echo "8081")
if [ "$UPSTREAM_PORT" = "8080" ]; then
ACTIVE_SLOT="blue"; ACTIVE_PORT=8080; NEW_SLOT="green"; NEW_PORT=8081; MANAGEMENT_PORT=9081
ACTIVE_SLOT="blue"; ACTIVE_PORT=8080; NEW_SLOT="green"; NEW_PORT=9080; MANAGEMENT_PORT=9081
else
ACTIVE_SLOT="green"; ACTIVE_PORT=8081; NEW_SLOT="blue"; NEW_PORT=8080; MANAGEMENT_PORT=9080
ACTIVE_SLOT="green"; ACTIVE_PORT=9080; NEW_SLOT="blue"; NEW_PORT=8080; MANAGEMENT_PORT=8081
fi
echo "Active: ${ACTIVE_SLOT}(${ACTIVE_PORT}) → Deploy: ${NEW_SLOT}(${NEW_PORT}), management: ${MANAGEMENT_PORT}"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prod-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ jobs:
# 1. Active 슬롯 확인 (upstream.conf 기준)
UPSTREAM_PORT=$(grep -oE "server 127\.0\.0\.1:[0-9]+" /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE "[0-9]+$" || echo "8081")
if [ "$UPSTREAM_PORT" = "8080" ]; then
ACTIVE_SLOT="blue"; ACTIVE_PORT=8080; NEW_SLOT="green"; NEW_PORT=8081; MANAGEMENT_PORT=9081
ACTIVE_SLOT="blue"; ACTIVE_PORT=8080; NEW_SLOT="green"; NEW_PORT=9080; MANAGEMENT_PORT=9081
else
ACTIVE_SLOT="green"; ACTIVE_PORT=8081; NEW_SLOT="blue"; NEW_PORT=8080; MANAGEMENT_PORT=9080
ACTIVE_SLOT="green"; ACTIVE_PORT=9080; NEW_SLOT="blue"; NEW_PORT=8080; MANAGEMENT_PORT=8081
Comment on lines +141 to +143

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid reusing ports held by the active slot

On the first rollout from the parent version, the active container is still running until after the nginx switch, and the compose file uses network_mode: "host". If blue is active, it still owns management port 9080 while this starts green with APP_PORT=9080; if green is active, it still owns app port 8081 while this starts blue with MANAGEMENT_PORT=8081. In either current production state, the new Spring process cannot bind the port before the old slot is stopped, so the deployment fails instead of remaining zero-downtime. Keep the old app/management port pairs during migration or explicitly drain/stop the old listener before reusing those ports.

Useful? React with 👍 / 👎.

fi
echo "Active: ${ACTIVE_SLOT}(${ACTIVE_PORT}) → Deploy: ${NEW_SLOT}(${NEW_PORT}), management: ${MANAGEMENT_PORT}"

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
- SPRING_PROFILES_ACTIVE=dev
- SERVER_PORT=${APP_PORT:-8080}
- MANAGEMENT_SERVER_PORT=${MANAGEMENT_PORT:-9080}
- MANAGEMENT_SERVER_PORT=${MANAGEMENT_PORT:-8081}
- AWS_REGION=ap-northeast-2
- SPRING_DATA_REDIS_HOST=127.0.0.1
- SPRING_DATA_REDIS_PORT=6379
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
- SPRING_PROFILES_ACTIVE=prod
- SERVER_PORT=${APP_PORT:-8080}
- MANAGEMENT_SERVER_PORT=${MANAGEMENT_PORT:-9080}
- MANAGEMENT_SERVER_PORT=${MANAGEMENT_PORT:-8081}
- AWS_REGION=ap-northeast-2
- SPRING_DATA_REDIS_HOST=127.0.0.1
- SPRING_DATA_REDIS_PORT=6379
Expand Down
Loading