Skip to content

[BE][chore]: 로컬 / 테스트 환경 변경#1130

Open
minSsan wants to merge 1 commit intodevelop-befrom
chore/1129
Open

[BE][chore]: 로컬 / 테스트 환경 변경#1130
minSsan wants to merge 1 commit intodevelop-befrom
chore/1129

Conversation

@minSsan
Copy link
Contributor

@minSsan minSsan commented Jan 13, 2026

🔗 관련 이슈

📝 작업 내용

  • 로컬 & 테스트 환경을 mysql로 변경
    • 로컬에 3306 포트로 MySQL 컨테이너 실행되어 있어야 함 (mulkkam_db 데이터베이스 생성 필요)

주요 변경사항

📸 스크린샷 (Optional)

Summary by CodeRabbit

수정 사항

  • 개선
    • 데이터베이스 환경 설정이 업데이트되었습니다.
    • 개발 및 테스트 환경의 데이터베이스 인프라 구성이 변경되었습니다.
    • 시스템 마이그레이션 설정이 새로운 환경과 호환되도록 조정되었습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@minSsan minSsan self-assigned this Jan 13, 2026
@minSsan minSsan added BE 백엔드 관련 이슈입니다. chore 의존성 관련 작업을 진행합니다. labels Jan 13, 2026
@github-actions github-actions bot changed the title chore: 로컬 및 테스트 환경 h2 -> mysql 변경 [BE][chore]: 로컬 / 테스트 환경 변경 Jan 13, 2026
@github-actions github-actions bot requested a review from 2Jin1031 January 13, 2026 11:37
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'tools'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

로컬 및 테스트 환경의 데이터소스 설정을 인메모리 H2에서 MySQL로 전환했습니다. 관련 설정으로는 JDBC URL을 jdbc:mysql://localhost:3306/mulkkam_db로 변경하고, MySQL 드라이버 클래스명을 추가했으며, Hibernate 방언을 MySQL8Dialect로 구성했습니다. H2 콘솔 설정을 제거하고 Flyway 마이그레이션 경로를 H2에서 MySQL로 변경했습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

리뷰 의견

변경 사항의 핵심은 개발 환경의 데이터베이스를 인메모리 H2에서 실제 MySQL로 전환하는 것인데, 몇 가지 점검이 필요합니다.

🔍 주요 지적 사항

1. 환경 의존성의 증가

이전 H2 설정의 가장 큰 장점은 별도 설치 없이 프로젝트 실행만으로 데이터베이스가 작동했다는 점입니다. 현재 변경으로는 모든 개발자가 로컬 MySQL 인스턴스를 구동하고 관리해야 하는데, 이는:

  • 개발 환경 설정 복잡도 증가
  • 새로운 팀원의 온보딩 비용 상승
  • CI/CD 파이프라인에서 테스트 실행 전 MySQL 준비 필요

2. 설정 중복과 유지보수성

application-local.ymlapplication.yml 모두에 거의 동일한 MySQL 설정이 존재합니다. 이는 향후 설정 변경 시 두 파일을 모두 수정해야 하므로 일관성 오류의 위험이 있습니다.

3. Flyway 마이그레이션 경로 변경의 안전성

  • classpath:db/migration/commonclasspath:db/migration/mysql 경로로 변경되었는데, 기존 H2 마이그레이션 파일이 실제로 이동/변환되었는지 확인이 필요합니다.
  • H2 특화 SQL 문법이 있었다면, MySQL 호환 버전이 정확히 작성되었는지 검증이 필수입니다.

4. 테스트 환경의 데이터 격리 전략 부재

H2는 각 테스트마다 메모리 초기화로 자동 격리가 가능했지만, MySQL 환경에서는:

  • 테스트 간 데이터 오염 방지를 위한 명시적 전략(예: @Transactional, 데이터 초기화 스크립트)이 필요한지 확인하세요.

💡 개선 제안

선택지 1: 다중 프로필 활용 (권장)

# application.yml (공통)
spring:
  jpa:
    hibernate:
      dialect: ${spring.jpa.hibernate.dialect}

---
# application-local.yml (H2 유지)
spring:
  datasource:
    url: jdbc:h2:mem:testdb
    driver-class-name: org.h2.Driver

---
# application-mysql.yml (MySQL 신규)
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/mulkkam_db

장점: 개발자는 여전히 H2를 선택 가능하고, MySQL을 원하는 개발자만 별도 프로필 사용
단점: 프로필 관리 복잡도 증가

선택지 2: Testcontainers 도입
MySQL을 Docker 컨테이너로 자동 실행하게 하면, H2의 편의성과 실제 MySQL 테스트의 이점을 모두 확보할 수 있습니다.

장점: 환경 의존성 제거, 진정한 통합 테스트 가능
단점: Docker 의존성 추가, 테스트 속도 약간 저하

현재 선택이 의도된 변경이라면, Flyway 마이그레이션 파일 변환 완료 여부와 테스트 데이터 격리 전략을 별도로 검증하시길 권장합니다.

🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive PR 설명이 기본 구조는 따르지만, 주요 변경사항 섹션(1, 2, 3)이 비어 있어 템플릿 요구사항을 완전히 충족하지 못합니다. 주요 변경사항 섹션을 구체적으로 작성해주세요. 예: 1. H2 → MySQL로 datasource 변경, 2. Flyway 마이그레이션 경로 업데이트, 3. Hibernate dialect 설정 추가 등으로 명확히 기록하면 좋습니다.
Linked Issues check ❓ Inconclusive 연결된 이슈 #1129가 구체적인 구현 요구사항 없이 템플릿만 남아있어, 코드 변경의 요구사항 준수 여부를 검증할 기준이 부족합니다. 이슈 #1129에서 구체적인 구현 배경과 상세 작업 내용을 명시해주거나, PR 설명에서 변경사항을 더 자세히 기록하여 의도와 범위를 명확히 해주세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed 제공된 정보 범위 내에서 두 설정 파일의 변경사항(H2 → MySQL 전환)은 제목과 설명의 의도에 부합하며 범위 내로 보입니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확히 반영하고 있습니다. 로컬 및 테스트 환경에서 H2에서 MySQL로의 전환이라는 주요 변경사항을 직관적으로 표현하고 있으며, 코드 리뷰 히스토리를 스캔할 때 변경의 의도가 명확합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot requested review from CheChe903 and Jin409 January 13, 2026 11:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
backend/src/main/resources/application-local.yml (2)

3-6: 로컬 환경 설정으로 적절하나, 연결 안정성 설정 고려가 필요합니다.

로컬 개발 환경에서 root/root 자격 증명 사용은 일반적이므로 괜찮습니다. 다만, MySQL 연결 시 다음 설정들을 추가하면 개발 중 연결 문제를 줄일 수 있습니다:

♻️ 연결 안정성을 위한 권장 설정
 spring:
   datasource:
-    url: jdbc:mysql://localhost:3306/mulkkam_db
+    url: jdbc:mysql://localhost:3306/mulkkam_db?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul
     username: root
     password: root
     driver-class-name: com.mysql.cj.jdbc.Driver
  • useSSL=false: 로컬 환경에서 SSL 인증서 오류 방지
  • allowPublicKeyRetrieval=true: caching_sha2_password 인증 관련 오류 방지
  • serverTimezone: 시간대 관련 경고 방지

12-14: MySQL8Dialect는 Hibernate 6.x에서 deprecated 되었으므로 대체해야 합니다.

프로젝트에서 Spring Boot 3.5.3을 사용하고 있어 Hibernate 6.x가 적용되어 있는데, org.hibernate.dialect.MySQL8Dialect는 더 이상 권장되지 않습니다. Hibernate 6부터는 버전 특화 dialect(MySQL5Dialect, MySQL8Dialect 등)에서 벗어나, Hibernate가 런타임에 JDBC 메타데이터로부터 데이터베이스 버전을 자동으로 감지하도록 설계가 변경되었기 때문입니다.

두 가지 개선 방안이 있습니다:

  1. dialect 설정 제거 (권장)
    현재 설정을 삭제하고 Hibernate의 자동 감지 기능에 맡기는 방식입니다.

    • 장점: 유지보수 부담 최소화, 향후 MySQL 버전 업그레이드 시 별도 수정 불필요
    • 단점: 명시적 제어가 부족할 수 있음
  2. MySQLDialect로 변경
    org.hibernate.dialect.MySQLDialect를 사용하되, 필요시 버전을 명시합니다.

    • 장점: 명시적이고 직관적
    • 단점: 향후 Hibernate 버전 변경 시 고려 필요

현재 프로젝트에서는 방안 1 (자동 감지)로 가는 것을 권장합니다.

backend/src/test/resources/application.yml (1)

28-30: MySQL8Dialect deprecation 이슈는 local 설정과 동일합니다.

application-local.yml에서 언급한 것과 같이, Hibernate 6.x에서는 MySQL8Dialect가 deprecated 되었습니다. 두 설정 파일 모두 동일하게 수정하는 것이 좋습니다.

♻️ 권장 변경사항
   jpa:
     hibernate:
       ddl-auto: none
     defer-datasource-initialization: false
-    properties:
-      hibernate:
-        dialect: org.hibernate.dialect.MySQL8Dialect
+    # Hibernate 6.x에서는 dialect 자동 감지 권장

또는 명시적으로 지정하려면:

    properties:
      hibernate:
        dialect: org.hibernate.dialect.MySQLDialect
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb9c6de and cd26025.

📒 Files selected for processing (2)
  • backend/src/main/resources/application-local.yml
  • backend/src/test/resources/application.yml
🧰 Additional context used
📓 Path-based instructions (1)
backend/**

⚙️ CodeRabbit configuration file

backend/**: - 1. 팀 및 공식 컨벤션, 가독성, 예외처리, 테스트/확장/유지보수성, 모듈화, API/DB/보안 설계 기준을 기반으로 리뷰해주세요.

    1. 최신 트렌드, 불필요한 로직, 클린코드, 리팩토링, 서비스/도메인 설계, 공통 예외 처리, 확장성도 함께 확인해주세요.
    1. 각 피드백은 문제점·대안·장단점을 짧고 논리적으로, 예시 코드가 있다면 간결히 포함해 주세요.
    1. 팀 내 스타일 통일성도 확인해주세요.
    1. 미작성한 테스트 코드 케이스가 있다면, 어떤 테스트가 필요한지 제안해주세요. (예: 컨트롤러는 인수 테스트, 나머지는 단위 테스트)
    1. 리뷰 남겨주는 부분은 해당 라인 범위의 코멘트에 작성해주세요.

Files:

  • backend/src/test/resources/application.yml
  • backend/src/main/resources/application-local.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (1)
backend/src/test/resources/application.yml (1)

17-22: baseline-on-migrate 설정이 local 환경과 다릅니다.

  • application-local.yml: baseline-on-migrate: true
  • application.yml (test): baseline-on-migrate: false

이 차이가 의도된 것인지 확인이 필요합니다.

설정값 의미 적합한 상황
true 기존 스키마가 있어도 baseline 생성 후 마이그레이션 진행 기존 DB에 Flyway 적용 시
false 빈 DB에서 시작해야 함, 기존 스키마 있으면 실패 깨끗한 테스트 환경

테스트 환경에서 false로 설정하면 매번 깨끗한 상태에서 시작해야 하므로, 테스트 전 DB를 초기화하는 로직이 필요할 수 있습니다. 의도된 설정이라면 괜찮지만, 일관성을 위해 재확인해 주세요.

Comment on lines +10 to +13
url: jdbc:mysql://localhost:3306/mulkkam_db
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Find CI/CD workflow files
fd -e yml -e yaml . .github/workflows 2>/dev/null || echo "No .github/workflows found"

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 472


🏁 Script executed:

# Check for build configuration files (Maven or Gradle)
fd -e "pom.xml" -e "build.gradle" -e "build.gradle.kts" . | head -20

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 57


🏁 Script executed:

# Check if Testcontainers is already a dependency
find . -name "pom.xml" -o -name "build.gradle" -o -name "build.gradle.kts" | xargs grep -l "testcontainers" 2>/dev/null || echo "Testcontainers not found in build files"

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 114


🏁 Script executed:

# Look for test configuration files and profiles
fd -e "application-test.yml" -e "application-test.yaml" .

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 57


🏁 Script executed:

# Check the actual application.yml file context (more lines for context)
cat -n backend/src/test/resources/application.yml | head -35

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 1009


🏁 Script executed:

# Check backend CI workflow for MySQL service configuration
cat .github/workflows/backend-dev-ci.yml

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 3870


🏁 Script executed:

# Find and examine pom.xml for test dependencies and build config
fd pom.xml | head -1 | xargs cat | head -100

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 57


🏁 Script executed:

# Check for CI profile configuration file
find backend/src -name "application-ci.yml" -o -name "application-ci.yaml"

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 120


🏁 Script executed:

# Check all application-*.yml files to understand profile structure
find backend/src -name "application-*.yml" -o -name "application-*.yaml" | sort

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 264


🏁 Script executed:

# Verify the actual gradle or maven test command and profile setup
fd -e "gradle.properties" -e "settings.gradle" . backend/ | xargs cat 2>/dev/null | head -50

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 57


🏁 Script executed:

# Check the CI profile configuration
cat -n backend/src/test/resources/application-ci.yml

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 1175


🏁 Script executed:

# Also check if there's a mapping between SPRING_PROFILES_ACTIVE=ci and the file
# Look at how profiles are configured
grep -r "spring.profiles.active" backend/src/test/resources/ || echo "No explicit profile config found"

Repository: woowacourse-teams/2025-mul-kkam

Length of output: 107


로컬 개발 환경에서 MySQL 의존성으로 인한 개발자 온보딩 마찰을 개선해 보세요.

현재 설정에서는 개발자가 로컬에서 테스트를 실행하려면 MySQL 컨테이너가 반드시 실행되어 있어야 합니다. CI/CD 파이프라인은 application-ci.yml 프로필을 통해 이미 적절히 설정되어 있지만, 로컬 개발 환경의 경험을 개선할 수 있습니다.

현황:

  • CI/CD: backend-dev-ci.yml에서 MySQL 서비스가 이미 올바르게 구성됨 (database: test_db, password: password)
  • 로컬 개발: application.yml의 하드코딩된 자격증명(root/root, database: mulkkam_db)을 사용하려면 로컬 MySQL 필요

개선 방안:

  1. Testcontainers 도입 (권장)

    • 장점: 개발자가 수동으로 MySQL 설정할 필요 없음, 완전한 테스트 격리, 모든 개발자 환경에서 동일하게 동작
    • 단점: 테스트 실행 시간 증가 (컨테이너 시작 오버헤드)
    • 구현: build.gradletestImplementation("org.testcontainers:mysql")와 같은 의존성 추가, 테스트 설정 업데이트
  2. 현재 방식 유지 + 온보딩 가이드 추가

    • 장점: 설정 간단, 테스트 실행 빠름
    • 단점: 개발자가 Docker/MySQL 수동 설정 필수, 환경 편차 가능성

application.yml의 localhost 의존성을 완화하면 새 개발자의 세팅 시간을 단축하고 개발 경험을 높일 수 있습니다.

Copy link
Contributor

@CheChe903 CheChe903 left a comment

Choose a reason for hiding this comment

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

어푸~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BE 백엔드 관련 이슈입니다. chore 의존성 관련 작업을 진행합니다.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants