Skip to content

refactor: 배포 환경 변수 수정#56

Merged
Bumnote merged 1 commit intodevfrom
refactor/deploy
Mar 26, 2026
Merged

refactor: 배포 환경 변수 수정#56
Bumnote merged 1 commit intodevfrom
refactor/deploy

Conversation

@Bumnote
Copy link
Copy Markdown
Member

@Bumnote Bumnote commented Mar 26, 2026

#️⃣ 연관된 이슈

issue #54

📝 작업 내용

  • 추가된 redis 환경에 대한 환경변수들을 추가했습니다.
  • CI 과정에서도 application-secret.yml 파일을 생성할 수 있도록 구조를 변경했습니다.
  • 로컬 환경과 운영 환경을 분리하기 위한 profile 설정을 추가했습니다.

💬 리뷰 요구사항

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요


- 추가된 redis 환경에 대한 환경변수들을 추가했습니다.
- CI 과정에서도 application-secret.yml 파일을 생성할 수 있도록 구조를 변경했습니다.
- 로컬 환경과 운영 환경을 분리하기 위한 profile 설정을 추가했습니다.

issue #54
@Bumnote Bumnote requested a review from Copilot March 26, 2026 17:23
@Bumnote Bumnote self-assigned this Mar 26, 2026
@Bumnote Bumnote merged commit b47f603 into dev Mar 26, 2026
1 check passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors deployment configuration to separate local vs prod profiles, add Redis environment configuration, and adjust CI so application-secret.yml is created during workflows (supporting builds that require the secret config).

Changes:

  • Split application.yml into local and prod profiles with profile-specific DB/Redis/JPA settings.
  • Update docker-compose.yml to depend on Redis health, adjust Redis exposure, and set SPRING_PROFILES_ACTIVE=prod.
  • Update CI workflow to generate src/main/resources/application-secret.yml from GitHub Secrets before building.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/main/resources/application.yml Adds explicit local/prod profile blocks and profile-specific datasource/redis/jpa properties.
docker-compose.yml Updates runtime env wiring and redis service configuration for deployment.
.github/workflows/CI.yml Creates application-secret.yml during CI to allow Gradle build to run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +37
- name: application-secret.yml 파일 생성
run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application-secret.yml

Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

CI에서 secrets.APPLICATION 내용을 src/main/resources/application-secret.yml로 생성한 뒤 그대로 Gradle 빌드/도커 이미지 빌드에 포함됩니다. 이 파일에 DB/Redis/AWS 자격증명 같은 민감정보가 들어있다면, 결과 JAR/이미지(Docker Hub push 포함)에 영구적으로 내장되어 유출 위험이 큽니다. 런타임에서만 주입(예: 배포 시 EC2에서 파일 생성 후 볼륨 마운트, 또는 Spring 환경변수/Secrets Manager 사용)하도록 변경하는 것이 안전합니다.

Copilot uses AI. Check for mistakes.
redis:
image: redis:7
platform: linux/amd64
container_name: retrip-redis
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

Redis 서비스는 기본적으로 컨테이너 내부에서 6379 포트로만 리슨하는데, 여기서는 expose: - ${SPRING_REDIS_PORT}로 포트를 변수화했습니다. SPRING_REDIS_PORT를 6379 이외 값으로 설정하면 앱은 그 포트로 접속을 시도하지만 Redis 컨테이너는 해당 포트에서 리슨하지 않아 연결이 실패합니다. 포트를 고정(6379)하거나, Redis 쪽도 동일 포트로 리슨하도록 command/설정으로 함께 변경해 주세요.

Suggested change
container_name: retrip-redis
container_name: retrip-redis
command: ["redis-server", "--port", "${SPRING_REDIS_PORT}"]

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +19
REDIS_HOST: ${SPRING_REDIS_HOST}
REDIS_PORT: ${SPRING_REDIS_PORT}
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

현재 application.yml의 prod 프로필은 spring.data.redis.host/port${redis.prod.host} / ${redis.prod.port}로 해석하도록 되어 있는데, 이 compose 파일은 컨테이너에 REDIS_HOST/REDIS_PORT만 주입하고 있습니다. Spring에서 redis.prod.host를 환경변수로 주입하려면 보통 REDIS_PROD_HOST/REDIS_PROD_PORT(또는 표준 프로퍼티인 SPRING_DATA_REDIS_HOST/SPRING_DATA_REDIS_PORT)가 필요해서, 이 상태로는 application-secret.yml에 값이 없으면 기동 시 placeholder 해석 실패가 발생할 수 있습니다. compose와 프로퍼티 키를 동일한 체계로 맞춰 주세요.

Suggested change
REDIS_HOST: ${SPRING_REDIS_HOST}
REDIS_PORT: ${SPRING_REDIS_PORT}
REDIS_PROD_HOST: ${SPRING_REDIS_HOST}
REDIS_PROD_PORT: ${SPRING_REDIS_PORT}

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
- name: application-secret.yml 파일 생성
run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application-secret.yml

Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

pull_request 이벤트에서는(특히 포크 PR) 기본적으로 Actions secret이 전달되지 않아 ${{ secrets.APPLICATION }} 값이 비어 있을 수 있습니다. 그 경우 빈 application-secret.yml이 생성되어 빌드/테스트가 실패할 가능성이 있으니, secret이 없을 때는 예시/더미 파일을 생성하거나 해당 단계와 테스트를 조건부로 실행하도록 가드하는 처리가 필요합니다.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants