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
8 changes: 3 additions & 5 deletions .github/workflows/production-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ jobs:
envs: NLB_ID,ACCESS_TOKEN_SECRET_KEY,REFRESH_TOKEN_SECRET_KEY,DB_URL,DB_USERNAME,DB_PASSWORD
script: |
cd ~/snackgame-server/repo
git fetch origin main
git checkout -B main origin/main
git pull --ff-only origin main --no-recurse-submodules
git fetch origin main
git reset --hard origin/main
chmod +x scripts/deploy-rolling.sh
scripts/deploy-rolling.sh \
${{ secrets.NLB_BACKEND_02_HTTP }} \
Expand Down Expand Up @@ -99,8 +98,7 @@ jobs:
script: |
cd ~/snackgame-server/repo
git fetch origin main
git checkout -B main origin/main
git pull --ff-only origin main --no-recurse-submodules
git reset --hard origin/main
chmod +x scripts/deploy-rolling.sh
scripts/deploy-rolling.sh \
${{ secrets.NLB_BACKEND_01_HTTP }} \
Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ dependencies {
implementation("com.google.firebase:firebase-admin:9.2.0")
implementation("com.squareup.okhttp3:okhttp:4.2.2")

implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("io.micrometer:micrometer-registry-prometheus")

runtimeOnly("com.h2database:h2")
runtimeOnly("com.mysql:mysql-connector-j")

Expand Down
17 changes: 9 additions & 8 deletions scripts/deploy-rolling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,18 @@ set_drain() {
--network-load-balancer-id "$NLB_ID" \
--backend-set-name snackgame-http \
--backend-name "$HTTP_BACKEND" \
--is-drain "$is_drain"
--is-drain "$is_drain" \
--wait-for-state SUCCEEDED \
--max-wait-seconds 120

oci nlb backend update \
--auth instance_principal \
--network-load-balancer-id "$NLB_ID" \
--backend-set-name snackgame-https \
--backend-name "$HTTPS_BACKEND" \
--is-drain "$is_drain"


if [ "$is_drain" = "true" ]; then
echo "[NLB] 드레인 적용 대기 중 (10초)..."
sleep 10
fi
--is-drain "$is_drain" \
--wait-for-state SUCCEEDED \
--max-wait-seconds 120
}


Expand Down Expand Up @@ -99,6 +97,9 @@ cd "$COMPOSE_DIR"

set_drain true

echo "기존 연결 종료 대기..."
sleep 15


echo "[Pull] 새 이미지 받는 중..."
docker compose pull
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,14 @@ server:
session:
cookie:
same-site: none

management:
endpoints:
web:
exposure:
include: "health,prometheus,loggers"
endpoint:
health:
show-details: never
prometheus:
enabled: true
25 changes: 21 additions & 4 deletions src/main/resources/application-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,38 @@ spring:
jpa:
hibernate:
ddl-auto: validate
servlet:
session:
cookie:
same-site: none

security:
jwt:
token:
access-secret-key: ${ACCESS_TOKEN_SECRET_KEY}
access-expiry-days: ${ACCESS_TOKEN_EXPIRY_DAYS}
refresh-secret-key: ${REFRESH_TOKEN_SECRET_KEY}
refresh-expiry-days: ${REFRESH_TOKEN_EXPIRY_DAYS}

server:
port: ${APPLICATION_PORT}
forward-headers-strategy: native
Comment on lines +9 to 24
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Spring Boot 2.7 버전에서 세션 쿠키의 SameSite 설정은 spring.servlet이 아닌 server.servlet 하위에 위치해야 합니다. 현재 설정은 spring: 블록 내부에 잘못 배치되어 있어 운영 환경에서 세션 쿠키 설정이 무시될 수 있습니다. 이를 server: 블록 하위로 다시 이동해야 합니다.

security:
  jwt:
    token:
      access-secret-key: ${ACCESS_TOKEN_SECRET_KEY}
      access-expiry-days: ${ACCESS_TOKEN_EXPIRY_DAYS}
      refresh-secret-key: ${REFRESH_TOKEN_SECRET_KEY}
      refresh-expiry-days: ${REFRESH_TOKEN_EXPIRY_DAYS}

server:
  port: ${APPLICATION_PORT}
  forward-headers-strategy: native
  servlet:
    session:
      cookie:
        same-site: none

servlet:
session:
cookie:
same-site: none

springdoc:
api-docs:
enabled: false

management:
endpoints:
web:
exposure:
include: "health,prometheus"
endpoint:
health:
show-details: never
prometheus:
enabled: true
metrics:
tags:
application: snackgame
environment: production
8 changes: 8 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,13 @@ springdoc:
disabled: true
override-with-generic-response: false

management:
endpoints:
web:
exposure:
include: ""
endpoint:
health:
show-details: never
server:
shutdown: graceful
Loading