Skip to content

Operations and runbook

Run on the VPS as root unless noted. Always keep one SSH session open while changing SSH, PAM or firewall settings, and test a new session before closing it.

Daily / health checks

systemctl is-active ollama prompts-chat nginx fail2ban ssh tailscaled prometheus-node-exporter
ollama ps; free -h; swapon --show
fail2ban-client status sshd
ipset list geo-ssh-allow4 -t | grep entries
tail -5 /var/log/ssh-login-ntfy.log
ls /var/run/reboot-required 2>/dev/null && echo "reboot needed"

From linux-01: up{job="vps-node"}, node_systemd_unit_state{job="vps-node",state="active"}, goc_* metrics in Prometheus/Grafana.

Ollama

Task Command
Status / logs systemctl status ollama, journalctl -u ollama -n 50
Restart systemctl restart ollama
Unload model now ollama stop qwen3:4b
Change env/limits edit /etc/systemd/system/ollama.service.d/override.conf, systemctl daemon-reload && systemctl restart ollama
Update Ollama re-run the official installer (review it first), then re-check ss -tlnp \| grep 11434 shows 127.0.0.1
Rollback / remove systemctl disable --now ollama; rm -rf /etc/systemd/system/ollama.service.d /etc/systemd/system/ollama.service /usr/local/bin/ollama /usr/local/lib/ollama /usr/share/ollama; userdel ollama; systemctl daemon-reload and remove /etc/prometheus/rules/vps-ollama.yml on linux-01

If VPSSwapHeavy fires: the model or context is too big. Lower OLLAMA_CONTEXT_LENGTH, shorten OLLAMA_KEEP_ALIVE, or use a smaller model.

Swap

Rollback: swapoff /swapfile && rm /swapfile, delete the fstab line and /etc/sysctl.d/99-swappiness.conf, sysctl --system.

SSH

Task Command
Show effective settings sshd -T \| grep -Ei 'permitrootlogin\|passwordauth'
Turn password login off (key-only) set PasswordAuthentication no and KbdInteractiveAuthentication no in /etc/ssh/sshd_config.d/01-hardening.conf, sshd -t && systemctl reload ssh
Rollback rm /etc/ssh/sshd_config.d/01-hardening.conf && sshd -t && systemctl reload ssh (back to cloud-init defaults: root password login allowed), or restore .../followup/ssh/

SSH login alerts (ntfy)

Task How
Test open a new SSH session, then tail -1 /var/log/ssh-login-ntfy.log should show http=200, and the phone should get "SSH login on goc-vps"
Mute temporarily chmod 000 /etc/goc-alerting/ntfy.env (hook exits silently); undo with chmod 600
Change topic/server edit /etc/goc-alerting/ntfy.env (keep 0600)
Remove delete the pam_exec ... ssh-login-ntfy.sh line (and its comment) at the end of /etc/pam.d/sshd, then rm /usr/local/sbin/ssh-login-ntfy.sh; or restore .../followup/pam.d/sshd

The hook is optional and runs in the background with a 10 s timeout, so it can't block or slow a login. Every session alerts, including automation and agent sessions.

fail2ban

Task Command
Status fail2ban-client status, fail2ban-client status sshd, fail2ban-client status recidive
Unban an IP fail2ban-client set sshd unbanip <IP> (and set recidive unbanip <IP>), or fail2ban-client unban <IP> for all jails
Ban manually fail2ban-client set sshd banip <IP>
Add a never-ban IP append to ignoreip in /etc/fail2ban/jail.local, fail2ban-client -t && systemctl restart fail2ban
Home IP changed replace <HOME_IP> in jail.local and in STATIC4 of geoip-ssh-sets.sh (see below)
Logs /var/log/fail2ban.log
Rollback apt-get purge fail2ban (removes its INPUT rule and ipsets on stop)

SSH geo-block

Task Command
Is an IP allowed? ipset test geo-ssh-allow4 <IP>
Set sizes ipset list geo-ssh-allow4 -t; ipset list geo-ssh-allow6 -t
Drops so far iptables -vnL ufw-before-input \| grep geo-ssh
Allow one extra IP now (temporary) ipset add geo-ssh-allow4 <IP> (lost at next load/refresh)
Allow an IP permanently add it to STATIC4 (or STATIC6) in /usr/local/sbin/geoip-ssh-sets.sh, then /usr/local/sbin/geoip-ssh-sets.sh load
Refresh ranges now systemctl start geoip-ssh-update.service; journalctl -t geoip-ssh -n 5
Next refresh systemctl list-timers geoip-ssh-update.timer (Sundays 04:30 UTC = Sat 11:30 PM ET, +0-30 min)
Turn off (rollback) /root/geo-ssh-revert.sh (restores original before*.rules, reloads ufw). Then optionally systemctl disable --now geoip-ssh-update.timer geoip-ssh-sets.service

Travelling abroad: connect over Tailscale (tailscale0 is exempt), or use the Hostinger web console. Locked out entirely: Hostinger hPanel > VPS > Browser terminal, then run /root/geo-ssh-revert.sh.

Security metrics exporter

systemctl status goc-vps-sec-metrics.timer; output /var/lib/prometheus/node-exporter/goc_vps_security.prom. Remove: systemctl disable --now goc-vps-sec-metrics.timer, delete the script, units and .prom file.

node_exporter systemd collector

Change the unit list in /etc/default/prometheus-node-exporter, systemctl restart prometheus-node-exporter. Rollback: copy back .../monitoring-ext/prometheus-node-exporter (or .../prometheus-node-exporter for the pre-systemd version).

linux-01 alert rules

/etc/prometheus/rules/vps-ollama.yml. Rollback: rm it, promtool check config /etc/prometheus/prometheus.yml && systemctl reload prometheus.

Kernel updates / reboot

Check ls /var/run/reboot-required. Reboot with systemctl reboot; sites are down ~1 minute. Afterwards verify: uname -r, services above, both sites 200, ufw status verbose unchanged, iptables -S ufw-before-input | grep geo-ssh, SSH login alert fires.

Prompts library (prompts.chat)

Task Command / Action
Status / logs systemctl status prompts-chat, journalctl -u prompts-chat -n 50
Restart systemctl restart prompts-chat
Health check (VPS) curl -s http://127.0.0.1:8090/healthz (expects {"ok": true, "prompts": 3157, "ollama": true, ...})
Web UI (tailnet device) Open http://goc-vps:8090 or http://goc-vps.<TAILNET>.ts.net:8090
Test from host with local DNS override (e.g. linux-01) curl -H "Host: goc-vps:8090" http://<VPS_TAILSCALE_IP>:8090/healthz
SSH tunnel fallback ssh -L 8090:127.0.0.1:8090 root@<VPS_PUBLIC_IP> then open http://127.0.0.1:8090
CLI helper (VPS) /usr/local/bin/prompts-ask (e.g. prompts-ask --search "linux", prompts-ask --show "Linux Terminal", prompts-ask "Linux Terminal" "pwd"). Sanitized copy: config/vps/usr/local/bin/prompts-ask
Refresh prompts.csv now systemctl start prompts-chat-update.service or /usr/local/sbin/prompts-chat-update (restores previous with --rollback). Sanitized copy: config/vps/usr/local/sbin/prompts-chat-update
Next scheduled CSV refresh systemctl list-timers prompts-chat-update.timer
Tune model / NUM_CTX / NO_THINK_TAG Edit /etc/default/prompts-chat, then systemctl restart prompts-chat
Inspect / (re)publish Tailscale Serve tailscale serve status. The live command is tailscale serve --bg --http=8090 http://127.0.0.1:8090. Notes and sanitized status: config/vps/usr/local/tailscale-serve.md
Rollback / remove tailscale serve --http=8090 off (or tailscale serve reset if nothing else uses serve), systemctl disable --now prompts-chat prompts-chat-update.timer, rm -rf /opt/prompts-chat /etc/default/prompts-chat /etc/systemd/system/prompts-chat*.{service,timer} /usr/local/sbin/prompts-chat-update /usr/local/bin/prompts-ask, userdel promptschat, systemctl daemon-reload, restore .../prompts-2026-11-24/prometheus-node-exporter.default.bak and remove the VPSPromptsChat* rules from /etc/prometheus/rules/vps-ollama.yml on linux-01

Rollback reference

Piece Undo
Ollama see Ollama
Swap see Swap
SSH drop-in rm /etc/ssh/sshd_config.d/01-hardening.conf, sshd -t, reload
Login alerts remove PAM line + script
fail2ban apt-get purge fail2ban
Geo-block /root/geo-ssh-revert.sh
Monitoring remove rule file on linux-01; restore node-exporter defaults; disable metrics timer
Prompts library see Prompts library
jconover restore from .../followup/jconover-home.tgz + passwd/group entries + sudoers copy (not recommended)
Updates not reversible in place; use Hostinger snapshot if ever needed