From ad9fbc69c8bbbef78275d126b92294b205df2cd4 Mon Sep 17 00:00:00 2001 From: rbsetiawan Date: Mon, 29 Jun 2026 10:13:14 +0700 Subject: [PATCH] docs: tambah tugas Push Notification Microservice (VAPID + FastAPI) ke backlog --- backlog.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/backlog.md b/backlog.md index 2f31fcb..419471f 100644 --- a/backlog.md +++ b/backlog.md @@ -77,6 +77,74 @@ Open → In Progress → Pending (menunggu user/pihak lain) → Resolved → Clo - [ ] GET /ticket_articles/:ticket_id (log/komentar) - [ ] POST /ticket_articles (tambah komentar/update) +--- +# Push Notification Microservice + +## Arsitektur yang Disarankan: **Web Push (VAPID) + ntfy / Superstream** + +### Opsi Backend +| Platform | Protokol | Docker | PWA Support | LDAP | Nilai | +|---|---|---|---|---|---| +| **ntfy** | HTTP Push + WebSocket | ✅ | ✅ (Web Push) | via proxy | 🥇 Ringan & simpel | +| **Webpush custom (FastAPI)** | Web Push VAPID | ✅ | ✅ | ✅ native | 🥈 Full kontrol | +| **Firebase FCM** | FCM | ❌ self-host | ✅ | ❌ | ❌ vendor lock-in | +| **Apprise** | Multi-channel | ✅ | ❌ | ❌ | Sebagai relay saja | + +### **Rekomendasi: Custom FastAPI Push Service + Web Push VAPID** +- Self-hosted, no vendor lock-in +- Compatible Web Push API — bekerja di browser (Chrome, Firefox, Edge, Safari iOS 16.4+) +- PWA: Service Worker `push` event sudah didukung `@ducanh2912/next-pwa` +- Subscription per-user (LDAP username) disimpan di DB +- Trigger dari Zammad webhook, Collector alert, atau manual + +### Alur Push Notification +``` +Event (Zammad tiket baru / Asset alert / dll) + │ + ▼ +Push Service API (FastAPI, port 17000) + │ + ├─ Lookup subscription by user/group LDAP + ├─ Web Push VAPID → Browser/PWA Service Worker + └─ (opsional) relay ke ntfy/email/webhook + │ + ▼ + Browser / PWA + Service Worker `push` event + │ + ▼ + Notification (judul, body, icon, action button, url) +``` + +## Setup Push Service +- [ ] Buat `geonet-push` service (FastAPI + pywebpush) +- [ ] Generate VAPID key pair (public/private) +- [ ] Endpoint: `POST /subscribe` — simpan push subscription per user LDAP +- [ ] Endpoint: `POST /unsubscribe` — hapus subscription +- [ ] Endpoint: `POST /send` — kirim notif ke user/group (internal, pakai API key) +- [ ] Docker Compose di 10.100.1.24, domain: `push.gisportal.id` (internal) +- [ ] Simpan subscription di PostgreSQL/SQLite + +## Sumber Event (Trigger) +- [ ] **Zammad webhook** → tiket baru, update status, assign ke user/group +- [ ] **Collector / Asset Management** → device offline, disk penuh, alert threshold +- [ ] **Manual broadcast** → pengumuman IT Admin ke semua user atau group tertentu +- [ ] *(Future)* Monitoring alert (Zabbix webhook → push service) + +## FE Integration (Next.js PWA) +- [ ] `src/lib/push-client.ts` — subscribe/unsubscribe, kirim VAPID public key ke browser +- [ ] Service Worker handler `push` event (via `@ducanh2912/next-pwa` custom SW) +- [ ] Permission request UI — tombol "Aktifkan Notifikasi" di halaman profile/settings +- [ ] Notification payload: `{ title, body, icon, badge, url, tag }` +- [ ] Action button pada notif: "Lihat Tiket", "Lihat Asset" +- [ ] Notif center di navbar — in-app list notifikasi (polling atau WebSocket) + +## Kategori Notifikasi +- 🎫 **Ticketing**: tiket baru assigned, update status, komentar baru, SLA overdue +- 🖥️ **Asset Management**: device offline > X menit, disk usage > 90%, tiket asset baru +- 📢 **Broadcast IT**: pengumuman, maintenance, downtime +- *(Future)* 📊 Monitoring: alert Zabbix + --- # FE