Deploy manual dari dashboard itu oke untuk sekali-sekali. Tapi untuk workflow harian, kamu butuh CI/CD pipeline yang otomatis: push kode, pipeline jalan, aplikasi ter-deploy.
Helipod mendukung integrasi langsung dengan GitLab. Setiap push ke branch tertentu bisa otomatis trigger build dan deploy. Tidak perlu script tambahan atau server CI sendiri.
Kenapa CI/CD?
| Tanpa CI/CD | Dengan CI/CD |
|---|---|
| Deploy manual dari dashboard | Auto deploy setiap push |
| Mudah lupa step | Pipeline terstandarisasi |
| Sulit track perubahan | Setiap deploy tercatat |
| Human error | Konsisten dan reliable |
Cara Setup GitLab CI/CD
Langkah 1: Hubungkan Repository
- Buka halaman project di Helipod
- Tab Settings → Git
- Pilih GitLab sebagai provider
- Login dengan akun GitLab kamu
- Pilih repository yang ingin dihubungkan
Langkah 2: Konfigurasi Pipeline
Helipod akan otomatis detect .gitlab-ci.yml di repository kamu. Kalau belum ada, buat file tersebut di root project:
stages:
- build
- deploy
build:
stage: build
image: node:20-alpine
script:
- yarn install --frozen-lockfile
- yarn build
artifacts:
paths:
- dist/
- node_modules/
expire_in: 1 hour
deploy:
stage: deploy
image: alpine:latest
script:
- echo "Deploying to Helipod..."
only:
- main
Langkah 3: Set Environment Variables di GitLab
Agar pipeline bisa berinteraksi dengan Helipod, set environment variables di GitLab:
- Buka project di GitLab
- Settings → CI/CD → Variables
- Tambahkan:
| Variable | Deskripsi |
|---|---|
HELIPOD_API_KEY |
API key dari Helipod |
HELIPOD_PROJECT_ID |
ID project Helipod |
Langkah 4: Push dan Deploy
Setelah konfigurasi selesai:
git add .
git commit -m "feat: add new feature"
git push origin main
Pipeline akan otomatis jalan dan deploy ke Helipod.
Workflow yang Direkomendasikan
Branch Strategy
main → Production (auto deploy)
staging → Staging (auto deploy)
feature/* → Preview environment (on demand)
Merge Request Flow
- Buat branch dari
main - Push kode ke branch
- Buat Merge Request
- Pipeline jalan (build + test)
- Review dan merge
- Auto deploy ke production
Environment Per Branch
Helipod bisa membuat environment terpisah untuk setiap branch:
deploy_staging:
stage: deploy
script:
- deploy to staging environment
only:
- staging
deploy_production:
stage: deploy
script:
- deploy to production environment
only:
- main
Untuk penjelasan environment, baca: Environment Variables di Helipod
Auto Deploy dari Helipod
Selain GitLab CI, Helipod juga punya auto-deploy built-in:
- Hubungkan repository GitLab
- Pilih branch untuk production (biasanya
main) - Aktifkan Auto Deploy
- Setiap push ke branch tersebut akan otomatis deploy
Konfigurasi Auto Deploy
- Build command — perintah build (misal:
yarn build) - Start command — perintah start (misal:
yarn start) - Dockerfile — kalau pakai Dockerfile custom
- Environment variables — konfigurasi yang dibutuhkan
Untuk panduan Dockerfile, baca: Cara Membuat Dockerfile untuk Deploy
Monitoring Pipeline
Dari Dashboard Helipod
- Tab Deployments
- Lihat status setiap deployment
- Klik untuk lihat build logs
Dari GitLab
- Buka project di GitLab
- Tab CI/CD → Pipelines
- Lihat status dan logs
Dari Heli Crew
Kamu → "cek deployment terakhir service api-backend"
Heli Crew → [memanggil get_deployments]
→ "Deployment terakhir:
- Commit: feat: add payment integration
- Status: Success
- Duration: 2m 34s
- Deployed: 5 menit yang lalu"
Untuk penjelasan lengkap monitoring, baca: Monitoring dan Logs Real-time
Tips CI/CD
1. Gunakan Cache
Cache dependencies di pipeline untuk build yang lebih cepat:
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .next/cache/
2. Parallel Jobs
Jalankan test dan build secara parallel untuk menghemat waktu:
test:
stage: build
script: yarn test
lint:
stage: build
script: yarn lint
build:
stage: build
script: yarn build
needs: [test, lint]
3. Environment Variables di Pipeline
Akses environment variables dari pipeline:
deploy:
script:
- echo "Deploying to $ENVIRONMENT"
- curl -X POST $HELIPOD_API/deploy
variables:
ENVIRONMENT: production
4. Rollback Otomatis
Konfigurasi rollback otomatis jika deploy gagal:
deploy:
script:
- deploy_to_helipod
- verify_health
after_script:
- if: $CI_JOB_STATUS == "failed"
script: rollback_deployment
Troubleshooting
Pipeline Gagal di Build Stage
- Cek build logs untuk error message
- Pastikan dependency terinstall dengan benar
- Cek apakah ada script yang error di
package.json
Deploy Gagal
- Pastikan environment variables sudah benar
- Cek apakah service di Helipod sudah running
- Verifikasi koneksi ke database
Auto Deploy Tidak Jalan
- Pastikan branch yang dipilih benar
- Cek apakah repository sudah terhubung
- Verifikasi webhook di GitLab
Untuk troubleshooting lebih lanjut, baca: Cara Membuat Dockerfile untuk Deploy — bagian debugging
Mulai Sekarang
Daftar gratis di helipod.io. Hubungkan repository GitLab dan setup auto deploy dalam hitungan menit.
Butuh bantuan? Hubungi support@helipod.id atau bergabung di komunitas hangar.helipod.io.
Baca juga:
- Cara Membuat Dockerfile untuk Deploy — panduan Dockerfile lengkap
- Monitoring dan Logs Real-time — pantau aplikasi dari dashboard
- Multi-Service Project di Helipod — deploy banyak service sekaligus