Simplify Razor deployment health checks
TaxBaik CI/CD / build-and-deploy (push) Failing after 3m18s

This commit is contained in:
2026-07-09 12:22:15 +09:00
parent b861af1273
commit 8a250f6369
+7 -9
View File
@@ -107,7 +107,6 @@ cd "$DEPLOY_DIR"
export ASPNETCORE_ENVIRONMENT=Production
export ASPNETCORE_URLS="http://127.0.0.1:$TARGET_PORT"
export ConnectionStrings__Default="Host=localhost;Database=taxbaikdb;Username=taxbaik;Password=taxbaik123"
export ApiClient__BaseUrl="http://127.0.0.1:$TARGET_PORT/api/"
export DOTNET_PRINT_TELEMETRY_MESSAGE=false
# Run dotnet process
@@ -121,30 +120,29 @@ if ! ps -p $NEW_PID > /dev/null; then
exit 1
fi
# 5. Enhanced Health Check Loop (다중 엔드포인트 검증)
# 5. Enhanced Health Check Loop (Razor Pages 기준 검증)
echo "=== Enhanced Health Checking Port $TARGET_PORT ==="
ATTEMPTS=20
SUCCESS=false
API_PORT=$TARGET_PORT
for i in $(seq 1 $ATTEMPTS); do
# 기본 헬스 체크
HEALTH_STATUS=$(curl -sf -o /dev/null -w '%{http_code}' "http://127.0.0.1:${TARGET_PORT}/healthz" 2>/dev/null || echo "000")
# API 엔드포인트 검증 (GET /api/blog - 데이터베이스 연결 확인)
API_STATUS=$(curl -sf -o /dev/null -w '%{http_code}' "http://127.0.0.1:${TARGET_PORT}/api/blog?limit=1" 2>/dev/null || echo "000")
# 관리자 로그인 페이지 검증 (Cookie Auth + Razor Pages 기준)
LOGIN_STATUS=$(curl -sf -o /dev/null -w '%{http_code}' "http://127.0.0.1:${TARGET_PORT}/admin/login" 2>/dev/null || echo "000")
if [ "$HEALTH_STATUS" = "200" ] && [ "$API_STATUS" = "200" ]; then
if [ "$HEALTH_STATUS" = "200" ] && [ "$LOGIN_STATUS" = "200" ]; then
echo "✓ All health checks passed on port $TARGET_PORT (Attempt $i/$ATTEMPTS)"
echo " ✓ /healthz: $HEALTH_STATUS"
echo " ✓ /api/blog: $API_STATUS"
echo " ✓ /admin/login: $LOGIN_STATUS"
SUCCESS=true
break
fi
if [ $i -eq 1 ] || [ $((i % 5)) -eq 0 ]; then
echo " Waiting for health check... ($i/$ATTEMPTS)"
echo " /healthz: $HEALTH_STATUS | /api/blog: $API_STATUS"
echo " /healthz: $HEALTH_STATUS | /admin/login: $LOGIN_STATUS"
fi
sleep 2
@@ -152,7 +150,7 @@ done
if [ "$SUCCESS" = "false" ]; then
echo "❌ Enhanced health check failed on port $TARGET_PORT"
echo " /healthz: $HEALTH_STATUS | /api/blog: $API_STATUS"
echo " /healthz: $HEALTH_STATUS | /admin/login: $LOGIN_STATUS"
echo ""
echo "Log output (last 30 lines):"
tail -30 "web_${TARGET_PORT}.log" 2>/dev/null || echo "No log file"