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.
📺 Video Demo & Tutorial
Section titled “📺 Video Demo & Tutorial”The demo and Installation Guide you will find in this article and also in my YouTube video here:
What is NTFY.sh?
Section titled “What is NTFY.sh?”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.
Key Features
Section titled “Key Features”- 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.
Why Use NTFY.sh?
Section titled “Why Use NTFY.sh?”- 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.
Top Use Cases for NTFY.sh
Section titled “Top Use Cases for NTFY.sh”- 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.
- IoT and Smart Home: Receive alerts when your smart doorbell detects motion or the temperature in your greenhouse exceeds a threshold.
- Personal Productivity: Schedule reminders for meetings, deadlines, or get updates on the status of long-running scripts.
Installation Guide (Docker)
Section titled “Installation Guide (Docker)”To start the installation we will need a VPS. In our tutorial, we will be using ZONE.EU.
1. Update and Install Docker
Section titled “1. Update and Install Docker”First, become root and update your repositories:
sudo suapt-get update && apt-get upgrade -yInstall required certificates and add Docker’s repository keys:
sudo apt-get install ca-certificates curl -ysudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascInstall Docker and Docker Compose:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-pluginapt-get install docker-compose -y2. Docker Network and Nginx Proxy
Section titled “2. Docker Network and Nginx Proxy”Create a network for your containers:
docker network create valtersitNote: For the full Nginx Reverse Proxy and Portainer setup commands, refer to the video guide or the GitHub repository.
3. Deploy NTFY with Docker Compose
Section titled “3. Deploy NTFY with Docker Compose”Create a directory and your docker-compose.yml file:
mkdir -p /srv/docker/startupcd /srv/docker/startupnano docker-compose.ymlExample 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: trueStart the container:
docker-compose up -d4. 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:
docker exec -it ntfy.valtersit.com shntfy user add --role admin valtersitntfy token add valtersitSend your first test message via CURL:
curl -u :tk_your_token_here -d "This is a test demo for valtersit" https://ntfy.valtersit.com/valtersitConclusion
Section titled “Conclusion”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.