Bind the native server to the LAN so the phone client can reach it

The native install hardcoded -addr 127.0.0.1, so the server was unreachable from
the phone: the emulator worked because it proxies to the host loopback, but a
real device could not connect even though ntfy (bound to 0.0.0.0:8090) worked.

The bind address is now a manifest setting (server_address() in manage.py, with
older manifests still defaulting to loopback) and setup-native.py records it,
defaulting to 0.0.0.0 like the Docker install did and offering
--bind-address 127.0.0.1 for a loopback-only server. An invalid address is
rejected, and setup prints the phone client URL.

Verified: scripts test suite 116 tests OK, and after reinstalling the server
listens on *:8080 and answers {"healthy":true} on 127.0.0.1, 10.0.0.75,
10.0.0.249 and the tailnet address.
This commit is contained in:
2026-10-15 01:57:27 +01:00
parent 9ca775291b
commit 8adc6b8080
5 changed files with 48 additions and 6 deletions
+10 -1
View File
@@ -26,6 +26,15 @@ def ntfy_health_url(config):
return f"http://127.0.0.1:{config['ntfy_port']}/v1/health"
def server_address(config):
"""The -addr the server binds.
The bind address is a manifest setting so the phone client can reach the
server over the LAN; manifests written before it existed default to loopback.
"""
return f"{config.get('bind_address') or '127.0.0.1'}:{config['server_port']}"
def load(prefix):
prefix = Path(prefix).expanduser().resolve()
path = prefix / MARKER
@@ -212,7 +221,7 @@ def supervise(config):
env.pop("PIPELINES_NTFY_TOKEN", None)
with (root / "logs/server.log").open("a") as log:
child = subprocess.Popen([str(root / "bin/pipelines-server"), "-addr",
f"127.0.0.1:{config['server_port']}", "-db", str(root / "data/pipelines.db")],
server_address(config), "-db", str(root / "data/pipelines.db")],
cwd=config["workspace"], env=env, stdout=log, stderr=log)
while child.poll() is None and not stopped:
time.sleep(0.25)