Skip to content

Conversation

@jsoonworld
Copy link
Member

📄 Work Description

문제점

GitHub Actions를 통한 자동 배포 시, 컨테이너는 실행되지만 내부 애플리케이션이 메모리 부족으로 즉시 종료되어 헬스 체크에 지속적으로 실패했습니다.

해결 방안

JAVA_OPTS 추가: 수동 실행 시에만 존재했던 Java 메모리 설정 (-e JAVA_OPTS='-Xms256m -Xmx512m')을 docker run 명령어에 추가하여, 컨테이너가 안정적으로 실행되도록 수정했습니다.

헬스 체크 대기 시간 증가: 애플리케이션이 완전히 구동될 시간을 확보하기 위해, 헬스 체크 전 대기 시간을 sleep 10에서 sleep 30으로 늘려 불필요한 실패를 방지했습니다.

스크립트 안정성 강화: set -e 옵션, 안정적인 포트 확인 로직 등 이전의 개선 사항을 모두 유지하여 배포 파이프라인의 안정성을 높였습니다.

@jsoonworld jsoonworld requested a review from Copilot July 3, 2025 04:27
@jsoonworld jsoonworld self-assigned this Jul 3, 2025
@jsoonworld jsoonworld added 🔨 fix 버그, 오류 수정 🦊장순🦊 labels Jul 3, 2025
Copy link

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 enhances the staging deployment workflow by ensuring adequate JVM memory settings and allowing the application more startup time before health checks.

  • Inject JAVA_OPTS into the docker run command to prevent OOM exits.
  • Increase the initial sleep delay from 10 to 30 seconds before running health checks.
Comments suppressed due to low confidence (1)

.github/workflows/DOCKER-CD-STAGING.yml:102

  • [nitpick] Consider extracting the JVM memory options into a reusable workflow variable or matrix parameter to make tuning and reuse across environments easier.
              -e JAVA_OPTS='-Xms256m -Xmx512m' \

echo "### 4. 헬스 체크를 시작합니다."
sleep 10
sleep 30
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

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

[nitpick] Rather than a fixed 30-second sleep, consider implementing a configurable backoff loop or shorter interval retries to start health checks sooner when possible.

Suggested change
sleep 30
for wait_time in {1..6}; do
echo " > [${wait_time}/6] 초기화 상태 체크 중..."
response=$(curl -s http://localhost:${NEW_PORT}/actuator/health || true)
up_count=$(echo "$response" | grep -c '"status":"UP"')
if [ $up_count -ge 1 ]; then
echo " > ✅ 초기화 완료. 헬스 체크를 시작합니다."
break
fi
if [ $wait_time -eq 6 ]; then
echo " > ❌ 초기화 실패. 배포를 중단하고 새 컨테이너를 종료합니다."
docker rm -f ${NEW_CONTAINER_NAME}
exit 1
fi
sleep 5
done

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

좋은 제안 감사합니다!

확실히 고정된 sleep 시간으로 기다리는 것보다, 더 짧은 주기로 여러 번 상태를 체크해서 애플리케이션이 준비되는 즉시 다음 단계로 넘어가는 것이 훨씬 효율적이고 안정적인 방법이네요. 평균 배포 속도도 개선될 것 같습니다.

제안해주신 코드로 수정하여 반영하겠습니다. 리뷰 감사합니다!

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Jul 3, 2025
@jsoonworld jsoonworld merged commit 7078039 into develop Jul 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants