Skip to content
Open
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
38 changes: 19 additions & 19 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
PORT=8080
ALLOWED_ORIGINS=http://localhost,http://localhost:3000,http://158.180.72.158,http://velog-dashboard.kro.kr,https://velog-dashboard.kro.kr,http://velog.io,https://velog.io
NODE_ENV="development"
ALLOWED_ORIGINS=http://localhost,http://localhost:3000
NODE_ENV=development

# 토큰 단방향 암호화 전용 핵심 키
AES_KEY_0=13ccb93c17a8d6e49ba3c5d91e3a6f45
AES_KEY_1=76e2a34bf23cd45876bc91e6a87d3f22
AES_KEY_2=93a4d7e6b34ac8f1092fd5e87a93bc56
AES_KEY_3=b87f6c34d92fa17e3b2a67e58c93fa56
AES_KEY_4=27e3b8f67c4a12d8f93a6b17d4e58fa9
AES_KEY_5=6b83c9e21a7d48fa3f9b27e45c8a6f12
AES_KEY_6=81f92ab73c4e59d8a67f83b21d6e4c53
AES_KEY_7=d87b61e9f34a2c85f19a7e53c6d8f21a
AES_KEY_8=7c58f92ae1d3b67a4c29f8b36e17d4f9
AES_KEY_9=a93b4f7e2c6d81a7f5c3b2e89d47f612
AES_KEY_0=
AES_KEY_1=
AES_KEY_2=
AES_KEY_3=
AES_KEY_4=
AES_KEY_5=
AES_KEY_6=
AES_KEY_7=
AES_KEY_8=
AES_KEY_9=

# Database
DATABASE_NAME=vd2
POSTGRES_USER=vd2
POSTGRES_PASSWORD=vd2
DATABASE_NAME=postgres
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_HOST=localhost
POSTGRES_PORT=5432

# Cache (redis)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=notion-check-plz
REDIS_PASSWORD=
REDIS_DB=0
REDIS_KEY_PREFIX=vd2:
CACHE_DEFAULT_TTL=300

# Slack Notification
SLACK_WEBHOOK_URL=https://hooks.slack.com/services
SLACK_WEBHOOK_URL=

# Sentry Hook
SENTRY_CLIENT_SECRET=374708bedd34ae70f814471ff24db7dedc4b9bee06a7e8ef9255a4f6c8bd9049 # 실제 키를 사용하세요
SENTRY_DSN=https://ingest.us.sentry.io
SENTRY_CLIENT_SECRET=
SENTRY_DSN=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SYSTEM_DESIGN.md

# 환경 변수 및 인증 정보
.env
.env.prod
.env.local
.env.*.local

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
volumes:
- ./logs/api:/usr/src/app/logs
env_file:
- .env
- .env.prod
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Apr 3, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 목적: compose env_file와 CI에서 생성하는 env 파일명의 불일치 확인 (읽기 전용)
set -euo pipefail

echo "[1] docker-compose env_file 확인"
rg -n -C2 'env_file|\.env|\.env\.prod' docker-compose.yml

echo
echo "[2] GitHub Actions에서 생성하는 env 파일 확인"
fd -i 'api-ci-cd\.ya?ml$' .github/workflows --exec rg -n -C2 'Create \.env file|>> \.env|>> \.env\.prod'

echo
echo "[3] run.sh에서 참조하는 env 파일 확인(존재 시)"
fd -i '^run\.sh$' . --exec rg -n -C2 '\.env|\.env\.prod'

Repository: Check-Data-Out/velog-dashboard-v2-api

Length of output: 1799


env_file 파일명이 CI/CD와 불일치하여 배포 시 환경변수 로드 실패를 야기합니다.

docker-compose.yml은 .env.prod를 요구하지만, .github/workflows/api-ci-cd.yaml의 "Create .env file" 단계(라인 53-73)는 .env 파일만 생성합니다. 이 불일치로 컨테이너가 필수 환경변수 없이 올라올 수 있습니다.

다음 중 하나를 수행하세요:

  • CI/CD 워크플로우를 수정하여 .env.prod 파일을 생성하거나
  • docker-compose.yml의 env_file.env로 변경하세요
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker-compose.yml` at line 18, docker-compose.yml의 env_file이 `.env.prod`로
설정되어 있어 CI/CD의 "Create .env file" 단계(api-ci-cd.yaml)에서 생성하는 `.env`와 불일치해 배포 시
환경변수가 누락됩니다; 해결하려면 docker-compose.yml의 env_file 값을 `.env`로 변경하거나 CI/CD 워크플로우의
"Create .env file" 스텝을 수정해 `.env.prod`를 생성하도록 조치하고, 변경한 쪽과 다른 모든 참조(예: 로컬 개발/배포
문서나 다른 workflow 스텝)가 일관되게 동일한 파일명을 사용하도록 업데이트하세요.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

#52 머지후 이어가는게 나을 것 같습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ooheunda, 이해했습니다! PR #52가 먼저 머지된 후 CI/CD 워크플로우에서 .env.prod를 생성하도록 수정되면 이 불일치가 자연스럽게 해소될 것 같습니다. #52 머지 이후에 해당 부분을 다시 확인해 주세요. 👍


🧠 Learnings used
Learnt from: HA0N1
Repo: Check-Data-Out/velog-dashboard-v2-api PR: 4
File: src/middlewares/auth.middleware.ts:48-49
Timestamp: 2024-11-29T14:21:32.376Z
Learning: `auth.middleware.ts` 파일에서 `VELOG_API_URL`은 개발 및 배포 환경 모두에서 고정된 값으로, 환경 변수로 이동하지 않고 상수로 설정하여 가독성을 높이는 것이 좋습니다.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

근데 생각해보니까 CI에서 prod값이 필요하지 않습니다. (docker compose로 서버를 실행하지 않고 코드 검사만함) 그냥 냅둬도 될 것 같아요.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ooheunda, 좋은 설명 감사합니다! CI에서 docker compose로 서버를 실행하지 않고 코드 검사만 수행한다면, docker-compose.ymlenv_file 설정은 CI와 무관하므로 지적한 불일치 문제는 실제로 해당되지 않습니다. 현재 상태로 유지하셔도 됩니다. 🐇

( ˶ᵔ ᵕ ᵔ˶ )


✏️ Learnings added
Learnt from: ooheunda
Repo: Check-Data-Out/velog-dashboard-v2-api PR: 53
File: docker-compose.yml:18-18
Timestamp: 2026-04-04T08:50:18.297Z
Learning: `Check-Data-Out/velog-dashboard-v2-api` 프로젝트의 CI/CD 워크플로우(`.github/workflows/api-ci-cd.yaml`)에서는 `docker compose`로 서버를 실행하지 않고 코드 검사(lint/test 등)만 수행합니다. 따라서 CI에서 `.env` 파일을 생성하더라도 `docker-compose.yml`의 `env_file` 설정(`.env.prod`)과 불일치해도 배포에 영향이 없습니다. `docker compose`는 실제 프로덕션 배포 시에만 사용됩니다.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: HA0N1
Repo: Check-Data-Out/velog-dashboard-v2-api PR: 4
File: src/middlewares/auth.middleware.ts:48-49
Timestamp: 2024-11-29T14:21:32.376Z
Learning: `auth.middleware.ts` 파일에서 `VELOG_API_URL`은 개발 및 배포 환경 모두에서 고정된 값으로, 환경 변수로 이동하지 않고 상수로 설정하여 가독성을 높이는 것이 좋습니다.

Learnt from: HA0N1
Repo: Check-Data-Out/velog-dashboard-v2-api PR: 4
File: .env.sample:2-6
Timestamp: 2024-11-29T14:01:26.914Z
Learning: `velog-dashboard-v2-api` 프로젝트의 `.env.sample` 파일에서는 데이터베이스 접속 정보를 포함한 환경 변수에 예시 값을 사용하며, 이는 실제 자격 증명이 아니므로 그대로 두어도 됩니다.

environment:
NODE_ENV: production
TZ: Asia/Seoul
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { PostLeaderboardSortType, UserLeaderboardSortType } from '@/types';
import { getKSTDateStringWithOffset } from '@/utils/date.util';

dotenv.config();
jest.setTimeout(30000); // 각 케이스당 30초 타임아웃 설정
jest.setTimeout(60000); // 각 케이스당 60초 타임아웃 설정

/**
* LeaderboardRepository 통합 테스트
Expand Down
Loading