Docker Health Check #459
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Health Check | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| health-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Checkout Config Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: UruruLab/Ururu-AI-Config | |
| path: config | |
| token: ${{ secrets.GHCR_TOKEN }} | |
| - name: Copy Config Files to Docker Context | |
| run: | | |
| # Docker 디렉토리 내에 config 폴더 생성 | |
| mkdir -p ./docker/config | |
| # config repository의 .env 파일들을 docker/config에 복사 | |
| if compgen -G "config/.env*" > /dev/null; then | |
| cp config/.env* ./docker/config/ | |
| echo "✅ Config files copied to docker/config/ successfully" | |
| # 복사된 파일 확인 | |
| echo "📁 Copied files:" | |
| ls -la ./docker/config/ | |
| else | |
| echo "❌ Config files not found in config repository" | |
| exit 1 | |
| fi | |
| - name: Verify Environment Files | |
| run: | | |
| echo "📁 Checking Docker context config files" | |
| ls -la ./docker/config/ | |
| if [ -f "./docker/config/.env.production" ]; then | |
| echo "✅ .env.production file exists in docker context" | |
| else | |
| echo "❌ .env.production file missing in docker context" | |
| exit 1 | |
| fi | |
| - name: Validate Docker Compose Configuration | |
| run: | | |
| echo "✅ Validating main Docker Compose file syntax" | |
| cd docker && docker compose -f docker-compose-ai.yml config --quiet | |
| echo "✅ Docker Compose validation completed" | |
| env: | |
| GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| ENVIRONMENT: production | |
| - name: Verify Environment Variable Bindings | |
| run: | | |
| echo "🔍 Verifying environment variable bindings" | |
| cd docker | |
| echo "Production environment configuration check:" | |
| ENVIRONMENT=production GHCR_TOKEN=${{ secrets.GHCR_TOKEN }} \ | |
| docker compose config \ | |
| | grep -A 10 "environment:" \ | |
| | grep "^[[:space:]]*[[:alpha:]]" \ | |
| | sed 's/=.*/=<redacted>/' \ | |
| | head -10 | |
| env: | |
| GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| - name: Simulate Health Check | |
| run: | | |
| echo "🔍 AI Service Health Check Simulation" | |
| echo "- Target: http://localhost:8000/health" | |
| echo "- Expected Response: {\"status\": \"healthy\", \"service\": \"ururu-ai-recommendation\"}" | |
| echo "🔍 Spring Backend Connection Test Simulation" | |
| echo "- VPC Target: http://10.0.5.114:8000/health (FastAPI EC2)" | |
| echo "- Actual connection only available in VPC environment" | |
| - name: Check Configuration Completeness | |
| run: | | |
| echo "📦 Checking configuration completeness" | |
| echo "- Docker Compose files: ✅" | |
| echo "- Environment files: ✅" | |
| echo "- Config repository integration: ✅" | |
| # 환경별 필수 변수 체크 | |
| echo "🔍 Checking required environment variables" | |
| cd docker | |
| if grep -q "SPRING_BOOT_BASE_URL" config/.env.production; then | |
| echo "✅ SPRING_BOOT_BASE_URL configured" | |
| else | |
| echo "⚠️ SPRING_BOOT_BASE_URL not found in production config" | |
| fi | |
| - name: Generate Health Check Report | |
| run: | | |
| echo "📊 Health Check Completion Report" | |
| echo "✅ Docker Compose configuration files validated" | |
| echo "✅ Config repository integration working" | |
| echo "✅ Environment-specific configuration files verified" | |
| echo "✅ Workflow configuration validated" | |
| echo "✅ File path mapping corrected" | |
| echo "⚠️ Actual service status needs verification on EC2" | |
| echo "" | |
| echo "🔧 Next steps for deployment:" | |
| echo "1. Ensure FastAPI EC2 (10.0.5.114) is running" | |
| echo "2. Test VPC internal communication" | |
| echo "3. Run: git push origin main to trigger CI/CD" | |
| echo "4. Monitor deployment: docker compose ps && docker compose logs" |