Overall Status
MANUAL CHECK
ใช้หน้านี้เป็น runbook ก่อนต่อ live CI API. ทุก stage ต้องมีหลักฐานคำสั่งหรือ log ก่อน deploy.
Environment
Local: http://localhost/pipeline/
Production: https://sandbox.mangoconsultant.com/pipeline/
Release Contract
Deploy ได้เมื่อ npm audit = 0, Trivy filesystem scan ผ่าน, SonarQube gate ผ่าน, Docker image scan ไม่มี high/critical ที่แก้ได้ และ smoke route ได้ 200.
Pipeline Stages
1. Source Ready
ตรวจ
LOCAL
git status, branch, commit, และไม่ให้มี secret/runtime artifact หลุดเข้า repo.
2. Dependency CVE
รัน
REQUIRED
npm audit --audit-level=moderate ใน Next.js ทุก service. Gate ต้องไม่เหลือ moderate/high/critical.
3. SonarQube
รัน scanner ด้วย
REQUIRED
sonar-project.properties. CI ต้อง fail ถ้า Quality Gate ไม่ผ่าน.
4. Image Scan
scan final Docker image ด้วย Trivy หรือ Docker Scout ไม่ใช่แค่ base image.
MANUAL/CI
5. Compose + nginx
ตรวจ
REQUIRED
docker compose config, build image, start container และ nginx -t.
6. Smoke Routes
ตรวจ
REQUIRED
/, /projects/demo1/, /projects/demo1-ms/, /handbook.html, /pipeline/.
7. Rollback Ready
ต้องรู้ commit ก่อนหน้า, image ก่อนหน้า, และคำสั่ง rollback ก่อนกด deploy production.
REQUIRED
Service Health Matrix
| Service | Route / Port | Expected | Owner |
|---|---|---|---|
| reverse-proxy | /, 80/443 | nginx running, portal served | Infra |
| foreman-assignment-app | /projects/demo1/, 3100 | Next.js app opens with base path assets | FE |
| demo1-web | /projects/demo1-ms/, 3000 | BFF forwards to Go/AI services | FE/BFF |
| demo1-go-api | internal 8080 | worker, assignment, audit APIs healthy | BE |
| demo1-ai-api | internal 8000 | AI suggestion/capture APIs healthy | AI |
| sonarqube | localhost:9000 | quality gate available under compose profile | QA/DevOps |
Copyable Local Gate
cd /Users/phatcharaphoninsee/Documents/reverse-proxy-project
./scripts/quality-gate.sh
cd services
docker compose -f docker-compose.local.yml --profile quality up -d sonarqube sonar-postgres
docker run --rm \
-v "$PWD/..:/usr/src" \
sonarsource/sonar-scanner-cli \
-Dsonar.host.url=http://host.docker.internal:9000 \
-Dsonar.token="$SONAR_TOKEN"
Production Smoke Test
curl -sL -o /dev/null -w '%{http_code} %{url_effective}\n' https://sandbox.mangoconsultant.com/
curl -sL -o /dev/null -w '%{http_code} %{url_effective}\n' https://sandbox.mangoconsultant.com/projects/demo1/
curl -sL -o /dev/null -w '%{http_code} %{url_effective}\n' https://sandbox.mangoconsultant.com/projects/demo1-ms/
curl -sL -o /dev/null -w '%{http_code} %{url_effective}\n' https://sandbox.mangoconsultant.com/pipeline/