GitHub Actions memang powerful — ini tools CI/CD yang paling populer di dunia dengan integrasi native ke GitHub, marketplace actions yang lengkap, dan workflow file yang mudah dibaca. Tapi ada masalah yang jarang dibahas: biaya. Untuk private repositories, GitHub memberikan 2000 menit gratis per bulan. Untuk public repo gratis unlimited, tapi banyak project production (aplikasi klien, side project berbayar, internal tools) harus pakai private repo. Dan untuk project yang serius — dengan multiple branches, frequent builds, dan matrix testing — 2000 menit itu habis dalam hitungan hari. Di Indonesia, di mana $1 = Rp16.000, biaya GitHub Actions bisa jadi signifikan untuk startup kecil dan freelancer.
Gue pernah menghabiskan $47 per bulan hanya untuk GitHub Actions di project kantor. Itu belum termasuk storage artifacts dan container registry yang juga ada limitnya. Setelah hitung-hitungan, gue memutuskan untuk self-host CI/CD dengan Gitea Actions — dan biayanya turun drastis ke $0. Artikel ini bakal memandu lo setup Gitea Actions dari nol, termasuk configuration untuk runner yang bisa menjalankan workflow di server lo sendiri. Yang menarik: Gitea Actions menggunakan syntax yang identik dengan GitHub Actions, jadi migrasi dari GitHub Actions ke Gitea itu drop-in — cuma perlu copy-paste file workflow, ganti trigger dari webhook GitHub ke webhook Gitea, dan jalan.
Kenapa Gitea Actions? CI/CD Self-Hosted yang Sebenarnya Gratis
GitHub Actions memang powerful, tapi ada masalah yang jarang dibahas: biaya. Untuk private repositories, GitHub memberikan 2000 menit gratis per bulan. Tapi untuk project yang serius — dengan multiple branches,频繁 builds, dan matrix testing — 2000 menit itu habis dalam hitungan hari. Di Indonesia, dimana $1 = Rp16.000, biaya GitHub Actions bisa jadi signifikan untuk startup kecil.
Saya pernah menghabiskan $47/bulan hanya untuk GitHub Actions di project kantor. Itu belum termasuk storage artifacts dan container registry. Setelah hitung-hitungan, saya memutuskan untuk self-host CI/CD dengan Gitea Actions — dan biayanya turun drastis.
Artikel ini akan memandu kamu setup Gitea Actions dari nol, termasuk configuration untuk Docker runner yang bisa menjalankan workflow di server kamu sendiri.
Apa itu Gitea Actions?
Gitea Actions adalah fitur CI/CD bawaan Gitea yang kompatibel dengan syntax GitHub Actions. Artinya, jika kamu sudah punya workflow file untuk GitHub (.github/workflows/*.yml), kamu bisa langsung menggunakannya di Gitea dengan perubahan minimal.
Yang membuat Gitea Actions menarik:
- Gratis tanpa batas — tidak ada menit usage limit
- Syntax kompatibel dengan GitHub Actions — migrasi mudah
- Self-hosted runner — kamu kontrol infrastrukturnya
- Acts engine — engine yang sama yang digunakan oleh GitHub Actions
- Built-in ke Gitea — tidak perlu install tools tambahan
Prasyarat
- Gitea sudah terinstall dan running (minimal versi 1.21+)
- Docker terinstall di mesin yang sama atau terpisah
- Akses admin ke Gitea instance
Jika kamu belum punya Gitea, berikut quick setup:
# docker-compose.yml untuk Gitea
version: '3'
services:
gitea:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=sqlite3
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"
restart: always
docker compose up -d
Step 1: Install Gitea Runner (Docker)
Gitea Runner adalah aplikasi yang menerima job dari Gitea dan menjalankannya. Ada dua mode: Docker runner (recommended) dan binary runner. Kita pakai Docker runner karena lebih isolated.
# Buat direktori untuk runner
mkdir -p /opt/gitea-runner && cd /opt/gitea-runner
# Generate token registration dari Gitea
# Menu: Site Administration → Runners → Create New Runner
# Copy token yang diberikan
# Jalankan runner dengan Docker
docker run -d \
--name gitea-runner \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /opt/gitea-runner/data:/data \
-e GITEA_INSTANCE_URL=http://your-gitea-host:3000 \
-e GITEA_RUNNER_REGISTRATION_TOKEN=YOUR_TOKEN_HERE \
-e GITEA_RUNNER_NAME=main-runner \
-e GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bookworm,ubuntu-22.04:docker://ubuntu:22.04 \
gitea/act_runner:latest
Labels menentukan image Docker apa yang digunakan untuk setiap runs-on di workflow. Kamu bisa customize sesuai kebutuhan.
Step 2: Buat Workflow File
Di repo Gitea kamu, buat file .gitea/workflows/ci.yml (atau .github/workflows/ci.yml jika kamu menggunakan kompatibilitas GitHub):
# .gitea/workflows/ci.yml
name: CI Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Run linting
run: npm run lint
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install & Build
run: |
npm ci
npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist/
Step 3: Deploy Workflow dengan Docker Compose
Untuk project yang lebih kompleks, kamu bisa setup runner dengan Docker Compose yang lebih proper:
# docker-compose.yml untuk Gitea Runner
version: '3.8'
services:
gitea-runner:
image: gitea/act_runner:latest
container_name: gitea-runner
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
environment:
- GITEA_INSTANCE_URL=http://gitea:3000
- GITEA_RUNNER_REGISTRATION_TOKEN=${RUNNER_TOKEN}
- GITEA_RUNNER_NAME=prod-runner
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bookworm
- GITEA_RUNNER_WORKSPACE=/data/workspace
networks:
- gitea-net
networks:
gitea-net:
external: true
Step 4: Konfigurasi Advanced — Caching & Artifacts
Salah satu concern dengan self-hosted runner adalah caching. Di GitHub Actions, cache disimpan di cloud storage. Di self-hosted, kamu perlu handle sendiri:
# .gitea/workflows/ci-with-cache.yml
name: CI with Caching
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Cache npm dependencies
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci --prefer-offline
- name: Build
run: npm run build
# Simpan build artifacts ke volume bersama
- name: Save build artifacts
run: |
mkdir -p /data/artifacts/${{ github.sha }}
cp -r dist/* /data/artifacts/${{ github.sha }}/
Memigrasikan dari GitHub Actions
Jika kamu sudah punya workflow di GitHub, migrasi ke Gitea Actions cukup mudah:
- Copy seluruh folder
.github/workflows/ke.gitea/workflows/ - Ganti
runs-on: ubuntu-latestjika menggunakan custom runner labels - Ganti action references jika ada yang menggunakan GitHub-specific features
- Test setiap workflow secara individual
Yang perlu diperhatikan:
GITHUB_TOKEN→ diganti denganGITEA_TOKENatau gunakan secrets- GitHub Container Registry → diganti dengan container registry sendiri
- Beberapa actions mungkin belum kompatibel — cek dokumentasi Gitea
Monitoring dan Troubleshooting
# Cek status runner
docker logs gitea-runner --tail 50
# Restart runner jika stuck
docker restart gitea-runner
# Cek jobs yang sedang running
# Menu: Repository → Actions → Jobs
Untuk monitoring yang lebih lengkap, pertimbangkan setup Netdata + Grafana untuk memantau resource usage runner kamu.
Biaya Operasional
| Item | GitHub Actions | Gitea Self-Hosted |
|---|---|---|
| CI/CD minutes | 2000/mo gratis, $0.008/menit setelahnya | Unlimited, $0 |
| Storage artifacts | 500MB gratis | Unlimited (local disk) |
| Container registry | 500MB gratis | Unlimited (local) |
| VPS cost | $0 tambahan | VPS existing |
| Total (5000 min/bulan) | ~$24/bulan | $0 tambahan |
Untuk startup Indonesia yang menjalankan 10-20 builds per hari, Gitea Actions bisa menghemat Rp300.000-500.000 per bulan dibanding GitHub Actions.
Kesimpulan
Gitea Actions adalah alternatif CI/CD self-hosted yang powerful, gratis, dan kompatibel dengan syntax GitHub Actions. Dengan setup yang relatif sederhana, kamu bisa membangun pipeline CI/CD yang scalable tanpa biaya tambahan. Investasi waktu untuk setup ini akan terbayar lunas dalam hitungan bulan — terutama untuk tim yang sering melakukan deployment.
Untuk deployment ke production, pertimbangkan juga Gitea + Drone CI yang sudah lebih mature untuk use case tertentu.
Baca juga:
- CI/CD Self-Hosted dengan Gitea + Drone CI
- Docker Security Hardening untuk Production
- Self-Host Website dengan Docker di VPS
Setup Praktis Gitea Actions di VPS
Berikut step-by-step setup Gitea Actions di VPS Ubuntu 22.04 dengan Docker runner. Total waktu setup: 30-45 menit kalau lo sudah familiar dengan Docker dan Nginx.
Step 1: Install Gitea
Pakai Docker Compose untuk setup yang clean:
# docker-compose.yml
version: "3"
services:
gitea:
image: gitea/gitea:1.21
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=sqlite3
- GITEA__server__DOMAIN=git.example.com
- GITEA__server__SSH_DOMAIN=git.example.com
restart: always
volumes:
- /var/lib/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"
runner:
image: gitea/act_runner:0.2
container_name: gitea-runner
depends_on:
- gitea
environment:
- GITEA_INSTANCE_URL=http://gitea:3000
- GITEA_RUNNER_REGISTRATION_TOKEN=<dari Gitea admin>
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
Start services: docker compose up -d. Buka http://localhost:3000, buat akun admin, dan login.
Step 2: Enable Actions di Gitea
Secara default, Actions belum enabled. Enable via admin panel: Site Administration → Actions → Enable. Setelah enable, lo bisa lihat tab "Actions" di setiap repository.
Step 3: Daftarkan Runner
Pergi ke Site Administration → Actions → Runners → Create new runner. Copy registration token, paste ke docker-compose.yml di GITEA_RUNNER_REGISTRATION_TOKEN. Restart runner container. Kalau sukses, status runner akan berubah jadi "Idle" di Gitea admin.
Step 4: Setup Reverse Proxy dengan Nginx
Untuk expose ke internet dengan HTTPS, pakai Nginx + Certbot (lihat artikel TLS certificate untuk detail setup):
server {
server_name git.example.com;
listen 80;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Setelah setup, enable HTTPS dengan sudo certbot --nginx -d git.example.com. Sekarang lo punya Gitea instance dengan HTTPS.
Step 5: Migrasi Workflow dari GitHub
Yang bikin Gitea Actions menarik: syntax workflow identik dengan GitHub Actions. Kalau lo punya file .github/workflows/*.yml, lo cuma perlu copy ke .gitea/workflows/*.yml di repository Gitea. Trigger otomatis sama: push ke branch, pull request, manual trigger, schedule, dll.
# .gitea/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: |
npm install
npm test
- name: Build Docker image
run: docker build -t myapp .
File ini akan jalan di Gitea Actions tanpa modifikasi. Action yang lo pakai di GitHub (actions/checkout, actions/setup-node, dll) juga work di Gitea — kebanyakan official action compatible karena pakai Docker container.
Tips Optimasi untuk Self-Hosted Runner
Self-hosted runner punya beberapa optimasi yang bisa di-tweak untuk performance terbaik:
Cache Layer
GitHub Actions punya cache built-in, tapi Gitea perlu setup manual. Gunakan Gitea sendiri sebagai cache backend — save artifact ke Gitea release, atau pakai external cache seperti Redis:
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Multi-Runner Setup
Untuk tim yang lebih besar, deploy multiple runner di beberapa VPS atau VM. Gitea otomatis distribute jobs ke runner yang available. Ini parallelism gratis — nggak ada limit concurrent jobs seperti di GitHub Actions free tier.
Custom Labels untuk Hardware Specific
Bikin runner dengan label khusus untuk hardware tertentu (GPU, RAM besar, ARM):
runs-on: [self-hosted, linux, gpu]
# Hanya jalan di runner yang punya label "gpu"
Pattern ini berguna untuk build yang butuh GPU (misalnya CUDA compilation) atau ARM64 (misalnya Apple Silicon cross-compile).
Security Hardening untuk Gitea
Self-hosted = self-managed security. Beberapa hal yang wajib di-setup:
- HTTPS only — pakai Certbot, redirect HTTP ke HTTPS, set header HSTS.
- Disable registration publik — kalau ini untuk tim internal, disable open registration di admin settings.
- Two-factor authentication — enforce 2FA untuk semua user via admin policy.
- SSH key authentication — disable password login untuk SSH Git access.
- Regular backup — backup data volume /var/lib/gitea secara berkala.
- Update regularly — Gitea rilis update keamanan berkala, jangan skip.
Dengan setup security yang proper, Gitea self-hosted lebih aman dari GitHub托管 — karena attack surface-nya kecil dan lo kontrol semuanya.
Use Case Lanjutan: Matrix Builds, Multi-Arch, dan Deployment
Salah satu kekuatan Gitea Actions yang sering di-underestimate: matrix builds yang cost-effective. GitHub Actions free tier limit matrix size (misalnya 10 kombinasi), Gitea nggak ada limit.
strategy:
matrix:
node: [16, 18, 20]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
Untuk deployment, Gitea Actions bisa langsung deploy ke VPS via SSH, atau push image Docker ke private registry. Pattern umum:
- name: Deploy to production
uses: appleboy/[email protected]
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
script: |
cd /opt/myapp
git pull
docker compose restart
Setup ini bikin full CI/CD pipeline yang powerful dengan biaya infrastructure yang minimal — cukup VPS yang sudah lo punya, plus listrik. ROI-nya immediate untuk tim kecil yang sering deploy.
Kesimpulan
Gitea Actions itu bukan cuma "GitHub Actions tapi gratis" — ini adalah ekosistem CI/CD self-hosted yang mature dan production-ready, dengan syntax yang familiar, ekosistem action yang kompatibel, dan fleksibilitas yang lebih besar dari platform托管. Untuk startup Indonesia dan tim kecil yang ingin kontrol penuh atas infrastructure dengan budget terbatas, Gitea Actions adalah pilihan yang sangat solid. Setup awal memang butuh waktu, tapi setelah jalan, biaya operasional turun ke hampir $0, dan lo nggak perlu khawatir soal rate limit atau billing surprises.
Gitea Actions adalah alternatif CI/CD self-hosted yang powerful, gratis, dan kompatibel dengan syntax GitHub Actions. Dengan setup yang relatif sederhana, lo bisa membangun pipeline CI/CD yang scalable tanpa biaya tambahan. Investasi waktu untuk setup ini akan terbayar lunas dalam hitungan bulan — terutama untuk tim yang sering melakukan deployment, dan untuk developer Indonesia yang ingin menekan biaya infrastructure cloud.
💬 Komentar (0)
Belum ada komentar. Jadilah yang pertama! 💬