Ntfy configuration

From wikinotes
Revision as of 01:05, 19 May 2024 by Will (talk | contribs) (→‎Basics)

A self hosted pub/sub server wtih a FOSS app (iOS/android) that will issue push notifications.

NOTE:

ntfy has extensive configuration options not covered here, just a quickstart here.

Documentation

official docs https://docs.ntfy.sh/
sample config https://github.com/binwiederhier/ntfy/blob/main/server/server.yml

Locations

${PREFIX}/etc/ntfy/server.yml config

Basics

# ${PREFIX}/etc/ntfy/server.yml

base-url: https://foo.com

# cache messages (for inconsistent internet connections like phone)
cache-file:     /var/cache/ntfy/cache.db
cache-duration: 12h

# require basic-auth or token-auth
auth-file:            /var/lib/ntfy/user.db
auth-default-access:  deny-all

# use "X-Forwarded-For" to identify unique visitors when rate-limiting
behind-proxy: true

# expose scrapable endpoint for prometheus
enable-metrics: false
metrics-listen-http: 10.0.1.1:9090

Components

Access Control

# ${PREFIX}/etc/ntfy/server.yml

auth-file:            /var/lib/ntfy/user.db
auth-default-access:  deny-all
ntfy user                        # manage users from cli
ntfy user add --role=admin phil  # create a user w/ admin role

Token Auth

ntfy token                                           # manage tokens
ntfy token add --expires=30d --label="backups" phil  # create token for user 'phil'