Commit Graph

10 Commits

Author SHA1 Message Date
Ho Ngoc Hai
310ff7bb3e ci(deploy): wire Playwright smoke suite into deploy pipeline
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 4s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 20s
Deploy / Build API Image (push) Failing after 13s
Deploy / Build Web Image (push) Failing after 12s
Deploy / Build AI Services Image (push) Failing after 13s
E2E Tests / Playwright E2E (push) Failing after 9s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Security Scanning / Trivy Scan — API Image (push) Failing after 2m18s
Security Scanning / Trivy Scan — Web Image (push) Failing after 59s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 1m2s
Security Scanning / Trivy Filesystem Scan (push) Failing after 57s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 10m52s
Security Scanning / Security Gate (push) Has been cancelled
Staging and production smoke-test jobs now run both the existing bash
smoke-test.sh (fast endpoint checks) and the new Playwright @smoke projects
(smoke-api + smoke-web) against live deployed URLs. Failure blocks the
rollback trigger just as before.

Required secrets: STAGING_API_URL, PRODUCTION_API_URL (added alongside the
existing STAGING_URL / PRODUCTION_URL).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-21 00:53:33 +07:00
Ho Ngoc Hai
e78d706b42 chore: update infrastructure configs, audit docs, and env template
- Update Docker Compose configs for Redis, Typesense, and MinIO services
- Update GitHub Actions deploy workflow with improved caching and steps
- Extend .env.example with Stringee, Zalo OA, and FCM config keys
- Update audit documentation with latest findings and recommendations
- Update CHANGELOG and README with recent feature additions

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-16 05:17:38 +07:00
Ho Ngoc Hai
20b79acf08 fix(deploy): tag rollback images before pull, prune after smoke test
Previously, `docker image prune` ran immediately after deploying new
containers, potentially deleting the old images needed for rollback
if smoke tests subsequently failed. Now the deploy pipeline:

1. Tags current images as :rollback before pulling new versions
2. Only runs `docker image prune` after smoke tests pass
3. Uses explicit :rollback tags for rollback instead of relying on
   Docker layer cache (which is fragile)

Applied to:
- scripts/deploy-production.sh (manual deploy script)
- .github/workflows/deploy.yml (staging + production CI jobs)
- docs/deployment.md (updated rollback documentation)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-15 11:17:32 +07:00
Ho Ngoc Hai
e5f7acf7da feat: production infra — nginx configs, deploy script, security hardening
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 58s
Deploy / Build Web Image (push) Failing after 14s
Deploy / Rollback Production (push) Has been skipped
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 3m8s
Deploy / Build AI Services Image (push) Failing after 10s
E2E Tests / Playwright E2E (push) Failing after 1m21s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
- Add Nginx reverse-proxy configs for api.goodgo.vn and platform.goodgo.vn
  with SSL, gzip, rate limiting, security headers, and WebSocket support
- Add Cloudflare DNS setup script for A/AAAA/CNAME records
- Add server-setup.sh for Ubuntu provisioning (Docker, fail2ban, UFW,
  swap, unattended-upgrades)
- Add deploy-production.sh for manual production deployments
- Add env.production.example with all required environment variables
- Bind container ports to 127.0.0.1 in docker-compose.prod.yml
  (security: prevent direct access bypassing Nginx)
- Fix deploy workflow: add -T flag to exec, sync Nginx configs,
  copy pgbouncer and backup configs to server

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-13 14:11:25 +07:00
Ho Ngoc Hai
64c6074735 feat(devops): add staging auto-deploy pipeline on develop branch
- Trigger deploy workflow on push to `develop` branch (in addition to `master`)
- Add `staging-latest` Docker image tag for develop branch builds
- Add `rollback-staging` job: auto-reverts to previous images on smoke test failure
- Add Slack success notification for staging deploys (previously only failure was notified)
- Record pre-deploy image digests for rollback capability
- Update deployment docs with CI/CD pipeline details, rollback procedures, and required secrets

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-11 01:18:37 +07:00
Ho Ngoc Hai
2a8799ac5b fix(ci): correct workflow branch targets from main to master
All three GitHub Actions workflows (CI, E2E, Deploy) referenced
branches: [main] but the repository default branch is master.
This meant CI never triggered on pushes or PRs to master.

- ci.yml: push/PR triggers → master
- e2e.yml: push/PR triggers → master
- deploy.yml: push trigger + latest tag condition → master

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-10 19:20:49 +07:00
Ho Ngoc Hai
e6d38c796f feat(ci): add post-deploy smoke test pipeline stage
- Add scripts/smoke-test.sh — hits health, readiness, and critical API
  endpoints (listings, search, subscriptions) post-deploy
- Add smoke-test-staging job that runs after staging deploy with Slack
  notification on failure
- Add smoke-test-production job that runs after production deploy with
  success notification
- Add rollback-production job triggered on smoke test failure — reverts
  to previous container images and notifies via Slack

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-09 09:09:09 +07:00
Ho Ngoc Hai
c00ac88f26 fix(deploy): allow variable expansion in deploy scripts and add web health route
Fix heredoc quoting in deploy workflow to allow IMAGE_TAG and
REGISTRY_URL variable expansion. Add Next.js API health check route.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-08 23:07:45 +07:00
Ho Ngoc Hai
7c9f682046 feat(deploy): add production Dockerfiles and CI/CD pipeline
- Multi-stage Dockerfile for apps/api (NestJS) and apps/web (Next.js standalone)
- Production docker-compose.prod.yml with all services, health checks, and security
- Real deploy.yml pipeline: build → push to GHCR → deploy staging/production
- .dockerignore for optimized build context
- Enable Next.js standalone output mode

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-08 04:03:27 +07:00
Ho Ngoc Hai
19dd59e4eb ci: add GitHub Actions CI/CD pipelines
- Add ci.yml with lint, typecheck, test, build steps + PostgreSQL service
- Add deploy.yml scaffold with Docker build placeholders

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-08 02:04:24 +07:00