Physical Address
Metro Manila, Philippines
Physical Address
Metro Manila, Philippines
The NTFY generally stands for “Notify”, a 100% free or opensource and created by Phillipp Heckel. REST-API-based publish-subscribe notification service (using simple HTTP PUT or POST requests) ; a utility that lets you send push notifications to your mobile phone or desktop via scripts from any computer.
It supports shell integration with popular Linux shells such as bash and zsh; It also offers features for process, emjoi, XMPP, Telegram, Instapush and Slack notification support.
Lets assumed that you have already installed and running Docker service in your system.
● Host network
Executing the command line below will create a container for ntfy that uses host network:
docker run -d --name=ntfy --restart=always --network=host \ -v /opt/ntfy/cache:/var/cache/ntfy \ binwiederhier/ntfy serve --cache-file /var/cache/ntfy/cache.db
● User-defined bridge network
User-defined bridge network can be used for listening on different port using -p option
docker network create app-net docker run -d --name=ntfy --restart=always --network=app-net \ -p 8089:80 \ -v /opt/ntfy/cache:/var/cache/ntfy \ binwiederhier/ntfy serve --cache-file /var/cache/ntfy/cache.db
● Using docker-compose with non-root user and healthchecks enabled:
version: "2.3" services: ntfy: image: binwiederhier/ntfy container_name: ntfy command: - serve environment: - TZ=UTC # optional: set desired timezone user: UID:GID # optional: replace with your own user/group or uid/gid volumes: - /var/cache/ntfy:/var/cache/ntfy - /etc/ntfy:/etc/ntfy ports: - 8089:80 healthcheck: # optional: remember to adapt the host:port to your environment test: ["CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"] interval: 60s timeout: 10s retries: 3 start_period: 40s restart: unless-stopped
If using a non-root user when running the docker version, be sure to chown the server.yml, user.db, and cache.db files and attachments directory to the same uid/gid.
Alternatively, you may wish to build a customized Docker image that can be run with fewer command-line arguments and without delivering the configuration file separately.
FROM binwiederhier/ntfy COPY server.yml /etc/ntfy/server.yml ENTRYPOINT ["ntfy", "serve"]
To access web UI, open a web browser and go to http://<HOST_IP_ADDRESS>:<PORT>
Once you have accessed the url and done the basic configuration based on the sample screenshot above, you may now publish topic or test message notification using sample scripts below (curl and php).
curl \ -d "HELLOWORLD PINOYLINUX.ORG" \ https://localhost:8089/RockITPinoyNotifications
file_get_contents('https://localhost:8089/RockITPinoyNotifications', false, stream_context_create([ 'http' => [ 'method' => 'POST', // PUT also works 'header' => 'Content-Type: text/plain\r\n' . 'content' => 'HELLOWORLD PINOYLINUX.ORG' ] ]));
rsync -rvapl --numeric-ids --progress ad***@pi********.org/home/admin/* . \
&& zfs snapshot ... \
&& curl -H prio:low -d "Server backup succeeded" ntfy.sh/adminfolderbackups \
|| curl -H tags:warning -H prio:high -d "Server backup failed" ntfy.sh/adminfolderbackups
Uninstall NTFY
To completely remove ntfy, remove its container:
docker rm --force ntfy
docker rmi binwiederhier/ntfy
sudo rm -rf /opt/ntfy
docker network rm app-net