Prompts library¶
The prompts library for this stack is a lightweight Python 3 service that loads Will's fork of the public prompts.chat curation and talks to local Ollama.
Source: github.com/willyd61/awesome-chatgpt-prompts (upstream: prompts.chat)
Service: prompts-chat.service — /opt/prompts-chat/app.py, about 47 MiB RSS, 3,157 prompts from prompts.csv.
Sanitized copies: config/vps/opt/prompts-chat/app.py, config/vps/etc/default/prompts-chat, config/vps/etc/systemd/system/prompts-chat.service, plus the weekly update unit and timer.
Why this architecture¶
The upstream prompts.chat app is Next.js + Prisma + PostgreSQL. Running a full Node.js build/runtime plus a separate database on this 8 GB / 2 vCPU VPS, alongside qwen3:4b (MemoryMax=5G), Nautobot, Postgres, Redis, Grafana, and nginx, would starve RAM. Instead, a zero-dependency Python 3 stdlib server loads prompts.csv directly and proxies chat requests to Ollama on 127.0.0.1:11434. The default model is qwen3:4b, with a /no_think toggle so Qwen3 can skip its slow CPU reasoning phase unless you ask for it.
How to reach it¶
Tailnet only. The app listens on 127.0.0.1:8090. It is published with Tailscale Serve (not Funnel, and not public nginx):
That advertises http://goc-vps:8090 and http://goc-vps.<TAILNET>.ts.net:8090. The command, a short explanation, and the sanitized tailscale serve status output are in config/vps/usr/local/tailscale-serve.md. It is not opened in ufw and was not added to public nginx on 80/443.
On a host where local DNS or a search domain overrides goc-vps (for example linux-01 and *.cbgoc-hamlet.top):
curl -H "Host: goc-vps:8090" http://<VPS_TAILSCALE_IP>:8090/healthz
# or
curl --resolve goc-vps:8090:<VPS_TAILSCALE_IP> http://goc-vps:8090/
SSH tunnel fallback: ssh -L 8090:127.0.0.1:8090 root@<VPS_PUBLIC_IP>, then open http://127.0.0.1:8090. On the VPS itself, curl -s http://127.0.0.1:8090/healthz (expects {"ok": true, "prompts": 3157, "ollama": true, ...}) and the CLI helper /usr/local/bin/prompts-ask.
Files and units¶
| Path | Role |
|---|---|
/opt/prompts-chat/app.py |
Single-page UI + JSON API (/, /healthz, /api/prompts, /api/prompts/<id>, /api/models, /api/chat, /api/run) |
/opt/prompts-chat/data/prompts.csv |
3,157 prompts, loaded into memory at startup |
/etc/default/prompts-chat |
Bind, CSV path, Ollama URL, qwen3:4b, NUM_CTX=8192, MAX_SYSTEM_CHARS=16000, OLLAMA_TIMEOUT=600, NO_THINK_TAG=/no_think |
/etc/systemd/system/prompts-chat.service |
Runs as user/group promptschat; MemoryHigh=200M, MemoryMax=256M, CPUQuota=50%, TasksMax=64; network locked to loopback |
prompts-chat-update.service / .timer |
Weekly refresh of prompts.csv from GitHub (Sundays 04:30 UTC + up to 30 minutes, Persistent=true) |
/usr/local/sbin/prompts-chat-update |
Updater invoked by the oneshot unit. Sanitized copy: config/vps/usr/local/sbin/prompts-chat-update |
/usr/local/bin/prompts-ask |
Local CLI wrapper on the VPS. Sanitized copy: config/vps/usr/local/bin/prompts-ask |
Security model¶
- Listen address is loopback only.
tailscale serveis the only published path, and only ontailscale0. - The service user cannot make outbound internet connections (
IPAddressDeny=any,IPAddressAllow=localhost). The weekly CSV fetch runs in a separate oneshot unit. - Additional hardening:
NoNewPrivileges, emptyCapabilityBoundingSet,ProtectSystem=strict,ProtectHome,PrivateTmp,PrivateDevices,MemoryDenyWriteExecute,RestrictNamespaces,SystemCallFilter=@system-service,UMask=0077. - Responses set
X-Content-Type-Options: nosniff,X-Frame-Options: DENY,Referrer-Policy: no-referrer,Cache-Control: no-store, and a strictContent-Security-Policy. - Access is gated by Tailnet membership and Tailscale ACLs. There is no separate app login, because the service is unreachable outside the tailnet. Request bodies are capped at 512 KiB; system prompts at 16,000 characters.
- Domain-Admin verified from linux-01 over the public hostname that port 8090 times out, while a tailnet request with
Host: goc-vps:8090returns 200.
Updates and monitoring¶
Refresh the CSV now with systemctl start prompts-chat-update.service (the script fetches prompts.csv from willyd61/awesome-chatgpt-prompts on main, refuses to install fewer than 100 valid rows, keeps prompts.csv.prev, and restarts the app). You can also run /usr/local/sbin/prompts-chat-update directly, or /usr/local/sbin/prompts-chat-update --rollback to restore the previous CSV. Check the next run with systemctl list-timers prompts-chat-update.timer. After editing /etc/default/prompts-chat, restart prompts-chat.
CLI examples on the VPS (/usr/local/bin/prompts-ask, talks to http://127.0.0.1:8090 unless PROMPTS_URL is set):
node_exporter tracks prompts-chat.service. linux-01 fires VPSPromptsChatDown (unit not active for 5m) and VPSPromptsChatMetricMissing (state absent for 15m). Details are on the monitoring page.
RAM impact¶
Measured on 24 Nov 2026:
- Before load: 2,092 MiB used, 4,436 MiB free, 5,848 MiB available, 0 MiB swap used.
- Peak after a test chat with
qwen3:4bloaded: 6,303 MiB used, 187 MiB free, 1,637 MiB available, 1,548 MiB swap used. - Steady-state idle (after
OLLAMA_KEEP_ALIVE=5munloads the model): about 2.7 GiB used, 5.1 GiB available, 9.2 MiB swap used.prompts-chat.serviceitself stays around 47.3 MiB RSS (peak 47.8 MiB).
Rollback¶
See the runbook. In short: turn off tailscale serve on port 8090, disable the units, remove /opt/prompts-chat and the unit/default files, delete the promptschat user, restore the node-exporter defaults from /root/config-backups/prompts-2026-11-24/, and drop the VPSPromptsChat* rules on linux-01.
A pre-change backup lives at /root/config-backups/prompts-2026-11-24/ on the VPS (v1 of app.py and the defaults, tailscale-serve-before.json, ufw-before.txt, and the before/after free snapshots).