Skip to content

Commit 914fdaa

Browse files
committed
fix: Docker 헬스체크 워크플로우 토큰 및 경로 수정
1 parent cf50c42 commit 914fdaa

File tree

1 file changed

+60
-26
lines changed

1 file changed

+60
-26
lines changed

.github/workflows/docker-health-check.yml

Lines changed: 60 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ on:
55
- cron: '0 */6 * * *'
66
workflow_dispatch:
77
push:
8-
branches:
8+
branches:
99
- main
1010
- 'fix/*'
1111
pull_request:
12-
branches:
12+
branches:
1313
- main
1414
- 'fix/*'
1515

@@ -26,33 +26,42 @@ jobs:
2626
with:
2727
repository: UruruLab/Ururu-AI-Config
2828
path: config
29-
token: ${{ secrets.PRIVATE_REPO_TOKEN }}
29+
token: ${{ secrets.GHCR_TOKEN }}
3030

31-
- name: Copy Config Files (.env files)
31+
- name: Copy Config Files to Docker Context
3232
run: |
33-
mkdir -p ./
33+
# Docker 디렉토리 내에 config 폴더 생성
34+
mkdir -p ./docker/config
35+
36+
# config repository의 .env 파일들을 docker/config에 복사
3437
if compgen -G "config/.env*" > /dev/null; then
35-
cp config/.env* ./
36-
echo "✅ Config files copied successfully"
38+
cp config/.env* ./docker/config/
39+
echo "✅ Config files copied to docker/config/ successfully"
40+
41+
# 복사된 파일 확인
42+
echo "📁 Copied files:"
43+
ls -la ./docker/config/
3744
else
3845
echo "❌ Config files not found in config repository"
3946
exit 1
4047
fi
4148
4249
- name: Verify Environment Files
4350
run: |
44-
echo "📁 Checking copied environment files"
45-
ls -la .env*
46-
if [ -f ".env.development" ]; then
47-
echo "✅ .env.development file exists"
51+
echo "📁 Checking Docker context config files"
52+
ls -la ./docker/config/
53+
54+
if [ -f "./docker/config/.env.development" ]; then
55+
echo "✅ .env.development file exists in docker context"
4856
else
49-
echo "❌ .env.development file missing"
57+
echo "❌ .env.development file missing in docker context"
5058
exit 1
5159
fi
52-
if [ -f ".env.production" ]; then
53-
echo "✅ .env.production file exists"
60+
61+
if [ -f "./docker/config/.env.production" ]; then
62+
echo "✅ .env.production file exists in docker context"
5463
else
55-
echo "❌ .env.production file missing"
64+
echo "❌ .env.production file missing in docker context"
5665
exit 1
5766
fi
5867
@@ -61,14 +70,23 @@ jobs:
6170
echo "✅ Validating main Docker Compose file syntax"
6271
cd docker && docker compose config --quiet
6372
echo "✅ Docker Compose validation completed"
73+
env:
74+
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
75+
ENVIRONMENT: production
6476

6577
- name: Verify Environment Variable Bindings
6678
run: |
6779
echo "🔍 Verifying environment variable bindings"
68-
echo "Production environment validation:"
69-
cd docker && ENVIRONMENT=production docker compose config \
80+
cd docker
81+
echo "Production environment configuration check:"
82+
ENVIRONMENT=production GHCR_TOKEN=${{ secrets.GHCR_TOKEN }} \
83+
docker compose config \
7084
| grep -A 10 "environment:" \
71-
| head -10 || echo "Environment validation completed"
85+
| grep "^[[:space:]]*[[:alpha:]]" \
86+
| sed 's/=.*/=<redacted>/' \
87+
| head -10
88+
env:
89+
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
7290

7391
- name: Simulate Health Check
7492
run: |
@@ -77,14 +95,24 @@ jobs:
7795
echo "- Expected Response: {\"status\": \"healthy\", \"service\": \"ururu-ai-recommendation\"}"
7896
7997
echo "🔍 Spring Backend Connection Test Simulation"
80-
echo "- Target: http://localhost:8080/health"
81-
echo "- Actual connection only available in EC2 environment"
98+
echo "- VPC Target: http://10.0.5.114:8000/health (FastAPI EC2)"
99+
echo "- Actual connection only available in VPC environment"
82100
83-
- name: Check GitHub Container Registry Images
101+
- name: Check Configuration Completeness
84102
run: |
85-
echo "📦 Checking latest Docker images"
86-
echo "- Registry: ghcr.io/${{ github.repository }}"
87-
echo "- Latest tags: latest, main, develop"
103+
echo "📦 Checking configuration completeness"
104+
echo "- Docker Compose files: ✅"
105+
echo "- Environment files: ✅"
106+
echo "- Config repository integration: ✅"
107+
108+
# 환경별 필수 변수 체크
109+
echo "🔍 Checking required environment variables"
110+
cd docker
111+
if grep -q "SPRING_BOOT_BASE_URL" config/.env.production; then
112+
echo "✅ SPRING_BOOT_BASE_URL configured"
113+
else
114+
echo "⚠️ SPRING_BOOT_BASE_URL not found in production config"
115+
fi
88116
89117
- name: Generate Health Check Report
90118
run: |
@@ -93,5 +121,11 @@ jobs:
93121
echo "✅ Config repository integration working"
94122
echo "✅ Environment-specific configuration files verified"
95123
echo "✅ Workflow configuration validated"
96-
echo "️ Actual service status needs separate verification on EC2"
97-
echo "Run on EC2: docker compose ps && docker compose logs"
124+
echo "✅ File path mapping corrected"
125+
echo "⚠️ Actual service status needs verification on EC2"
126+
echo ""
127+
echo "🔧 Next steps for deployment:"
128+
echo "1. Ensure FastAPI EC2 (10.0.5.114) is running"
129+
echo "2. Test VPC internal communication"
130+
echo "3. Run: git push origin main to trigger CI/CD"
131+
echo "4. Monitor deployment: docker compose ps && docker compose logs"

0 commit comments

Comments
 (0)