Prevent the use of Discord for homelab notifications—here is what I switched to as an alternative

person holding a smartphone with the ntfy sh logo in the background and notifications appearing on t.png


Discord webhooks are how numerous other folks get push notifications from their house servers. Alternatively, when you in finding it too laggy or if it is too messy to get all of your server notifications on a unmarried channel, there may be a fair more practical method. This software permits you to push notifications for your telephone with a unmarried curl command.

What’s Ntfy

A artful provider that immediately pushes notifications to as many units as you need

Ntfy is a loose and open-source easy push notification provider that you’ll self-host in your server. It accepts HTTPS requests and immediately pushes them to any instrument that is attached for your self-hosted Ntfy server. You must come with easy curl instructions in scripts or cron jobs to obtain push notifications.

You’ll be able to push notifications through “subject.” Mainly, Ntfy permits you to type and arrange notifications into other channels. You must, as an example, create a channel for uptime signals and every other for backups. Then you might want to “subscribe” to both or either one of the ones subjects in your telephone or pill to get push notifications.

Receiving a push notification from my home server on my Android phone.

It is a beautiful light-weight setup as it slightly consumes any assets, so you’ll run it on anything else that may spin up a Docker container. To obtain push notifications, you’ll obtain the Ntfy app on Android or iOS units. You’ll be able to even get desktop notifications by means of the browser app (available by means of the server deal with).

Notification received on an iPhone from ntfy.sh.

How you can arrange the server

You simply want Docker

The most straightforward and maximum sensible option to arrange Ntfy on a server is throughout the legitimate Ntfy Docker symbol. If you do not have already got Docker put in in your server, you’ll use the legitimate 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 ahead of operating them. You’ll be able to learn the contents of that shell script through visiting the URL or use cat to print its contents.

raspberry pi 5-1

Logo

Raspberry Pi

Garage

8GB

CPU

Cortex A7

Reminiscence

8GB

Running Machine

Raspbian

Ports

4 USB-A

It is only really useful for tech-savvy customers, however the Raspberry Pi 5 is a tinkerer’s dream. Affordable, extremely customizable, and with nice onboard specifications, it is a cast base to your subsequent mini PC.


With Docker put in, we will be able to now use a Docker compose report to spin up a light-weight Ntfy container. Let’s create a brand new listing to stay the Ntfy container and its compose report.

mkdir -p ntfy/{config,cache,knowledge}

Let’s create a compose report.

nano docker-compose.yml

Paste this within the compose report. After that, press Ctrl+O and Input to put it aside. Then Ctrl+X to go out the nano editor.

products and services:
ntfy:
symbol: binwiederhier/ntfy
container_name: ntfy
command: serve
setting:
- 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 so forth/ntfy/auth.db
- NTFY_AUTH_DEFAULT_ACCESS=deny-all
volumes:
- ./cache:/var/cache/ntfy
- ./config:/and so forth/ntfy
ports:
- "9000:80"
restart: unless-stopped

We will now get started the container with this command.

docker compose up -d

Test that the container is operating, and operating at the proper port.

docker playstation

Technically, you do not want a Docker container to arrange Ntfy. It may be put in as a easy APT bundle that runs as a systemd provider (so it’s going to mechanically get started as quickly because the server boots up). Alternatively, it could actually get messy when you plan to transport it between servers, or run into dependency problems. Docker packing containers are simple emigrate and simple to wipe, and you will not run into dependency problems.

How you can get Ntfy notifications in your telephone

Set up the app and fasten for your server

Mainly, you simply want the Ntfy app and the URL for gaining access to the Ntfy example operating in your non-public server. You’ll be able to obtain Ntfy from F-Droid or Google Play Retailer for Android and the App Retailer for iOS.

Release the app and faucet the 3 dots on the best to open the settings menu. Scroll right down to common settings and faucet Default server. The deal with will have to glance one thing like this. The port is what you selected when growing the Docker container for the Ntfy server.

http://192.168.1.50:9000
Connecting the Ntfy app to my home server.

Then hit Save.

You’ll be able to now subscribe to as many “subjects” or notification channels coming from the server. Faucet the plus button on the backside. You can see a “Subscribe to subject” window. The subject title is the deal with you can push notifications to out of your server. Sort it and hit Subscribe.

Creating a new topic to subscribe to using the Ntfy mobile app.

Since all that is being achieved over an HTTP connection, pick out a novel subject title that is laborious to wager as a result of it’s going to double as your password. For those who pick out one thing not unusual like “signals,” someone attached for your Wi-Fi community may just technically pull notifications out of your server through subscribing to the similar subject.

It will have to hook up with the server immediately and display a notification chain at the major menu.

For those who see any mistakes, make sure to sort the suitable server IP and port deal with. Additionally make sure to’re attached to the similar Wi-Fi community because the server. You’ll be able to arrange a opposite proxy or a non-public community like Tailscale if you wish to get admission to your notifications out of doors your house Wi-Fi community.

Let’s check our new setup.

To your server, use a curl command to push a notification to the channel you decided on.

curl -d "This can be a check alert from my server" http://192.168.1.50:9000/jelly_alerts
Sending a test notification via curl commands.

The notification will have to immediately display up within the notification thread, in addition to your telephone’s notification coloration.

Some professional pointers

You’ll be able to set precedence signals or even ship report attachments

There is little use in manually pushing those notifications, however you can most likely wish to come with those curl calls inside of your scripts. For instance, I have arrange a script that makes use of the Asana API to ship me signals. You’ll be able to arrange a channel for as many scripts as you need. You’ll be able to additionally set the concern of the frenzy notifications with those flags.

curl 
-H "Name: Emergency"
-H "Precedence: top"
-d "Quick consideration wanted"
http://192.168.1.50:9000/jelly_alerts

Then configure the notification precedence for Ntfy inside the app settings. You’ll be able to additionally connect native information or obtain URLs with the frenzy notifications.

Setting notification priority in Ntfy.


Light-weight and simple push notifications

In case you are in search of a easy and light-weight option to push notifications to your backups, API calls, scripts, or uptime tracking signals, it does not get more practical than the fundamental curl syntax that Ntfy makes use of.


Leave a Comment

Your email address will not be published. Required fields are marked *