Skip to content

Revolutionizing Notifications with NTFY.sh

By: Hugo Valters

In today’s fast-paced digital world, effective communication is the backbone of productivity and success. Whether you’re managing a complex DevSecOps pipeline, running a small business, or organizing personal tasks, timely and efficient notifications are critical.

Enter NTFY.sh, a lightweight, open-source notification tool that offers simplicity, flexibility, and power.


The demo and Installation Guide you will find in this article and also in my YouTube video here:


NTFY.sh is a simple, HTTP-based notification service that allows you to send and receive notifications via REST API, Python, CURL or command-line tools. Think of it as a highly customizable and platform-independent tool for managing alerts and updates, without the overhead of more complex notification systems.

  • Easy-to-use HTTP API: Send notifications with a single command or HTTP request.
  • Cross-platform compatibility: Works on Windows, Linux, macOS, and mobile devices.
  • Self-hosting capability: Secure your data by running NTFY.sh on your own server.
  • Integration-ready: Works with tools like Docker, Home Assistant, and shell scripts.
  • 1. Minimal Setup: With no heavy dependencies or complex configurations, NTFY.sh can be up and running in minutes.
  • 2. Versatile Applications: From alerting you about a failing server to reminding you about your next coffee break, NTFY.sh’s applications are virtually endless.
  • 3. Privacy and Security: For sensitive environments, the option to self-host NTFY.sh ensures complete control over your data.
  • 4. Cost-Effective: Being open-source, it eliminates the licensing costs associated with commercial notification systems.
  1. DevOps and Monitoring Alerts: Notify team members about failing builds in a CI/CD pipeline or alert admins about anomalies detected by tools like Prometheus, Zabbix or Nagios.
  2. IoT and Smart Home: Receive alerts when your smart doorbell detects motion or the temperature in your greenhouse exceeds a threshold.
  3. Personal Productivity: Schedule reminders for meetings, deadlines, or get updates on the status of long-running scripts.

To start the installation we will need a VPS. In our tutorial, we will be using ZONE.EU.

First, become root and update your repositories:

Terminal window
sudo su
apt-get update && apt-get upgrade -y

Install required certificates and add Docker’s repository keys:

Terminal window
sudo apt-get install ca-certificates curl -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Install Docker and Docker Compose:

Terminal window
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
apt-get install docker-compose -y

Create a network for your containers:

Terminal window
docker network create valtersit

Note: For the full Nginx Reverse Proxy and Portainer setup commands, refer to the video guide or the GitHub repository.

Create a directory and your docker-compose.yml file:

Terminal window
mkdir -p /srv/docker/startup
cd /srv/docker/startup
nano docker-compose.yml

Example config for NTFY:

version: '3.8'
services:
ntfy:
hostname: ntfy.valtersit.com
image: binwiederhier/ntfy
container_name: ntfy.valtersit.com
command: serve
environment:
- TZ=UTC
- VIRTUAL_HOST=ntfy.valtersit.com
- LETSENCRYPT_EMAIL=myssl@valtersit.eu
- LETSENCRYPT_HOST=ntfy.valtersit.com
- NTFY_BASE_URL=https://ntfy.valtersit.com
- NTFY_AUTH_DEFAULT_ACCESS=deny-all
- NTFY_BEHIND_PROXY=true
- NTFY_ENABLE_LOGIN=true
volumes:
- /srv/docker/ntfy/cache:/var/cache/ntfy
- /srv/docker/ntfy/config:/etc/ntfy
- /srv/docker/ntfy/lib/:/var/lib/ntfy/
ports:
- 838:80
- 438:443
restart: unless-stopped
networks:
- valtersit
networks:
valtersit:
external: true

Start the container:

Terminal window
docker-compose up -d

4. Setup Authentication and Send a Message

Section titled “4. Setup Authentication and Send a Message”

Enter the container to create an admin user and a token:

Terminal window
docker exec -it ntfy.valtersit.com sh
ntfy user add --role admin valtersit
ntfy token add valtersit

Send your first test message via CURL:

Terminal window
curl -u :tk_your_token_here -d "This is a test demo for valtersit" https://ntfy.valtersit.com/valtersit

NTFY is a great simple tool in your day-to-day life as an IT expert. Over one year of NTFY usage, I have saved my time and I’m pretty happy with how it works and delivers me the important things.

Follow me on X (Twitter): https://x.com/HugoValters.