docs(okf): replace GoatCounter proposal with own SQLite tracker

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Noel SabiaandClaude Opus 5.5 committed 2026-10-11 14:43:34 +02:00
1 parent 261cf17e52
commit 8e1ea495c4
9 files changed
+67 -54

No files matched your search

+17
View File
@@ -14,6 +14,7 @@ generated: { by: claude-code/claude-opus-5-5, at: 2026-10-11T12:15:30Z }
| `GET /` and static paths | Serves the Nuxt build, embedded with `go:embed` |
| `GET /api/events` | SSE stream: full state on connect, then each change |
| `POST /api/fall/{chapter}` | Allowlist, cooldown, rate limit, then calls the chapter's `/fall` |
| every route | Counted by the tracker |
# Reading cluster state
@@ -42,6 +43,22 @@ The same stream feeds the life map and the developer view.
- Send `Content-Type: text/event-stream` and flush after every message.
- Send a comment line (`: ping`) every 30 seconds so idle connections are not closed.
# Tracker
Middleware that counts page views, PDF downloads and falls. See [decision](/decisions/own-tracker.md).
```sql
CREATE TABLE counts (day TEXT, event TEXT, n INTEGER, PRIMARY KEY (day, event));
-- event: 'view:/', 'pdf', 'fall:example', ...
INSERT INTO counts VALUES (?, ?, 1) ON CONFLICT DO UPDATE SET n = n + 1;
```
- Daily totals only. No IP addresses, no cookies, no personal data.
- Skip requests whose user agent looks like a bot.
- SQLite file on a small `local-path` volume. Deployment strategy `Recreate`,
so two gateway pods never write the file at the same time.
- Read the numbers with `sqlite3` or a small admin route later; no dashboard in v1.
# Resources
64Mi memory limit with `GOMEMLIMIT=50MiB`, 100m CPU. See [server budget](/architecture/server-budget.md).
+2 -3
View File
@@ -33,9 +33,8 @@ Per workload inside `cv`:
| Workload | Memory limit | CPU limit |
|---|---|---|
| Gateway | 64Mi, `GOMEMLIMIT=50MiB` | 100m |
| Gateway, including the [tracker](/decisions/own-tracker.md) | 64Mi, `GOMEMLIMIT=50MiB` | 100m |
| Each chapter (~10) | 16Mi, `GOMEMLIMIT=12MiB` | 10m |
| Analytics ([GoatCounter](/decisions/goatcounter-over-umami.md)) | 64Mi | 50m |
Completed Jobs do not count against the quota.
@@ -70,7 +69,7 @@ kubelet-arg:
```
Keep `metrics-server` and `local-storage`: the HPA demo needs the first,
analytics storage the second. Single-node k3s uses SQLite, not etcd; do not
the tracker's SQLite volume the second. Single-node k3s uses SQLite, not etcd; do not
pass `--cluster-init`.
# Swap
+1 -2
View File
@@ -12,12 +12,11 @@ generated: { by: claude-code/claude-opus-5-5, at: 2026-10-11T12:15:30Z }
| Component | Runs as | Job |
|---|---|---|
| Cloudflare Tunnel | `cloudflared` on the home server | Only way in from the internet. Points at the gateway. |
| [Gateway](/architecture/gateway.md) | 1 Deployment, Go | Serves the static site, streams states, forwards knockdowns. The only public service. |
| [Gateway](/architecture/gateway.md) | 1 Deployment, Go | Serves the static site, streams states, forwards knockdowns, counts visits into SQLite. The only public service. |
| [Frontend](/architecture/frontend.md) | Static files inside the gateway image | Nuxt, built with `nuxt generate`. |
| [Chapter service](/architecture/chapter-service.md) | One Deployment or Job per chapter | Behaves healthy, not-ready, crashing, or completed, set by env. |
| [Delivery](/architecture/delivery.md) | Gitea Actions on the home server | Test, scan, build, push, deploy, version. |
| Analytics | 1 Deployment, GoatCounter (proposed) | Page views, PDF downloads, falls per chapter. See [decision](/decisions/goatcounter-over-umami.md). |
Everything runs in one namespace: `cv`, capped at 384Mi memory in total, on a
2 vCPU, 4 GB server shared with Gitea. See [server budget](/architecture/server-budget.md).