Skip to content

CI/CD

Dokumentasi untuk continuous integration dan deployment di Merq.

Workflow files are located in .github/workflows/ directory.

GitHub Push (main)
GitHub Actions Triggered
Checkout Code
SCP to Server
Dokploy Detect Changes
Build & Deploy
Health Check
# Simplified current flow
on: push
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy via SCP
run: |
# Copy files to server
scp -r ./ merq-user@server:/opt/merq/

Note: Current workflow hanya SCP - tidak ada build, test, atau Docker build.

  1. Connect GitHub repository di Dokploy
  2. Enable auto-deploy untuk branch:
    • main → Production
    • staging → Staging (if configured)
Push to main
GitHub Webhook → Dokploy
Dokploy Pull Latest Code
Build Docker Image
Deploy to Container
Health Check
Success/Failure Notification
BranchEnvironmentAuto-Deploy
mainProduction✅ Yes
stagingStaging✅ Yes (if configured)
devDevelopment❌ Manual only
  1. Add Test Step

    - name: Run Tests
    run: |
    cd merq-backend
    go test ./...
  2. Add Build Verification

    - name: Build Backend
    run: |
    cd merq-backend
    CGO_ENABLED=0 go build -o main_server ./cmd/server
  3. Add Staging Gate

    • Require staging deploy success before production
    • Manual approval for production
  4. Add Notifications

    - name: Notify on Success
    if: success()
    run: |
    curl -X POST $SLACK_WEBHOOK \
    -d '{"text":"Deployment successful!"}'
  5. Add Auto-Rollback

    • Trigger rollback jika health check gagal setelah deploy

Jika auto-deploy tidak aktif:

  1. Buka aplikasi di Dokploy
  2. Klik “Deploy”
  3. Pilih “Latest commit”
Terminal window
git push origin main
  • Logs: Real-time application logs
  • Metrics: CPU, Memory, Network
  • Deployments: History of deployments
Terminal window
curl https://api.yourdomain.com/api/health

Lihat Rollback Procedures

  1. Test sebelum push - Pastikan code lulus test lokal
  2. Branch protection - Require PR reviews sebelum merge ke main
  3. Small commits - Lebih mudah debug jika ada masalah
  4. Monitor deployments - Check logs setelah deploy