ntfy.schwenk.online

Self-hosted ntfy push server behind Traefik.

Server setup

docker compose up -d
docker exec -it ntfy.schwenk.online ntfy user add frank --role=admin

Per-host notifications

Each machine posts to a topic derived from its FQDN (hostname -f, lowercased, dots → hyphens). For example, web01.example.com publishes to topic web01-example-com.

  1. Create a user and access token in the web UI at https://ntfy.schwenk.online
  2. Grant that user read-write access to the host topic (e.g. web01-example-com)
  3. Install the command below on the machine, replacing tk_PASTE_YOUR_TOKEN_HERE

Install ntfyschwenkonline on a client

Replace the token, then copy and paste the whole block:

sudo tee /usr/local/bin/ntfyschwenkonline > /dev/null <<'EOF'
#!/bin/sh
set -eu

NTFY_URL="https://ntfy.schwenk.online"
NTFY_TOKEN="tk_PASTE_YOUR_TOKEN_HERE"

topic() {
  hostname -s
}

if [ "$#" -gt 0 ]; then
  message="$*"
elif [ -t 0 ]; then
  echo "usage: ntfyschwenkonline [message]" >&2
  echo "       echo message | ntfyschwenkonline" >&2
  exit 1
else
  message=$(cat)
fi

curl -fsS \
  -H "Authorization: Bearer ${NTFY_TOKEN}" \
  -H "Title: $(hostname -s)" \
  -d "${message}" \
  "${NTFY_URL}/$(topic)"
EOF
sudo chmod 755 /usr/local/bin/ntfyschwenkonline

Use

ntfyschwenkonline "backup finished"
echo "disk 95% full" | ntfyschwenkonline

Messages appear on the host topic in the ntfy web UI or any subscriber.

S
Description
No description provided
Readme 28 KiB