Remove ntfy: notifications go only through the app notification stream

Server: drop ntfy publishing (stage hooks, run outbox, chat attention, chat
tool notify, auto-switch and schedule notices), the chat push outbox (its
table is dropped at startup), ntfy status/endpoints and PIPELINES_NTFY_*.
The app_notifications stream, subscribe/clear and kinds are unchanged.
Notification settings keep run_finished/chat_needs_you/chat_reply_finished;
ntfy_enabled is accepted and ignored and its stored row is never read.

Stage type=ntfy is rejected: "ntfy stages were removed; notifications go to
the Pipelines apps — use the stage notify hook". The notify hook remains.

Installer: no ntfy build, accounts, config or supervisor child; manifest
gets top-level "mode" (legacy ntfy.mode still read). Reinstall retires an
old ntfy (safe PID-file stop, deletes binary, config, data dir, token, log,
with a note in logs/install.log); uninstall cleans leftovers.

App: ntfy settings section replaced by "Notification events"; texts updated.
Docs: docs/ntfy.md folded into docs/notifications.md; install, docker, cli,
author skill references updated; security review M1 marked resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 23:24:24 +00:00
parent 806b5eca46
commit fc7dbb0ac0
138 changed files with 1958 additions and 4651 deletions
+53 -55
View File
@@ -2,7 +2,6 @@
"""Configure, authenticate and verify the full Docker installation."""
import argparse
import importlib.util
import ipaddress
import re
import shutil
import json
@@ -21,7 +20,6 @@ def module(name, file):
configure = module("configure_compose", "configure-compose.py")
tokens = module("save_ntfy_token", "save-ntfy-token.py")
lan = module("lan_address", "lan-address.py")
build_metadata = module("build_metadata", "build_metadata.py")
release_lookup = module("resolve_releases", "resolve-releases.py")
@@ -67,32 +65,30 @@ class Setup:
result = self.runner(["docker", "compose", *args], cwd=self.directory,
capture_output=capture, text=True, **kwargs)
if check and result.returncode:
# Captured ntfy output may contain tokens. Never replay it on failure.
# Captured tool output may contain credentials. Never replay it on failure.
raise ValueError(f"Docker setup step failed (exit {result.returncode}); no credentials were replaced")
return result
def settings(self, args):
settings = self.directory / ".env"
bind = str(ipaddress.IPv4Address(args.bind_address or "0.0.0.0"))
if settings.is_symlink():
raise ValueError("Refusing to modify a symlinked .env")
if settings.exists():
if any((args.ntfy_url, args.timezone, args.port)):
if any((args.timezone, args.port)):
raise ValueError(".env already exists; edit it explicitly rather than replace existing configuration")
text = settings.read_text()
for key, value in (("NTFY_BIND_ADDRESS", bind),
("PIPELINES_BIND_ADDRESS", "0.0.0.0")):
if any(line.startswith(key + "=") for line in text.splitlines()):
text = "".join(key + "=" + value + "\n" if line.startswith(key + "=") else line
for line in text.splitlines(keepends=True))
else:
text = text.rstrip("\n") + "\n" + key + "=" + value + "\n"
# ntfy's settings from older installs are dropped (see retire_ntfy).
lines = [line for line in settings.read_text().splitlines(keepends=True)
if not line.startswith(("NTFY_BASE_URL=", "NTFY_BIND_ADDRESS="))]
text = "".join(lines)
key, value = "PIPELINES_BIND_ADDRESS", "0.0.0.0"
if any(line.startswith(key + "=") for line in lines):
text = "".join(key + "=" + value + "\n" if line.startswith(key + "=") else line for line in lines)
else:
text = text.rstrip("\n") + "\n" + key + "=" + value + "\n"
if text != settings.read_text():
settings.write_text(text)
print(f"Docker binds: ntfy {bind}, Pipelines 0.0.0.0; existing URLs, timezone, ports and credentials retained.")
print("Docker binds: Pipelines 0.0.0.0; existing timezone, ports and credentials retained.")
return
address = lan.detect_lan() if not args.ntfy_url else None
url = args.ntfy_url or f"http://{address}:8090"
timezone = args.timezone
if not timezone:
try:
@@ -100,18 +96,35 @@ class Setup:
except ValueError:
timezone = "UTC"
print("Host timezone unavailable; using UTC (override with --timezone if needed).")
configure.configure(self.directory, url, bind, timezone, args.port or 8081)
print(f"LAN notifications configured: {url} (bind {bind}; authentication required).")
print("Use this address on your phone on the same trusted LAN; do not forward this HTTP port to the Internet.")
configure.configure(self.directory, timezone, args.port or 8081)
def bootstrap_ntfy(self):
def run_ntfy(args, capture=False, interactive=False):
# -T is required for the non-interactive calls; the interactive
# `user add` password prompts need the allocated TTY.
exec_args = ["exec"] + ([] if interactive else ["-T"]) + ["ntfy", "ntfy", *args]
return self.compose(*exec_args, capture=capture)
tokens.bootstrap_accounts(run_ntfy, self.directory / "secrets/ntfy-token.txt", 0o444)
def retire_ntfy(self):
"""Removes the ntfy container, volume and token an older Docker install
created; Pipelines no longer runs ntfy. Idempotent."""
project = json.loads(self.compose("config", "--format", "json", capture=True).stdout).get("name") or "pipelines"
if not re.fullmatch(r"[a-z0-9][a-z0-9_-]*", project):
raise ValueError("Unexpected Compose project name; no ntfy resources were removed")
removed = []
containers = self.runner(["docker", "ps", "-aq", "--filter", f"label=com.docker.compose.project={project}",
"--filter", "label=com.docker.compose.service=ntfy"],
capture_output=True, text=True)
ids = [name for name in (containers.stdout or "").split() if re.fullmatch(r"[0-9a-f]+", name)]
if not containers.returncode and ids:
self.runner(["docker", "rm", "-f", *ids], capture_output=True, text=True)
removed.append("container")
volume = f"{project}_ntfy-data"
volumes = self.runner(["docker", "volume", "ls", "-q", "--filter", f"name=^{volume}$"],
capture_output=True, text=True)
if not volumes.returncode and volume in (volumes.stdout or "").split():
self.runner(["docker", "volume", "rm", volume], capture_output=True, text=True)
removed.append(f"volume {volume}")
token = self.directory / "secrets/ntfy-token.txt"
if token.exists() or token.is_symlink():
token.unlink()
removed.append(str(token))
if removed:
print("Retired the old ntfy notification server (" + ", ".join(removed)
+ "); notifications now come through the Pipelines apps.")
def authenticate(self, relogin=False):
def connected():
@@ -257,8 +270,8 @@ exec pipelines provider-check --model "$1" --yes --json --timeout 90s
raise ValueError("Host client update failed; Docker setup is incomplete")
print("Updated host CLI/TUI using go install. Restart the running TUI; an already-running process keeps its old code.")
def publish_address(self):
address = lan.detect_lan()
def publish_address(self, address=None):
address = address or lan.detect_lan()
path = self.directory/".env"
text = path.read_text()
key = "PIPELINES_HOST_IP="
@@ -501,23 +514,11 @@ printf 'node=%s\\n' "$(node --version)"
print("Verified running server build: " + build["version"] + " (" + build["commit"] + ")")
def verify(self):
# Read the token inside the container; never put it in argv or output.
probe = '''set -eu
test -s "$PIPELINES_NTFY_TOKEN_FILE"
printf 'header = "Authorization: Bearer %s"\\n' "$(cat "$PIPELINES_NTFY_TOKEN_FILE")" |
curl --config - --fail --silent --show-error --max-time 10 --output /dev/null \
--data 'Pipelines Docker setup: authenticated publishing verified.' "$PIPELINES_NTFY_URL"
'''
self.compose("exec", "-T", "pipelines", "sh", "-c", probe, capture=True)
result = self.compose("exec", "-T", "pipelines", "pipelines", "--url",
"ws://127.0.0.1:8080/connect", "status", "--json", capture=True)
status = json.loads(result.stdout)
if (status.get("ntfy", {}).get("health") != "healthy"
or not status.get("ntfy", {}).get("url") or status.get("topic") != "pipelines"):
raise ValueError("Pipelines did not report healthy ntfy; check docker compose logs pipelines ntfy")
print("Verified: Pipelines reports healthy ntfy and authenticated publishing succeeded.")
print(f"On your phone: add {status['ntfy']['url']}, log in as phone-reader, subscribe to pipelines.")
print("Phone reception is not verified by this setup check.")
if not isinstance(json.loads(result.stdout), dict):
raise ValueError("Pipelines did not report its status; check docker compose logs pipelines")
print("Verified: Pipelines reports its status. Notifications reach the Pipelines apps (docs/notifications.md).")
address = self.compose("port", "pipelines", "8080", capture=True).stdout.strip()
port = address.rsplit(":", 1)[-1]
if not port.isdigit() or not 1 <= int(port) <= 65535:
@@ -541,11 +542,9 @@ printf 'header = "Authorization: Bearer %s"\\n' "$(cat "$PIPELINES_NTFY_TOKEN_FI
status = json.loads(result.stdout)
except ValueError:
raise ValueError("Host client could not inspect the published Docker server; setup is NOT complete")
if (result.returncode or not isinstance(status, dict)
or not isinstance(status.get("ntfy"), dict)
or status["ntfy"].get("health") != "healthy"):
raise ValueError("Host client did not reach the verified ntfy-enabled Docker server; check the published port before using the TUI")
print("Verified: host client reaches the ntfy-enabled Docker server at " + endpoint)
if result.returncode or not isinstance(status, dict):
raise ValueError("Host client did not reach the verified Docker server; check the published port before using the TUI")
print("Verified: host client reaches the Docker server at " + endpoint)
def configure_client(self, endpoint):
path = configure.configure_client(endpoint)
@@ -562,14 +561,15 @@ printf 'header = "Authorization: Bearer %s"\\n' "$(cat "$PIPELINES_NTFY_TOKEN_FI
# Resolve current releases before touching settings/services; a failure
# keeps the verified pins and stops rather than installing stale copies.
releases = self.resolve_releases()
# The published LAN address is required; find it before writing settings.
address = lan.detect_lan()
self.settings(args)
self.publish_address()
self.publish_address(address)
self.configure_workspaces()
self.update_host_client()
# Validate the actual resolved Compose configuration before starting anything.
self.compose("config", "--quiet", capture=True)
self.compose("up", "-d", "--wait", "--wait-timeout", "60", "ntfy")
self.bootstrap_ntfy()
self.retire_ntfy()
if self.needs_image_build(releases, expected_build, force_dirty=True):
self.compose("build", *build_args, *self.release_build_args(releases), "pipelines")
found = self.verify_harness_versions(releases) or {}
@@ -596,7 +596,7 @@ printf 'header = "Authorization: Bearer %s"\\n' "$(cat "$PIPELINES_NTFY_TOKEN_FI
options += ["--model", args.harness_model]
self.compose("run", "--rm", "--no-deps", "--entrypoint", "pipelines", "pipelines", "harness", "setup", "pi", *options)
# Recreate to reload file secrets and environment, without deleting volumes.
self.compose("up", "-d", "--force-recreate", "--wait", "--wait-timeout", "60", "pipelines")
self.compose("up", "-d", "--force-recreate", "--remove-orphans", "--wait", "--wait-timeout", "60", "pipelines")
self.verify_build(expected_build)
self.verify_workspace()
self.verify()
@@ -608,8 +608,6 @@ printf 'header = "Authorization: Bearer %s"\\n' "$(cat "$PIPELINES_NTFY_TOKEN_FI
def arguments(argv=None):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--ntfy-url", help="Override the auto-detected LAN ntfy address")
parser.add_argument("--bind-address", help="Override ntfy's default 0.0.0.0 bind address")
parser.add_argument("--timezone", help="Override the detected timezone (fallback: UTC)")
parser.add_argument("--port", type=int)
parser.add_argument("--relogin", action="store_true", help="open OpenCode provider login again without deleting accounts")