Commit Graph
120 Commits
Author SHA1 Message Date
binwiederhier 2e8506f827 Make the admin socket experimental and off by default
Rename listen-admin-unix to experimental-listen-admin-unix and drop the
/run/ntfy/admin.sock default: the CLI side (#2089, #2135) is not merged,
so nothing uses the socket yet. The startup warning no longer points at a
CLI fallback, and the docs say the commands do not use it yet.
2026-10-31 15:00:21 +00:00
binwiederhier 0f3a57a2a2 Merge remote-tracking branch 'origin/main' into shared-daily-limits
# Conflicts:
#	docs/releases.md
#	server/server.go
2026-10-31 03:14:26 +00:00
binwiederhier df332a9942 Disable the admin socket with "-", like listen-http 2026-10-30 21:14:06 +00:00
binwiederhier 59775edc72 Rename admin-socket to listen-admin-unix 2026-10-30 20:52:50 +00:00
binwiederhier c3ecea55c4 Show the reset time and the sync delay on the account page, document shared daily limits
Claude-Session: https://claude.ai/code/session_01DeXuhSjq5Gta5qPJgSceFe
2026-10-30 20:42:27 +00:00
binwiederhier f8f0d87253 Merge branch 'adminsock-api' into adminsock-socket
# Conflicts:
#	docs/releases.md
#	server/server.go
#	server/server_admin_socket.go
#	server/server_admin_test.go
2026-10-30 20:40:33 +00:00
binwiederhier 8d1e7f129c Call the first drain phase withdrawing, and label both phases in Drain 2026-10-24 18:42:26 +00:00
binwiederhier 1fd5477981 Call it draining on shutdown, not maintenance mode
Other systems keep two things apart: draining before a shutdown (ephemeral, cleared by the restart: RabbitMQ drain, CockroachDB node drain) and an operator's maintenance flag (persistent cluster state: Kubernetes cordon, Nomad eligibility, Consul maint). This PR is the former, so it is named that way: Server.Drain (synchronous again; the on/off API is gone until the persistent maintenance flag exists), Cluster.SetDraining/Draining, the read-only phase flag readOnly, /v1/ready reports "draining": true, error 50301 says the node is shutting down, and docs/config.md has a "Draining on shutdown" section. A drain duration of 0 now closes all streams at once instead of disabling the drain.
2026-10-23 21:20:57 +00:00
binwiederhier 86803803b1 Allow turning maintenance mode off again
Maintenance mode is now a state that can be entered and left without a restart: Server.SetMaintenance(on) runs the phases in the background and returns at once; off stops them wherever they are and takes the node back into service (ready, writable, active in the cluster). WaitDrained waits for the drain. On SIGTERM, Drain is SetMaintenance(true) plus WaitDrained, as before. SetMaintenance(true) is idempotent and refuses with drain duration 0, on a passive node, or without another active node. This is what a later 'ntfy cluster maintenance on|off' needs.
2026-10-23 20:54:29 +00:00
binwiederhier 30eb5db6d8 Maintenance mode: enter, then drain read-only
Maintenance mode now has two phases. Entering (experimental-cluster-drain-delay, default 15s): /v1/ready fails and the node acts as passive in the cluster, but it still serves everything, so the load balancers can stop sending it requests without any request failing. Draining (experimental-cluster-drain-duration, default 1m): read-only, i.e. new subscriptions and all publishes get 503 (email gets SMTP 451, so mail servers retry instead of bouncing), and the streams are closed evenly. The defaults together fit systemd's 90s stop timeout. docs/config.md gets a maintenance mode section with the behavior table.
2026-10-23 13:20:33 +00:00
binwiederhier b76ad0c037 Call the shutdown drain maintenance mode
A node draining before a shutdown is in maintenance mode: /v1/ready reports "maintenance": true (was "draining"), and the 503 says the node is in maintenance mode. Maintenance is a runtime state next to the configured role, not a role: a later admin command can enter and leave it without a shutdown, with the same semantics. server_drain.go is now server_maintenance.go.
2026-10-23 12:38:39 +00:00
binwiederhier 156fe22373 Merge remote-tracking branch 'origin/main' into cluster-drain
# Conflicts:
#	docs/releases.md
2026-10-23 12:18:59 +00:00
binwiederhier af9ade095e Drain cluster nodes on shutdown
On SIGTERM, an active cluster node with another healthy active node first drains: new subscriptions (HTTP streams and WebSockets) get 503, which a load balancer retries on another node, /v1/ready fails with "draining": true, and the open streams are closed evenly over experimental-cluster-drain-duration (default 1m, fits systemd's 90s stop timeout; 0 disables). Clients reconnect a few at a time and resume with since=, instead of all at once. Publishes and polls are still served, since a load balancer does not retry a POST. A second signal skips the rest of the drain.

A stream registry on the server tracks open subscriber connections once each, however many topics they subscribe to.
2026-10-23 04:27:01 +00:00
binwiederhier 6f94317377 Allow several comma-separated addresses in listen-http
A load balancer connects to each upstream address from one source IP, so one address caps it at ~63k connections to a node. listen-http now takes a comma-separated list (whitespace trimmed, empty and duplicate entries rejected, "-" still unsets it); Config.ListenHTTP becomes a slice, Run starts one HTTP server per address on the same handler, and stop closes all of them.
2026-10-23 04:12:25 +00:00
binwiederhier 412f012ffc Admin socket: serve the admin API on a local unix socket without credentials
The server listens on admin-socket (default /run/ntfy/admin.sock, none
on Windows) when auth is configured. Requests on it run as a synthetic
admin, skip rate limiting and the ban feed, and may do what the network
API refuses (roles, changing or deleting admins). File mode 0660 in a
0750 directory is the authorization; peer credentials go into the audit
log on Linux and the BSDs.

A stale socket file is replaced, a socket another server answers on is
left alone, and failing to listen only logs a warning so the CLI can
fall back to the database. The systemd unit gets RuntimeDirectory=ntfy.
2026-10-22 03:04:21 +00:00
binwiederhier 6425eaa329 Add the experimental-cluster-role option 2026-10-14 19:14:27 +00:00
binwiederhier 33effa3bb7 Prep v2.30.0 release: release notes, install docs, cluster docs
Move the unreleased server notes to v2.30.0 (released October 13, 2026), bump install.md to 2.30.0,
add the experimental clustering release note and a downgrade note for the message schema change
(15 to 16), and update the stale cluster comments/docs now that the mesh cluster ships.
2026-10-12 02:03:02 +00:00
Helmut K. C. Tessarek f0fe1218f2 fix(server.yml): update chown command 2026-10-07 14:31:52 -04:00
binwiederhier 0ccbf5ad87 Reserve the experimental clustering options
Five option names and their validation, ahead of the implementation, so the
config surface is settled and the cluster change is only code. The
experimental- prefix is there because the names may still change.

The options parse into server.Config and the cross-field rules are enforced:
a listen address needs database-url, a secret and a node id; a secret without
a listen address is an error rather than clustering being silently off; a
wildcard bind needs an explicit advertise URL; a negative linger is rejected.

Setting experimental-cluster-listen then refuses to start the server, since
accepting the options and running single-node would look like a working
cluster. The cluster change deletes that one line.
2026-10-07 00:06:19 +00:00
binwiederhier 7826c86f67 Remove message-poll-limit again, hardcode title/tags/etc limits, count polls toward bandwidth limit 2026-08-27 19:42:30 +00:00
binwiederhier cae7816e5d Add message-poll-limit ... 2026-08-27 16:38:21 +00:00
binwiederhier fbcd4b6290 Expands bandwidth limit to also include excessive polling 2026-08-27 14:12:01 +00:00
binwiederhier 2bc145f3ae Merge branch 'release-2.26.x' 2026-07-20 23:42:03 +02:00
binwiederhier 469d263a5c Hotfix: Add ban-file/ban-threshold/ban-weights as a more lightweight mechanism abuse counter 2026-07-18 08:41:25 +02:00
binwiederhier f8d2fcd7a6 Move metrics to metrics/ pacakge 2026-07-17 22:08:21 +02:00
binwiederhier 7614405332 Wire up server.yml 2026-05-31 21:50:57 -04:00
binwiederhier acb4c1b3cc Add visitor-topic-creation-limit-* options 2026-05-17 11:33:07 -04:00
binwiederhier 6aebc5c677 Refine 2026-03-30 08:26:56 -04:00
binwiederhier 61dd788dac WIP: Email verification 2026-03-29 22:47:38 -04:00
binwiederhier a1b403d23c Remove s3 config option, reduce size when removing files 2026-03-19 21:11:36 -04:00
binwiederhier d517ce4a2a WIP: S3 2026-03-14 21:10:46 -04:00
binwiederhier 7c69a76345 Docs 2026-02-20 16:56:47 -05:00
binwiederhier eb6e1ac44a Docs 2026-02-20 15:57:47 -05:00
binwiederhier 039d555689 Fix tests 2026-02-20 08:19:25 -05:00
binwiederhier bf265449ac Docs 2026-02-19 22:38:27 -05:00
binwiederhier e432bf2886 Rename PostgreSQL table prefix from wp_ to webpush_ 2026-02-16 12:13:10 -05:00
Alexander Ivanov b26546b709 chore: fix typos in server.yml config file
Signed-off-by: Alexander Ivanov <oshli.a.er@gmail.com>
2026-01-25 19:19:31 +03:00
binwiederhier 6bacf7dafc Works 2026-01-17 04:34:32 -05:00
binwiederhier 0e200b96e0 Merge branch 'main' of github.com:binwiederhier/ntfy into feature/twilio-call-format-file 2026-01-17 03:49:52 -05:00
binwiederhier 50f3563477 Docs 2025-08-24 21:18:28 -04:00
binwiederhier ec1f97b726 Merge remote-tracking branch 'theatischbein/feat_optional_require_login' into require-login 2025-08-24 13:34:22 -04:00
binwiederhier 82282419fe Self-review 2025-07-31 10:34:02 +02:00
binwiederhier 23ec7702fc Add "auth-tokens" 2025-07-31 07:08:35 +02:00
binwiederhier 2578236d8d Docs 2025-07-27 17:10:37 +02:00
binwiederhier f59df0f40a Works 2025-07-21 17:44:00 +02:00
binwiederhier ae62e0d955 Docs docs docs 2025-07-19 15:37:05 +02:00
binwiederhier 677b44ce61 Docs, rename proxy-trusted-(addresses->hosts) 2025-07-05 22:35:26 +02:00
binwiederhier 7eeaeb8398 server.yml update 2025-07-04 16:51:55 +02:00
binwiederhier d3f7aa7008 Self-review 2025-06-01 10:12:06 -04:00
binwiederhier bbfaf2fc4d Add Forwarded header parsing 2025-06-01 09:57:39 -04:00