3.2 KiB
From: https://github.com/binwiederhier/ntfy
ntfy.sh | Send push notifications to your phone or desktop via PUT/POST
ntfy (pronounced "notify") is a simple HTTP-based pub-sub notification service. With ntfy, you can send notifications to your phone or desktop via scripts from any computer, without having to sign up or pay any fees. If you'd like to run your own instance of the service, you can easily do so since ntfy is open source.
You can access the free version of ntfy at ntfy.sh. There is also an open-source Android app available on Google Play or F-Droid, as well as an open source iOS app available on the App Store.
Why does this exist when there's already a FreeBSD sysutils/ntfy pkg/port?
The FreeBSD ntfy client package doesn't have the server or web built-in. It's a basic client only. It's also on version 2.7.0 while the latest release is currently 2.12.0. This repo is to build a full install with client, server, and web running as a ntfy user with startup scripts and configs for client and server.
I built ntfy server on FreeBSD manually and have been testing it. I decided if I was going to keep using it that I should formalize an install.
FreeBSD prerequisites:
I ran out of heap space building on a 2Gb FreeBSD 14.2 VM. It builds great when it was bumped to 4Gb (and more cores).
Install build pre-reqs:
sudo pkg install python311 py311-pip node20 npm-node20 go gmake
Build:
sudo sh ./build_ntfy_server.sh
Install:
sudo sh ./install_ntfy_server.sh
Configure:
Edit your server.yml in /usr/local/etc/ntfy/ to set your hostname, listening IP/port, and any other desired settings. iOS devices require external service for instant push notifcations. Set upstream-base-url: "https://ntfy.sh" in your config to allow push without setting up APNS/Firebase services. See ntfy docs for more configuration options and details.
The nfty server service runs as a unprivileged user and must use a port higher than 1024. Use a webserver or reverse proxy in front of ntfy to provide http/https access.
Copy index.html to your webserver docs directory (e.g. https://ntfy.mydomain.com/docs/) to redirect to the online https://docs.ntfy.sh when a user clicks on the documentation button. Alternatively, you can mirror the online docs to your docs directory if you don't want to rely on theirs.
Use sysrc ntfy_enable="YES" or add ntfy_enable="YES" to your /etc/rc.conf or /etc/rc.conf.d/ntfy manually to enable the service. Use service ntfy start to start the service.
Uninstall:
This will completely remove the binary, configs/scripts, directories, and user. Save your configs/database before running this if you want to preserve them.
sudo sh ./uninstall_ntfy_server.sh
TODO:
I will likely rewrite all of this and create a proper port before it's all said and done. These are the things on my list in the meantime.
- Create dependency checks in install script and make more robust
- Testing client and config.
License
The project is dual licensed under the Apache License 2.0 and the GPLv2 License.
