From c1cbecf5aa2f9f41f765f07f997de067ac058072 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 18 Mar 2026 15:47:05 +0700 Subject: [PATCH] 260318:1547 Fix UUID #09 --- .gitea/workflows/deploy.yaml | 18 ++++++++++++------ backend/Dockerfile | 2 +- .../controllers/health.controller.ts | 5 +++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 0c21919..89e3a72 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -54,17 +54,23 @@ jobs: echo "ðŸŸĒ Starting Backend..." docker compose -f docker-compose-app.yml up -d backend - # 4b. āļĢāļ­ Backend healthy (āļ—āļļāļ 5 āļ§āļī āļŠāļđāļ‡āļŠāļļāļ” 60 āļ§āļī) + # 4b. āļĢāļ­ Backend healthy (āļ—āļļāļ 30 āļ§āļī āļŠāļđāļ‡āļŠāļļāļ” 180 āļ§āļī) echo "âģ Waiting for Backend health check..." - for i in $(seq 1 12); do - if docker inspect --format='{{.State.Health.Status}}' backend 2>/dev/null | grep -q healthy; then + for i in $(seq 1 6); do + echo "🔍 Health check attempt $i/6..." + health=$(docker inspect --format='{{.State.Health.Status}}' backend 2>/dev/null || echo "starting") + echo "📊 Health status: $health" + if [ "$health" = "healthy" ]; then echo "✅ Backend is healthy!" break fi - if [ "$i" = "12" ]; then - echo "⚠ïļ Backend health check timeout - starting frontend anyway" + if [ "$i" = "6" ]; then + echo "⚠ïļ Backend health check timeout after 180s - checking logs" + echo "📋 Backend logs (last 20 lines):" + docker logs --tail 20 backend + echo "🔧 Starting frontend anyway (backend may still be starting)" fi - sleep 5 + sleep 30 done # 4c. Start Frontend diff --git a/backend/Dockerfile b/backend/Dockerfile index 0157624..bd107cb 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -77,6 +77,6 @@ USER nestjs EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=30s \ - CMD curl -f http://localhost:3000/health || exit 1 + CMD curl -f http://localhost:3000/ping || exit 1 CMD ["node", "dist/main"] diff --git a/backend/src/modules/monitoring/controllers/health.controller.ts b/backend/src/modules/monitoring/controllers/health.controller.ts index 58513be..af1b656 100644 --- a/backend/src/modules/monitoring/controllers/health.controller.ts +++ b/backend/src/modules/monitoring/controllers/health.controller.ts @@ -19,6 +19,11 @@ export class HealthController { private disk: DiskHealthIndicator ) {} + @Get('ping') + ping() { + return { status: 'ok', timestamp: new Date().toISOString() }; + } + @Get('health') @HealthCheck() check() {