freedzhost.cloud

Homelab 10: notifications from your servers and agents, on your phone

Level BeginnerEstimated time 30 minRead first Homelab 2: one HTTPS entrance for all your servicesA word you don't know? Glossary

A homelab that works in silence is a homelab whose failures you discover weeks later. ntfy is a tiny open-source notification server: any script publishes a line with curl, and your phone shows it. Ours tells us when an agent run ends or fails, and when an agent waits for a human decision.

Backupscurl -d …AgentsMonitoringntfydeny-all, accountsYour phonentfy appsubscribes
Servers, backups and agents publish one line to a topic; your phone subscribes. With anonymous access denied, only accounts you created can publish or read.

1. Run it, closed by default

Run the official image, publish it through your HTTPS proxy, and close anonymous access in its configuration:

auth-file: "/var/lib/ntfy/user.db"
auth-default-access: "deny-all"

Then create accounts and give each one only the topics it needs:

ntfy user add --role=admin you
ntfy user add backups
ntfy access backups nightly rw

2. Publish from anywhere

curl -u backups:… -d "Nightly copy: OK, 33 GB" https://ntfy.yourdomain.tld/nightly

Add a priority for failures (-H "Priority: urgent") so they ring even in silent mode, and keep the successes quiet.

3. Subscribe on the phone

Install the ntfy app, add your server and your account, subscribe to the topics. On iPhone, instant delivery needs the server to relay through the public ntfy service: set upstream-base-url: "https://ntfy.sh", otherwise notifications arrive late.

Traps

Without accounts, the topic name is the only password: anyone who guesses it can read your alerts and send you fake ones. Deny anonymous access, or at the very least use long random topic names.

Notify on failures and on decisions waiting for you; summarise the rest. A phone that buzzes for every success is a phone you stop reading.

Encode non-ASCII titles properly (the Title header is an HTTP header): accents in a raw header can arrive garbled.

Sources

Found this useful? Tell us what to measure next.