Deployment

Deploy yellow-bank-soal-docs ke VPS aaPanel dengan Bun + Nginx static site.

Deployment

Target: deploy yellow-bank-soal-docs ke VPS aaPanel (klien) sebagai static site. Stack: Bun (untuk build) + Nginx (untuk serve static files via aaPanel). Tidak ada Docker, tidak ada Node.js runtime persistent, tidak ada PM2.

Output bun run build adalah pure static HTML/CSS/JS di .docu/dist/. Setelah build, Nginx langsung serve file tersebut — tidak butuh proses yang jalan terus.

Prasyarat di VPS Klien

KebutuhanCara Cek / Setup
aaPanel terinstallAkses UI https://<vps-ip>:<port>
Web TerminalaaPanel sidebar → "Terminal"
Akses rootLogin aaPanel sebagai admin
Domain sudah pointingsoal-docs.theyellowjacket.id → IP VPS klien
Port 80/443 terbukaaaPanel → Security → cek firewall

Tidak perlu Node.js, tidak perlu PM2, tidak perlu Python.

Step 1: Install Bun di VPS

  1. Buka aaPanel → sidebar kiri → Terminal
  2. Jalankan command:
bash
curl -fsSL https://bun.sh/install | bash
  1. Reload shell:
bash
source ~/.bashrc
  1. Verifikasi:
bash
bun --version

Harusnya muncul versi (mis. 1.3.x).

Resource Bun: ~50MB di disk, tidak ada service yang jalan. Bun hanya dipakai saat build, setelah itu idle.

Step 2: Clone Repo Docs

  1. Di Web Terminal, pindah ke document root aaPanel:
bash
cd /www/wwwroot/
  1. Clone repo (public, tanpa auth):
bash
git clone https://git.backoffice.biz.id/dwindown/yellow-bank-soal-docs.git soal-docs.theyellowjacket.id

Catatan: kalau clone via HTTPS gagal (umumnya karena git butuh konfigurasi), pakai URL SSH dengan port 2222:

bash
git clone ssh://[email protected]:2222/dwindown/yellow-bank-soal-docs.git soal-docs.theyellowjacket.id

Repo public, jadi SSH key tidak wajib.

  1. Masuk ke folder:
bash
cd soal-docs.theyellowjacket.id

Step 3: Install Dependencies + Patch Flame

bash
bun install

Penting: command ini akan otomatis meng-apply patch flame (gesture navigation mermaid) dari folder patches/. Patch ini persistent — terdaftar di package.jsonpatchedDependencies.

Verifikasi patch ter-apply:

bash
grep -c "handleWheel\|handlePointerDown" node_modules/@docubook/mdx-content/dist/index.js

Harusnya muncul angka > 0 (sekitar 4-6).

Step 4: Build Pertama

bash
bun run build

Tunggu sampai muncul:

text
✓ Built 32 pages (0 cached)
✓ Search index generated (794 records)

Hasil build ada di .docu/dist/. Folder ini yang akan dilayani Nginx.

Verifikasi struktur output:

bash
ls -la .docu/dist/

Harus ada: index.html, 404.html, docs/, assets/.

Step 5: Setup Static Site di aaPanel

5.1 Buat Website Baru

  1. aaPanel → WebsiteAdd Site
  2. Isi form:
    • Type: PHP Site (atau Static Site — pilih yang ada)
    • Domain: soal-docs.theyellowjacket.id
    • Root Directory: klik "Browse" → pilih /www/wwwroot/soal-docs.theyellowjacket.id/.docu/dist
    • PHP Version: Pure Static (kalau ada opsi) atau apapun (tidak dipakai)
    • Database: None
  3. Klik Submit

⚠️ Penting: Root directory harus mengarah ke .docu/dist/, bukan ke root repo. Kalau salah, halaman tidak akan muncul.

5.2 (Opsional) Hapus Default Index aaPanel

aaPanel biasanya buat file index.html default di root site. Karena kita pakai .docu/dist/ yang sudah punya index.html, hapus default-nya:

bash
# Lewat Web Terminal
ls /www/wwwroot/soal-docs.theyellowjacket.id/.docu/dist/index.html
# kalau ada, berarti sudah benar

Step 6: Setup SSL (HTTPS)

  1. aaPanel → Website → klik site soal-docs.theyellowjacket.idSettings
  2. Tab SSL → pilih Let's Encrypt
  3. Klik Apply
  4. Tunggu sampai issued (biasanya < 1 menit)
  5. Centang Force HTTPS untuk redirect HTTP → HTTPS

Setelah ini, akses https://soal-docs.theyellowjacket.id harus muncul landing page docs.

Step 7: Konfigurasi Nginx untuk Routing DocuBook

DocuBook menggunakan URL seperti /docs/konsep/alur (tanpa .html). Nginx perlu di-config untuk auto-append .html ke URL yang tidak punya extension.

  1. aaPanel → Website → klik site → SettingsConfig File
  2. Cari blok location / dan tambahkan directive try_files:
nginx
location / {
    try_files $uri $uri/ $uri.html /404.html;
}
  1. Save config
  2. aaPanel akan otomatis reload Nginx

Full example (sesuaikan dengan config aaPanel Anda):

nginx
server {
    listen 80;
    listen 443 ssl;
    server_name soal-docs.theyellowjacket.id;

    root /www/wwwroot/soal-docs.theyellowjacket.id/.docu/dist;
    index index.html;

    # SSL config (auto-generated by aaPanel)
    # ssl_certificate ...
    # ssl_certificate_key ...

    location / {
        try_files $uri $uri/ $uri.html /404.html;
    }

    # Cache static assets aggressively
    location ~* \.(js|css|svg|png|jpg|jpeg|gif|ico|woff2?)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

    # HTML tidak di-cache (untuk update konten langsung reflect)
    location ~* \.html$ {
        add_header Cache-Control "no-cache, must-revalidate";
    }
}

Step 8: Buat Deploy Script untuk Update

Script ini akan dijalankan tiap kali mau update docs.

8.1 Buat File Script

Di Web Terminal:

bash
cat > /www/wwwroot/soal-docs.theyellowjacket.id/deploy.sh << 'EOF'
#!/bin/bash
set -e

SITE_DIR="/www/wwwroot/soal-docs.theyellowjacket.id"
cd "$SITE_DIR"

echo "=== Pull latest changes ==="
git pull origin main

echo "=== Install dependencies (auto-apply patches) ==="
bun install --frozen-lockfile

echo "=== Clean previous build ==="
bunx flame clean

echo "=== Build ==="
bun run build

echo "=== Done at $(date) ==="
ls -la .docu/dist/ | head -10
EOF

chmod +x /www/wwwroot/soal-docs.theyellowjacket.id/deploy.sh

8.2 Test Script

Jalankan sekali untuk pastikan jalan:

bash
/www/wwwroot/soal-docs.theyellowjacket.id/deploy.sh

Kalau berakhir dengan === Done at <date> === dan list file .docu/dist/, berarti sukses.

Step 9: Setup aaPanel Cron (Update dengan 1 Klik)

  1. aaPanel → Cron (sidebar)
  2. Klik Add Cron
  3. Isi:
    • Task Type: Shell Script
    • Task Name: Update Docs yellow-bank-soal
    • Execution Cycle: Manual (jangan set waktu — kita trigger manual)
    • Script Content:
      bash
      /www/wwwroot/soal-docs.theyellowjacket.id/deploy.sh
      
  4. Submit

Sekarang tiap mau update docs:

  1. Buka aaPanel → Cron
  2. Cari task Update Docs yellow-bank-soal
  3. Klik tombol Execute (▶️) di sebelah kanan
  4. Tunggu ~10-15 detik, refresh browser docs → konten baru muncul

Tidak perlu SSH, tidak perlu buka Web Terminal tiap kali.

Verifikasi Deployment

Buka browser, akses:

URLExpected
https://soal-docs.theyellowjacket.id/Landing page hero "Yellow Bank Soal"
https://soal-docs.theyellowjacket.id/docsDaftar docs / redirect ke halaman pertama
https://soal-docs.theyellowjacket.id/docs/pengenalan/overviewHalaman Overview
https://soal-docs.theyellowjacket.id/docs/konsep/alurHalaman alur dengan diagram mermaid (test gesture fullscreen!)
URL non-existentHalaman 404

Troubleshooting

Halaman blank / 404 di semua URL

Kemungkinan: root directory salah atau file index.html tidak ada.

Cek:

bash
ls /www/wwwroot/soal-docs.theyellowjacket.id/.docu/dist/index.html

Kalau tidak ada, jalankan ulang bun run build di Web Terminal.

Halaman /docs/konsep/alur 404 tapi /docs/konsep/alur.html bisa diakses

Kemungkinan: Nginx try_files belum dikonfigurasi untuk auto-append .html.

Fix: ulangi Step 7, pastikan try_files $uri $uri/ $uri.html /404.html; ada di config.

SSL gagal issue

Kemungkinan: domain belum pointing ke IP VPS, atau port 80 belum terbuka.

Cek:

bash
# DNS resolve
dig soal-docs.theyellowjacket.id +short

# Port 80 open
curl -I http://soal-docs.theyellowjacket.id

Build gagal dengan error patch

Kemungkinan: patches/ folder tidak ikut ter-commit ke git, atau bun.lock corrupt.

Fix:

bash
cd /www/wwwroot/soal-docs.theyellowjacket.id
git pull
rm -rf node_modules bun.lock
bun install
bun run build

Mermaid gesture (scroll zoom, drag pan) tidak jalan

Kemungkinan: patch flame tidak ter-apply, atau browser cache.

Cek:

bash
grep -c "handleWheel" node_modules/@docubook/mdx-content/dist/index.js

Harusnya > 0. Kalau 0, hapus node_modules lalu bun install ulang.

Browser cache: hard refresh Cmd+Shift+R atau Ctrl+Shift+R.

Backup & Maintenance

Backup

Yang penting di-backup cuma source repo (sudah di git). Output build bisa di-regenerate kapan saja.

bash
# Backup manual (jarang dibutuhkan karena ada git)
tar -czf docs-backup-$(date +%Y%m%d).tar.gz \
    --exclude=node_modules \
    --exclude=.docu \
    /www/wwwroot/soal-docs.theyellowjacket.id/

Update Bun

Sekali per beberapa bulan, update Bun untuk fitur/security:

bash
bun upgrade

Disk Space

Cek penggunaan disk:

bash
du -sh /www/wwwroot/soal-docs.theyellowjacket.id/
du -sh /www/wwwroot/soal-docs.theyellowjacket.id/node_modules/
du -sh /www/wwwroot/soal-docs.theyellowjacket.id/.docu/

Total biasanya ~150-200MB (node_modules + build output). Tidak signifikan untuk VPS 16GB.

Security Considerations

RisikoMitigasi
.docu/dist/ exposedSudah OK — cuma static files, tidak ada secrets
node_modules/ exposedPastikan Nginx tidak serve folder ini (default aaPanel sudah handle)
Repo .git/ exposedTambahkan di Nginx config: location ~ /\.git { deny all; }
Source MDX exposedOK — file .mdx tidak di-serve (cuma hasil build)
Patch file exposedOK — cuma diff text

Tambahkan ke Nginx config untuk keamanan:

nginx
# Block akses ke file/folder sensitif
location ~ /\.(git|env|docu) {
    deny all;
    return 404;
}

location ~ /(node_modules|patches) {
    deny all;
    return 404;
}

Update Workflow Summary

Sekali setup (Step 1-9): ~30 menit.

Setiap update docs (jarang):

  1. Commit + push ke git-ssh.backoffice.biz.id:2222/dwindown/yellow-bank-soal-docs.git dari lokal
  2. Buka aaPanel klien → Cron → cari task "Update Docs"
  3. Klik Execute
  4. Tunggu 10-15 detik
  5. Refresh browser → konten baru muncul

Tidak perlu SSH, tidak perlu build lokal, tidak perlu upload manual.

Bacaan Lanjut

Last updated Jul 26, 2026