refactor: docker-compose.dev.yml에 mysql 컨테이너 추가#690
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough1. MySQL 이미지 기반 서비스 추가 — 개발용 Docker Compose에 Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docker-compose.dev.yml (1)
17-26: 레이스 컨디션 방지를 위해 헬스체크와 조건부 의존성 추가를 권장합니다.MySQL이 완전히 준비되기 전에 앱이 시작되는 것을 방지하려면 다음과 같이 설정하세요:
MySQL 서비스에 헬스체크 추가
mysqladmin ping명령으로 TCP 연결 여부를 주기적으로 확인합니다.start_period: 30s로 초기 부팅 시간을 충분히 확보합니다 (MySQL 초기화 완료 대기).앱 서비스에 조건부 의존성 설정
depends_on에서condition: service_healthy를 사용하면, MySQL 헬스체크가 성공할 때까지만 앱 컨테이너를 시작합니다.제안 diff
services: solid-connection-dev: image: ghcr.io/${OWNER_LOWERCASE}/solid-connection-dev:${IMAGE_TAG:-latest} container_name: solid-connection-dev network_mode: "host" + depends_on: + mysql: + condition: service_healthy environment: - SPRING_PROFILES_ACTIVE=dev - AWS_REGION=ap-northeast-2 @@ mysql: image: mysql:8.0 container_name: solid-connection-dev-mysql environment: MYSQL_DATABASE: solid_connection ports: - "3306:3306" volumes: - ./mysql_data_dev:/var/lib/mysql + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--protocol=TCP", "--silent"] + interval: 10s + timeout: 5s + retries: 10 + start_period: 30s restart: always참고: Docker Compose v2는 Compose Specification을 따르므로, compose file 버전 3.8에서도
condition: service_healthy문법을 완벽하게 지원합니다. 재배포 시 안정성을 크게 높일 수 있습니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docker-compose.dev.yml` around lines 17 - 26, Add a healthcheck to the mysql service using a mysqladmin ping command with a generous start_period (e.g., start_period: 30s) and appropriate interval/retries so Compose can mark mysql healthy only after it’s ready, and update your application service’s depends_on to use condition: service_healthy referencing the mysql service (i.e., add depends_on: mysql: condition: service_healthy in your app service) so the app container waits for the mysql service healthcheck to succeed before starting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docker-compose.dev.yml`:
- Around line 22-23: The MySQL port mapping in the docker-compose service
currently exposes 0.0.0.0 via the ports entry ("3306:3306"); change the ports
mapping for the MySQL service to bind to loopback (e.g., "127.0.0.1:3306:3306")
so the container only listens on localhost. Locate the MySQL service's ports
stanza (the line containing "3306:3306") and replace that mapping with a
loopback-bound mapping, then restart the compose stack to apply the change.
- Around line 20-21: The docker-compose service's environment block currently
only sets MYSQL_DATABASE and is missing the required root password variables;
update the environment for the MySQL service by adding one of the required vars
(preferably MYSQL_ROOT_PASSWORD with a secure value), or for dev-only
alternatives add MYSQL_RANDOM_ROOT_PASSWORD: 'yes' or
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' to satisfy the mysql:8.0 initializer; ensure
the change is placed in the same environment section alongside MYSQL_DATABASE so
the container can initialize correctly.
---
Nitpick comments:
In `@docker-compose.dev.yml`:
- Around line 17-26: Add a healthcheck to the mysql service using a mysqladmin
ping command with a generous start_period (e.g., start_period: 30s) and
appropriate interval/retries so Compose can mark mysql healthy only after it’s
ready, and update your application service’s depends_on to use condition:
service_healthy referencing the mysql service (i.e., add depends_on: mysql:
condition: service_healthy in your app service) so the app container waits for
the mysql service healthcheck to succeed before starting.
관련 이슈
작업 내용
특이 사항
리뷰 요구사항 (선택)