Tampilan
Deployment & CI/CD
Topologi deployment
Deployment berbasis VPS (bukan container), di-orkestrasi GitHub Actions via SSH.
GitHub Actions
| Workflow | Trigger | Target | Path |
|---|---|---|---|
production.yml | push ke master | /var/www/transaksional-email-be | .github/workflows/production.yml |
develop.yml | push ke develop | /var/www/dashboard-relay-be | .github/workflows/develop.yml |
review.yml | — | (review) | .github/workflows/review.yml |
Langkah deploy (sama untuk prod & staging):
- Install SSH key (secret
SSH_KEY/DEV_SSH_KEY). - Test koneksi SSH.
git checkout <branch>.git pullbranch terkait.npm i.pm2 reload ecosystem.config.js.
Deploy = git pull + reload
Tidak ada build step, test gate, atau migrasi otomatis dalam pipeline. Migrasi database harus dijalankan manual di server. Pastikan urutan: backup DB → npx sequelize-cli db:migrate → pm2 reload.
PM2
ecosystem.config.js:
| Properti | Nilai |
|---|---|
name | backend-ate |
script | ./server.js |
watch | false |
| Log | /var/log/backend/{error,out,application}.log |
| PID | /var/log/backend/process.pid |
PM2 hanya mengawasi server HTTP. Cluster mode (instances/exec_mode) di-comment (mode single).
bash
pm2 start ecosystem.config.js
pm2 reload ecosystem.config.js
pm2 logs backend-ate
pm2 statusProcfile (Heroku-style)
Procfile hanya mendefinisikan web: npm start. Tidak ada worker/scheduler dyno. URL Heroku di app.js (swagger server) hanya default dokumentasi, bukan bukti hosting saat ini.
Cron di production
Penting
Jadwal cron tidak ada di repo. Cron dijalankan oleh crontab/scheduler di VPS yang memanggil npm run cron:*. Saat handover:
- Jalankan
crontab -l(atau cek scheduler) di server untuk inventaris job aktif & jadwalnya. - Pastikan cron
cron:auth-zohoberjalan sesuai TTL token Zoho (~1 jam). - Cron failure tidak masuk log PM2 — arahkan output cron ke file log terpisah.
Lihat Background Jobs & Cron untuk daftar cron.
Checklist deploy production
- Pastikan PR sudah di-review & lulus test lokal.
- Backup database production.
- Merge ke
master(memicuproduction.yml). - Bila ada perubahan skema: SSH ke server, jalankan migrasi manual.
- Verifikasi
pm2 status& log. - Smoke test endpoint kritikal (login, checkout, callback).
- Pantau log delivery & error beberapa saat setelah deploy.