Skip to content
Open
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
53 changes: 53 additions & 0 deletions docs/before-prod-deploy-revert-issue-31.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 배포 전 원복 체크리스트 — issue #31

이슈: https://github.com/Shinhan-KLLJS/backend/issues/31 ([Fix] 프론트 개발자가 local에서 서버 호출할 수 있도록 수정)

## 무엇을 바꿨나

프론트 개발이 끝나기 전까지, 로컬(Vite 기본 포트 `5173`)에서 배포된 서버(dev로 배포되는 인스턴스,
실질적으로 운영과 같은 인프라)를 호출해 CORS 없이 API 테스트와 카카오 로그인까지 해볼 수 있도록,
`infra/terraform.tfvars`의 `app_frontend_url`을 임시로 바꿨다.

```diff
- app_frontend_url = "https://www.loovi.my"
+ app_frontend_url = "http://localhost:5173"
```

이 값 하나가 다음 세 가지에 전부 쓰인다 (그래서 값 하나만 바꿔도 CORS·로그인 리다이렉트가
동시에 로컬을 가리키게 된다):

1. **CORS 허용 origin** (`CorsConfig.java`) — `Access-Control-Allow-Origin`이 `http://localhost:5173`이 된다.
2. **TrustedOriginValidator** — refresh/logout 같은 쿠키 기반 요청의 Origin 검증도 로컬을 신뢰한다.
3. **카카오 로그인 성공/실패 후 리다이렉트** (`AppAuthProperties.java`) — 로그인 끝나면
`https://www.loovi.my/login/success`가 아니라 `http://localhost:5173/login/success`로 이동한다.

`terraform apply` 시 실제로 바뀌는 리소스는 2개뿐이다 (`terraform plan`으로 확인함):

- `module.ssm_params.aws_ssm_parameter.app_frontend_url` (`/vision/prod/app-frontend-url` 값 변경)
- `module.s3.aws_s3_bucket_cors_configuration.campaign_creatives` (캠페인 소재 업로드 CORS origin이
`https://www.loovi.my` → `http://localhost:5173`로 교체, `https://api.loovi.my`는 그대로 유지)

카카오 디벨로퍼스에 등록된 `kakao_redirect_uri`(`https://api.loovi.my/login/oauth2/code/kakao`,
백엔드 자체 콜백 주소)는 건드리지 않았다 — 바뀌는 건 로그인 "이후" 프론트로 돌아가는 주소뿐이다.

## 실제 배포 전에 반드시 할 일

**이 상태로는 실제 사용자가 카카오 로그인을 하면 `localhost:5173`으로 튕겨서 로그인이 끝나지 않고,
운영 프론트(`www.loovi.my`)에서의 API 호출도 CORS로 막힌다.** 프론트 개발이 끝나고 실제 배포하기
전에 반드시 원복해야 한다.

1. `infra/terraform.tfvars`에서 `app_frontend_url`을 원래 값으로 되돌린다.
```
app_frontend_url = "https://www.loovi.my"
```
Comment on lines +40 to +42

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

코드 블록에 언어와 주변 빈 줄을 추가해 주세요.

Markdownlint의 MD031/MD040 경고를 해결하려면 fenced block을 hcl로 지정하고 앞뒤에 빈 줄을 둬야 합니다.

수정안
 1. `infra/terraform.tfvars`에서 `app_frontend_url`을 원래 값으로 되돌린다.
+
-   ```
+   ```hcl
    app_frontend_url = "https://www.loovi.my"
    ```
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
app_frontend_url = "https://www.loovi.my"
```
🧰 Tools
🪛 markdownlint-cli2 (0.23.0)

[warning] 40-40: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 42-42: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/before-prod-deploy-revert-issue-31.md` around lines 40 - 42, Update the
fenced code block containing app_frontend_url to declare the hcl language and
ensure it has a blank line immediately before and after the fence, resolving the
MD031 and MD040 markdownlint warnings.

Source: Linters/SAST tools

2. `infra/`에서 `terraform plan`으로 위 두 리소스(SSM 파라미터, S3 CORS)가 원래 값으로 돌아가는지
확인 후 `terraform apply`.
3. 다음 배포(CD) 때 컨테이너가 SSM에서 값을 다시 읽어가므로, apply 후 재배포가 한 번 있어야
실제로 반영된다 — apply만 하고 재배포를 안 하면 이미 떠 있는 컨테이너는 이전 값을 계속 쓴다.
Comment on lines +45 to +46

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔵 Trivial

SSM 값을 읽는 시점과 재배포 보장을 확인해 주세요.

infra/modules/ssm_params/main.tf:68-76은 SSM 파라미터가 갱신되는 것만 보여 줍니다. 애플리케이션이 시작 시에만 값을 읽는지, CD가 반드시 새 컨테이너를 롤아웃하는지는 제공된 컨텍스트에서 확인되지 않습니다. 실제 동작이 startup-only라면 재배포/재시작과 배포 후 검증 절차를 명시하고, 동적 조회라면 “apply만으로는 반영되지 않는다”는 문구를 조정해 주세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/before-prod-deploy-revert-issue-31.md` around lines 45 - 46, Verify the
application’s SSM parameter read timing and CD rollout behavior before asserting
that redeployment is required. If values are read only at startup, document the
required redeploy/restart and post-deployment validation steps; if they are
dynamically refreshed, revise the statement that apply alone cannot update
running containers.

4. 이 문서와 issue #31은 원복 후 닫는다.

## 참고

`terraform.tfvars`는 gitignore 대상이라 이 변경 자체는 git에 흔적이 남지 않는다 — 그래서 이 문서가
유일한 기록이다. 원복을 깜빡하면 실제 배포 시점에 로그인이 조용히 깨지므로, 배포 전 체크리스트에
이 문서 확인을 포함시키는 걸 권장한다.
Loading