Install Pipelines natively by default on macOS and Linux

Add scripts/setup-native.py and make ./install (and --native) build the server, the CLI
and ntfy from source into ~/.local/share/pipelines, detect an existing host OpenCode
and Pi instead of installing them, install the packaged authoring skill, migrate an
existing Docker database and ntfy auth store, save the host client default and start
both services. ./install --docker keeps the previous Docker server + ntfy
installation unchanged.

ntfy is compiled from its pinned Go module on every host because upstream publishes
no macOS server binary (its darwin asset is built with -tags noserver); its cgo
SQLite driver is why a C compiler is now required natively. The ntfy credential
bootstrap and the client default writer are shared by both installers,
installation.Load resolves symlinked prefixes, the Docker migration copies the
SQLite write-ahead log so the newest definitions and runs are not lost, and the
account subcommands read the generated configuration through NTFY_CONFIG_FILE.

Verified on macOS: 115 Python tests, go build/vet/test, and scratch installs that
migrate 9 pipelines and 31 runs, build ntfy v2.30.0 and start both services healthy
on spare ports before stopping them.
This commit is contained in:
2026-10-13 17:20:14 +01:00
parent 9b305df725
commit a70e3aef4b
21 changed files with 1474 additions and 153 deletions
+33 -1
View File
@@ -1,8 +1,10 @@
#!/usr/bin/env python3
"""Create local Compose settings without overwriting settings or credentials."""
"""Create local Compose settings and the host client default."""
import argparse
import json
import os
from pathlib import Path
import tempfile
from urllib.parse import urlparse
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
@@ -42,6 +44,36 @@ def host_workspaces(directory):
return {"PIPELINES_HOST_HOME": "'"+home+"'", "PIPELINES_HOST_REPOSITORY": "'"+repository+"'", "PIPELINES_UID": str(os.getuid()), "PIPELINES_GID": str(os.getgid())}
def configure_client(endpoint, environ=None):
"""Save the server address the host CLI/TUI dials by default.
Atomic, 0600, and it preserves unrelated keys. Shared by both installers so
the saved default always matches the installation that just ran.
"""
environ = os.environ if environ is None else environ
root = Path(environ.get("XDG_CONFIG_HOME") or Path.home() / ".config")
path = root / "pipelines" / "client.json"
if path.is_symlink():
raise ValueError("Refusing to modify symlinked client.json; use the printed --url explicitly")
existing = json.loads(path.read_text()) if path.exists() else {}
if not isinstance(existing, dict):
raise ValueError("client.json must contain an object; existing configuration was not replaced")
existing["server_url"] = endpoint
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
temporary = None
try:
with tempfile.NamedTemporaryFile(mode="w", dir=str(path.parent), delete=False) as file:
temporary = Path(file.name)
os.chmod(temporary, 0o600)
json.dump(existing, file, indent=2)
file.write("\n")
os.replace(temporary, path)
finally:
if temporary is not None:
temporary.unlink(missing_ok=True)
return path
def configure(directory, ntfy_url, bind_address, timezone=None, port=8081):
directory = Path(directory)
url = urlparse(ntfy_url)