CI/CD
CI/CD Documentation
Section titled “CI/CD Documentation”Dokumentasi untuk continuous integration dan deployment di Merq.
Current Setup
Section titled “Current Setup”GitHub Actions Workflow
Section titled “GitHub Actions Workflow”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 CheckCurrent Workflow
Section titled “Current Workflow”# Simplified current flowon: 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.
Dokploy Auto-Deploy
Section titled “Dokploy Auto-Deploy”Configuration
Section titled “Configuration”- Connect GitHub repository di Dokploy
- Enable auto-deploy untuk branch:
main→ Productionstaging→ Staging (if configured)
Push to main │ ▼GitHub Webhook → Dokploy │ ▼Dokploy Pull Latest Code │ ▼Build Docker Image │ ▼Deploy to Container │ ▼Health Check │ ▼Success/Failure NotificationEnvironment Mapping
Section titled “Environment Mapping”| Branch | Environment | Auto-Deploy |
|---|---|---|
main | Production | ✅ Yes |
staging | Staging | ✅ Yes (if configured) |
dev | Development | ❌ Manual only |
Future Improvements
Section titled “Future Improvements”Recommended Enhancements
Section titled “Recommended Enhancements”-
Add Test Step
- name: Run Testsrun: |cd merq-backendgo test ./... -
Add Build Verification
- name: Build Backendrun: |cd merq-backendCGO_ENABLED=0 go build -o main_server ./cmd/server -
Add Staging Gate
- Require staging deploy success before production
- Manual approval for production
-
Add Notifications
- name: Notify on Successif: success()run: |curl -X POST $SLACK_WEBHOOK \-d '{"text":"Deployment successful!"}' -
Add Auto-Rollback
- Trigger rollback jika health check gagal setelah deploy
Manual Deployment
Section titled “Manual Deployment”Jika auto-deploy tidak aktif:
Via Dokploy UI
Section titled “Via Dokploy UI”- Buka aplikasi di Dokploy
- Klik “Deploy”
- Pilih “Latest commit”
Via Git
Section titled “Via Git”git push origin mainMonitoring
Section titled “Monitoring”Dokploy Dashboard
Section titled “Dokploy Dashboard”- Logs: Real-time application logs
- Metrics: CPU, Memory, Network
- Deployments: History of deployments
Health Check
Section titled “Health Check”curl https://api.yourdomain.com/api/healthRollback
Section titled “Rollback”Lihat Rollback Procedures
Best Practices
Section titled “Best Practices”- Test sebelum push - Pastikan code lulus test lokal
- Branch protection - Require PR reviews sebelum merge ke main
- Small commits - Lebih mudah debug jika ada masalah
- Monitor deployments - Check logs setelah deploy