Discord webhooks are how lots of people get push notifications from their residence servers. Nonetheless, in case you discover it too laggy or if it is too messy to get all of your server notifications on a single channel, there’s a fair easier method. This device permits you to push notifications to your cellphone with a single curl command.
What’s Ntfy
A intelligent service that immediately pushes notifications to as many gadgets as you need
Ntfy is a free and open-source easy push notification service you can self-host in your server. It accepts HTTPS requests and immediately pushes them to any system that is linked to your self-hosted Ntfy server. You may embrace easy curl instructions in scripts or cron jobs to obtain push notifications.
You’ll be able to push notifications by “matter.” Mainly, Ntfy permits you to kind and set up notifications into totally different channels. You may, for instance, create a channel for uptime alerts and one other for backups. Then you might “subscribe” to both or each of these subjects in your cellphone or pill to get push notifications.
It is a fairly light-weight setup as a result of it barely consumes any sources, so you possibly can run it on something that may spin up a Docker container. To obtain push notifications, you possibly can obtain the Ntfy app on Android or iOS gadgets. You’ll be able to even get desktop notifications through the browser app (accessible through the server handle).
How you can arrange the server
You simply want Docker
The only and most sensible method to arrange Ntfy on a server is thru the official Ntfy Docker picture. If you happen to do not have already got Docker put in in your server, you should use the official Bash script to put in it.
curl -fsSL https://get.docker.com | sudo sh
It is at all times a good suggestion to double-check scripts downloaded from the web earlier than working them. You’ll be able to learn the contents of that shell script by visiting the URL or use cat to print its contents.
Model
Raspberry Pi
Storage
8GB
CPU
Cortex A7
Reminiscence
8GB
Working System
Raspbian
Ports
4 USB-A
It is solely beneficial for tech-savvy customers, however the Raspberry Pi 5 is a tinkerer’s dream. Low cost, extremely customizable, and with nice onboard specs, it is a stable base on your subsequent mini PC.
With Docker put in, we are able to now use a Docker compose file to spin up a light-weight Ntfy container. Let’s create a brand new listing to maintain the Ntfy container and its compose file.
mkdir -p ntfy/{config,cache,information}
Let’s create a compose file.
nano docker-compose.yml
Paste this within the compose file. After that, press Ctrl+O and Enter to reserve it. Then Ctrl+X to exit the nano editor.
companies:
ntfy:
picture: binwiederhier/ntfy
container_name: ntfy
command: serve
atmosphere:
– NTFY_BASE_URL=http://192.168.1.50:9000
– NTFY_LISTEN_HTTP=:80
– NTFY_CACHE_FILE=/var/cache/ntfy/cache.db
– NTFY_AUTH_FILE=/and many others/ntfy/auth.db
– NTFY_AUTH_DEFAULT_ACCESS=deny-all
volumes:
– ./cache:/var/cache/ntfy
– ./config:/and many others/ntfy
ports:
– “9000:80”
restart: unless-stopped
We are able to now begin the container with this command.
docker compose up -d
Confirm that the container is working, and working on the appropriate port.
docker ps
Technically, you do not want a Docker container to arrange Ntfy. It may be put in as a easy APT package deal that runs as a systemd service (so it’s going to robotically begin as quickly because the server boots up). Nonetheless, it may possibly get messy in case you plan to maneuver it between servers, or run into dependency points. Docker containers are straightforward emigrate and straightforward to wipe, and you will not run into dependency points.
How you can get Ntfy notifications in your cellphone
Set up the app and hook up with your server
Mainly, you simply want the Ntfy app and the URL for accessing the Ntfy occasion working in your private server. You’ll be able to obtain Ntfy from F-Droid or Google Play Retailer for Android and the App Retailer for iOS.
Launch the app and faucet the three dots on the prime to open the settings menu. Scroll right down to common settings and faucet Default server. The handle ought to look one thing like this. The port is what you selected when creating the Docker container for the Ntfy server.
http://192.168.1.50:9000
Then hit Save.
Now you can subscribe to as many “subjects” or notification channels coming from the server. Faucet the plus button on the backside. You may see a “Subscribe to matter” window. The subject title is the handle you will push notifications to out of your server. Sort it and hit Subscribe.
Since all that is being achieved over an HTTP connection, choose a singular matter title that is exhausting to guess as a result of it’s going to double as your password. If you happen to choose one thing widespread like “alerts,” anybody linked to your Wi-Fi community might technically pull notifications out of your server by subscribing to the identical matter.
It ought to hook up with the server instantly and present a notification chain on the principle menu.
If you happen to see any errors, be sure you sort the appropriate server IP and port handle. Additionally be sure you’re linked to the identical Wi-Fi community because the server. You’ll be able to arrange a reverse proxy or a personal community like Tailscale if you wish to entry your notifications outdoors your house Wi-Fi community.
Let’s take a look at our new setup.
In your server, use a curl command to push a notification to the channel you chose.
curl -d “It is a take a look at alert from my server” http://192.168.1.50:9000/jelly_alerts
The notification ought to immediately present up within the notification thread, in addition to your cellphone’s notification shade.
Some professional suggestions
You’ll be able to set precedence alerts and even ship file attachments
There’s little use in manually pushing these notifications, however you will most likely wish to embrace these curl calls inside your scripts. For instance, I’ve arrange a script that makes use of the Asana API to ship me alerts. You’ll be able to arrange a channel for as many scripts as you need. You can even set the precedence of the push notifications with these flags.
curl
-H “Title: Emergency”
-H “Precedence: excessive”
-d “Fast consideration wanted”
http://192.168.1.50:9000/jelly_alerts
Then configure the notification precedence for Ntfy inside the app settings. You can even connect native recordsdata or obtain URLs with the push notifications.
Light-weight and straightforward push notifications
If you happen to’re in search of a easy and light-weight method to push notifications on your backups, API calls, scripts, or uptime monitoring alerts, it does not get easier than the fundamental curl syntax that Ntfy makes use of.

