CI/CD Deployment (Cloud-Native)
Overview
Dokumentasi ini menjelaskan CI/CD deployment sebagai Environment B dalam pengujian komparatif. CI/CD deployment merepresentasikan pendekatan modern dengan automation menggunakan Gitea Runner dan Kubernetes (K3s).
Apa itu CI/CD Deployment?
CI/CD deployment adalah proses deployment aplikasi yang sepenuhnya otomatis melalui pipeline:
- Continuous Integration (CI): Build & test otomatis saat code change
- Continuous Deployment (CD): Deploy otomatis ke production
- Zero manual intervention: Dari git push sampai deployed
- Automated verification: Health check & rollback otomatis
Automation penuh - developer hanya perlu git push, sisanya otomatis.
Karakteristik CI/CD Deployment
⚙️ Proses Deployment
Developer → Git Push → CI/CD Pipeline → Automated Deployment → Live
↓ ↓ ↓ ↓ ↓
Manual Auto Auto Auto Auto
Hanya 1 manual step: git push
📊 Metrik yang Diukur
Dalam pengujian, kita akan mengukur:
| Metrik | Deskripsi |
|---|---|
| Deployment Time | Waktu dari git push sampai aplikasi deployed |
| Manual Steps | Jumlah intervensi manusia (hanya 1: git push) |
| Downtime | Waktu aplikasi tidak dapat diakses (target: 0) |
| Error Rate | Kemungkinan error (automated, konsisten) |
| Consistency | Seberapa konsisten hasil deployment (tinggi) |
Real Case: 3 Microservices
Aplikasi yang akan di-deploy dengan CI/CD:
Service yang Di-Deploy
-
users-service (Port 3001)
- User management & authentication
-
products-service (Port 3002)
- Product catalog management
-
orders-service (Port 3003)
- Order processing & transactions
Deployment Flow CI/CD
Developer Git Push
↓
Gitea Webhook Trigger
↓
Gitea Runner Pipeline Start
↓
[CI Stage]
- Checkout code
- Build Docker image
- Push to registry
↓
[CD Stage]
- Update K3s deployment
- Rolling update (zero-downtime)
- Health check
↓
Deployment Complete
Total manual steps: 1 command (git push)
Kelebihan & Kekurangan
✅ Kelebihan
- Fully automated - Tidak perlu SSH, tidak perlu manual command
- Fast - Deployment <1 menit
- Zero downtime - Rolling update tanpa service interruption
- Consistent - Setiap deployment sama persis
- Easy rollback - Automatic rollback jika failure
- Audit trail - Semua deployment tracked di Git history
- Scalable - Mudah deploy ke multiple environments
❌ Kekurangan
- Initial setup - Perlu setup Gitea Runner & K3s dulu
- Learning curve - Perlu pahami CI/CD concepts
- Complexity - Lebih banyak moving parts
- Dependency - Bergantung pada CI/CD infrastructure
Scope Dokumentasi
Dokumentasi cloud-native deployment fokus pada:
🎯 Yang Dibahas
- ✅ CI/CD pipeline configuration (Gitea Actions workflow)
- ✅ Automated deployment steps untuk 3 services
- ✅ Time measurement untuk setiap stage
- ✅ Rollback mechanism
🚫 Yang TIDAK Dibahas
- ❌ Setup K3s dari awal (diasumsikan sudah ready)
- ❌ Setup Gitea & Gitea Runner (diasumsikan sudah running)
- ❌ Advanced Kubernetes features (service mesh, dll)
- ❌ Advanced monitoring/observability stack
Fokus: Bagaimana deploy 3 service dengan CI/CD dan berapa lama waktu yang dibutuhkan.
Asumsi Environment
Sebelum mulai deployment, diasumsikan infrastructure sudah siap:
- ✅ K3s cluster running
- ✅ Gitea server accessible
- ✅ Gitea Runner configured & connected
- ✅ Docker registry available (Gitea container registry)
- ✅ Kubectl access ke K3s cluster
- ✅ Application repository dengan workflow file
Perbandingan dengan Manual Deployment
| Aspek | Manual Deployment | CI/CD (Cloud-Native) |
|---|---|---|
| Trigger | SSH + manual commands | Git push |
| Process | Manual 17-21 commands | Automated pipeline |
| Time | 3-5 menit | <1 menit |
| Downtime | 30-60 detik | 0 detik (rolling update) |
| Manual Steps | 17-21 commands | 1 command (git push) |
| Consistency | Low (human dependent) | High (automated) |
| Rollback | Manual & complex | Automated |
| Error Prone | High (human error) | Low (automated) |
Komponen CI/CD
Gitea Actions
- Workflow file:
.gitea/workflows/deploy.yml - Trigger: Push ke branch
main - Stages: Build → Push → Deploy
Docker
- Build: Setiap service menjadi Docker image
- Registry: Gitea container registry
- Versioning: Git commit SHA sebagai tag
K3s (Kubernetes)
- Deployment: Kubernetes deployment resource
- Rolling Update: Zero-downtime deployment strategy
- Service: Load balancing internal
- Health Check: Liveness & readiness probes
Struktur Dokumentasi
Dokumentasi CI/CD deployment terdiri dari:
-
Pendahuluan (halaman ini)
- Overview CI/CD deployment
- Karakteristik & scope
-
- Spesifikasi infrastructure
- K3s configuration overview
-
- Pipeline architecture
- Stages & steps detail
-
- How to deploy dengan git push
- Time measurement
- Troubleshooting
Tujuan Pengujian
Dengan mendokumentasikan CI/CD deployment, kita akan:
- Mengukur automation benefit - Seberapa cepat deployment otomatis?
- Count manual intervention - Berapa sedikit campur tangan manusia?
- Measure downtime - Apakah benar zero-downtime?
- Evaluate consistency - Seberapa konsisten hasil deployment?
- Compare dengan manual - Seberapa besar improvement?
Expected Results
Hipotesis pengujian:
- ⏱️ Deployment time: <1 menit (60-90 detik)
- 🔢 Manual steps: 1 command (git push)
- ⏰ Downtime: 0 detik (rolling update)
- ❌ Error rate: <1% (automated, konsisten)
- 📊 Consistency: High (identical setiap kali)
Hasil aktual akan dibandingkan dengan manual deployment di Test Results.
Langkah Selanjutnya
Untuk memahami CI/CD deployment:
👉 Environment Setup - Overview infrastructure
👉 CI/CD Flow - Detail pipeline architecture
👉 Deployment Guide - Practical guide deploy dengan git push