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
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Gradle 명령 실행을 위한 권한을 부여합니다.
run: chmod +x gradlew

- name: application-secret.yml 파일 생성
run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application-secret.yml

Comment on lines +35 to +37

Copilot AI Mar 26, 2026

Copy link

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.
Comment on lines +35 to +37

Copilot AI Mar 26, 2026

Copy link

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.
- name: Gradle clean build를 수행합니다.
run: ./gradlew clean build

Expand Down
40 changes: 7 additions & 33 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,25 @@ services:
ports:
- "8080:8080"
depends_on:
- db
- redis
redis:
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: prod
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
SPRING_REDIS_HOST: ${SPRING_REDIS_HOST}
SPRING_REDIS_PORT: ${SPRING_REDIS_PORT}
REDIS_HOST: ${SPRING_REDIS_HOST}
REDIS_PORT: ${SPRING_REDIS_PORT}
Comment on lines +18 to +19

Copilot AI Mar 26, 2026

Copy link

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.
networks:
- retrip-net
restart: always

db:
image: mysql:8.0
platform: linux/amd64
container_name: retrip-db
env_file:
- .env
ports:
- "3306:3306"
environment:
MYSQL_USER: ${MYSQL_USER}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- dbdata:/var/lib/mysql
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./docker/mysql/mysql-healthcheck.sh:/usr/local/bin/mysql-healthcheck.sh
networks:
- retrip-net
restart: always
healthcheck:
test: [ "CMD-SHELL", "/usr/local/bin/mysql-healthcheck.sh" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s

redis:
image: redis:7
platform: linux/amd64
container_name: retrip-redis

Copilot AI Mar 26, 2026

Copy link

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.
ports:
- "6379:6379"
expose:
- ${SPRING_REDIS_PORT}
networks:
- retrip-net
restart: always
Expand Down Expand Up @@ -128,7 +103,6 @@ services:
- retrip-net

volumes:
dbdata:
grafana-storage:
certbot_data:

Expand Down
47 changes: 41 additions & 6 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,16 @@ server:

---
spring:
# Profile Config
config:
activate:
on-profile: local

datasource:
driver-class-name: ${db.local.driver-class-name}
url: ${db.local.url}
username: ${db.local.username}
password: ${db.local.password}
driver-class-name: ${db.local.driver-class-name}

# JPA Config
jpa:
show-sql: true
database: mysql
Expand All @@ -74,11 +72,10 @@ spring:
hibernate:
format_sql: true

# Redis Config
data:
redis:
host: ${redis.host}
port: ${redis.port}
host: ${redis.local.host}
port: ${redis.local.port}

codec:
max-in-memory-size: 10MB
Expand All @@ -89,5 +86,43 @@ retrip:
max-count: 8
max-size-mb: 10

processing:
timeout-seconds: 90

---
spring:
config:
activate:
on-profile: prod

datasource:
url: ${db.prod.url}
username: ${db.prod.username}
password: ${db.prod.password}
driver-class-name: ${db.prod.driver-class-name}

jpa:
show-sql: false
database: mysql
hibernate:
ddl-auto: validate
properties:
hibernate:
format_sql: false

data:
redis:
host: ${redis.prod.host}
port: ${redis.prod.port}

codec:
max-in-memory-size: 10MB

retrip:
image:
min-count: 5
max-count: 20
max-size-mb: 10

processing:
timeout-seconds: 90
Loading