Get AI summaries of any video or article — Sign up free
how did I NOT know about this? thumbnail

how did I NOT know about this?

NetworkChuck·
5 min read

Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

ntfy turns terminal workflows into real-time push alerts by running as a self-hosted Docker container.

Briefing

Push notifications stop being “something for apps” and turn into a practical automation layer once ntfy is set up as a self-hosted notification server. The core payoff: long-running tasks—Nmap scans, large file downloads, package installs, backups, even server reboots—can trigger instant alerts to a phone (and more), so waiting becomes optional.

The walkthrough starts with the simplest mental model: ntfy runs as a Docker container, whether it’s hosted in the cloud, on a home Linux machine, or even on a Raspberry Pi. For cloud hosting, a virtual machine is provisioned quickly (the example uses Anode, with Ubuntu 20.04), then Docker is installed and the ntfy container is launched on port 80. For on-prem setups, the steps are essentially the same as long as the host is Linux-based. After the container is running, the ntfy web interface becomes reachable via the server’s public address (cloud) or local IP (home).

A key distinction follows: cloud instances are publicly accessible, but home servers usually aren’t. To make a home ntfy endpoint reachable from anywhere without opening router ports, the guide uses Cloudflare tunnels. A Cloudflare Zero Trust tunnel is created, a subdomain is mapped to the home machine’s internal IP, and the tunnel runs via a Docker command generated by Cloudflare—so the home ntfy service can be called from the internet securely.

With the server reachable, the next step is installing the ntfy mobile app on Android or iPhone and pointing it at the chosen ntfy server. Notifications are organized by “topics” (for example, a topic named “coffee”). Subscribing to a topic is done in the app, and messages are sent from any terminal using curl by POSTing a message to the topic endpoint (e.g., sending “Hey, the coffee is ready” to /coffee). The web interface also shows topic subscriptions and delivered messages, and the system supports access controls so not everyone can subscribe.

iPhone push delivery needs an extra configuration tweak. The container is stopped, an ntfy server.yml configuration file is created, and the base URL is set to the correct server address. Then an “upstream base URL” setting is adjusted to work around iOS’s quirks: iOS receives only message IDs and pulls the content from the user’s own ntfy server, enabling reliable push notifications.

Once notifications work, the use cases expand fast. Command output can be captured into variables and sent when a command finishes (including Nmap results). Conditional alerts are demonstrated with shell logic using success/failure operators around ping checks—sending “it’s up” or “it’s down” depending on reachability. Scheduling can be handled either by Linux cron/systemd or by ntfy’s built-in scheduling syntax (e.g., “in 10 seconds” or “next Tuesday”). The guide also shows monitoring-style patterns: repeatedly pinging a host until it returns after downtime, adding emojis to alerts, and integrating with Uptime Kuma via ntfy as a notification target. Finally, it’s applied to battery monitoring using a PowerShell script that triggers an ntfy message when battery drops below a threshold.

The result is a flexible, self-hostable notification system that turns routine automation and troubleshooting into something you can track in real time—without babysitting terminals.

Cornell Notes

ntfy is a free, open-source, self-hostable notification server that turns command-line and automation workflows into instant push alerts. It runs as a Docker container, so the setup is similar across cloud VMs, home Linux machines, and Raspberry Pi. After installing the ntfy app on Android or iPhone and subscribing to a topic (like “coffee”), messages can be sent from any terminal using curl to the topic endpoint. Cloud deployments are publicly reachable, while home deployments typically require Cloudflare tunnels to expose ntfy securely. iPhone push notifications require a server.yml configuration change (including an upstream base URL) to work around iOS delivery behavior.

Why does ntfy change the way people handle long-running tasks like scans or downloads?

Because it lets those tasks trigger push notifications when they finish or when conditions change. The workflow shown uses a terminal command (curl) to send a message to a topic, and the phone app receives it immediately. That means someone can start an Nmap scan, file transfer, or install, then do other work (like making coffee) and get notified when the job completes.

How does the setup stay consistent across cloud, home, and Raspberry Pi?

Both hosting approaches rely on Docker. The guide installs Docker on the Linux host, then runs an ntfy container with port 80 exposed. After the container starts, the ntfy web interface is reachable via the server’s address. The same core container command pattern applies whether the host is a cloud VM or an on-prem Linux machine.

What’s the practical difference between hosting ntfy in the cloud versus at home?

Cloud instances are publicly accessible, so the ntfy endpoint can be reached from anywhere. Home instances are usually not, so the guide uses Cloudflare tunnels to expose the service securely without opening router ports. A tunnel maps a subdomain to the home machine’s internal IP, letting external clients reach ntfy through Cloudflare.

How are notifications organized and sent using ntfy topics?

Clients subscribe to topics in the ntfy app (e.g., a topic named “coffee”). Messages are sent by posting to the topic endpoint using curl. The example uses curl with a POST body like “Hey, the coffee is ready” and targets the topic via the URL path /coffee, which routes the message to subscribers of that topic.

What extra step is needed for iPhone push notifications to work reliably?

A configuration change in server.yml. After stopping the container, the guide creates /etc/ntfy/server.yml, sets base URL to the user’s ntfy server address, and modifies the upstream base URL to ntfy.sh. This workaround helps iOS delivery by having iOS pull the message content from the user’s own server using the message ID, rather than relying on direct delivery behavior.

What kinds of automation triggers can send ntfy messages beyond simple “task finished” alerts?

Anything that can run in a shell or script. The guide demonstrates conditional notifications using ping success/failure logic (sending “it’s up” or “it’s down”), sending command output (like Nmap results) by capturing it into variables, scheduling messages with ntfy’s natural-language scheduling (e.g., “in 10 seconds”), and integrating with monitoring tools like Uptime Kuma by selecting ntfy as the notification method.

Review Questions

  1. How would you expose a home-hosted ntfy server to the internet without opening router ports, and what component provides that capability?
  2. Describe the role of topics in ntfy and show how a curl command would target a specific topic.
  3. What configuration change is made to improve iPhone push notification reliability, and why is an upstream base URL involved?

Key Points

  1. 1

    ntfy turns terminal workflows into real-time push alerts by running as a self-hosted Docker container.

  2. 2

    Cloud hosting is straightforward because the server is publicly reachable; home hosting typically needs Cloudflare tunnels to be accessible externally.

  3. 3

    Mobile clients subscribe to named topics, and messages are sent to those topics using curl.

  4. 4

    iPhone push notifications require a server.yml adjustment, including setting an upstream base URL to ntfy.sh, to work around iOS delivery behavior.

  5. 5

    ntfy can send notification content from command output, not just fixed messages, enabling alerts for scan results and script outcomes.

  6. 6

    Conditional logic (success vs failure) around commands like ping can drive “up/down” notifications automatically.

  7. 7

    Scheduling can be handled either by system schedulers (cron/Windows Task Scheduler) or by ntfy’s built-in natural-language scheduling.

Highlights

ntfy can be deployed in minutes using Docker, with the same container-based approach for cloud VMs and home Linux machines.
Cloudflare tunnels provide a secure way to expose a home ntfy server without opening router ports.
A single curl POST to a topic endpoint can deliver push notifications to subscribed phones.
iPhone reliability improves after editing /etc/ntfy/server.yml and adjusting the upstream base URL to ntfy.sh.
ntfy supports automation patterns like conditional alerts, scheduled messages, and integrations such as Uptime Kuma.

Topics

  • Self-Hosted Notifications
  • Docker Setup
  • Cloudflare Tunnels
  • iOS Push
  • Command Automation

Mentioned