own-proxy decision, terraform provisioner, system diagram, gateway SSE notes, server-budget comment and roadmap 0.4.0 now use Caddy with ACME-managed TLS instead of nginx plus certbot
2.7 KiB
2.7 KiB
type, title, description, tags, status, generated, sources
| type | title | description | tags | status | generated | sources | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reference | Server and memory budget | The CV shares a 2 vCPU, 4 GB server with Gitea and a small webapp, so every workload gets a hard memory cap. |
|
stable |
|
|
Server
server0: 2 vCPU, 3805 MB RAM, no swap yet. Shared with Gitea, its Actions
runner, and a small webapp with one user.
Budget
| What | Memory | Basis |
|---|---|---|
| OS, Gitea, runner (idle), webapp | 1143 MB | Measured1 |
| k3s, trimmed | ~500 MB | Estimate, measure after install |
Namespace cv, hard quota |
384 MB | ResourceQuota |
| Left for CI builds and page cache | ~1.7 GB | |
| Swap | 2 GB | Safety net for build spikes |
Per workload inside cv:
| Workload | Memory limit | CPU limit |
|---|---|---|
| Gateway, including the tracker | 64Mi, GOMEMLIMIT=50MiB |
100m |
| Each chapter (~10) | 16Mi, GOMEMLIMIT=12MiB |
10m |
Completed Jobs do not count against the quota.
Namespace caps
apiVersion: v1
kind: ResourceQuota
metadata: { name: cv-budget, namespace: cv }
spec:
hard: { limits.memory: 384Mi }
---
apiVersion: v1
kind: LimitRange
metadata: { name: cv-defaults, namespace: cv }
spec:
limits:
- type: Container
default: { memory: 16Mi, cpu: 50m }
defaultRequest: { memory: 8Mi, cpu: 5m }
k3s config
/etc/rancher/k3s/config.yaml:
disable: [traefik, servicelb] # Caddy (Terraform) replaces both
kubelet-arg:
- "system-reserved=memory=1300Mi" # measured 1143 MB plus margin
- "eviction-hard=memory.available<200Mi"
Keep metrics-server and local-storage: the HPA demo needs the first,
the tracker's SQLite volume the second. Single-node k3s uses SQLite, not etcd; do not
pass --cluster-init.
Swap
sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile
sudo mkswap /swapfile && sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
k3s starts with swap enabled. Pods do not swap; host processes such as Gitea and builds can.
CI builds
The biggest memory risk. A Nuxt build can take over 1 GB.
- Runner capacity 1: one job at a time.
NODE_OPTIONS=--max-old-space-size=512for the Nuxt build.- Swap catches the rest.
What does not run here
- Language model training: on Noel's own computer. The server only serves the weights file.
- Large load tests: k6 and the HPA demo stay tiny (max 3 replicas, a few virtual users), or are cut.
-
free -mon server0 ↩︎