Bind both Docker services to 0.0.0.0 by default
This commit is contained in:
@@ -19,6 +19,8 @@ cd pipelines
|
||||
Go uses `GOBIN` or its normal `GOPATH/bin` default; put that directory on PATH.
|
||||
The Docker installer automatically detects/configures LAN networking for ntfy;
|
||||
you do not need to look up your IP or supply a URL/listen address.
|
||||
Both Docker services bind `0.0.0.0`; reinstall normalizes those bind settings
|
||||
without replacing your URLs, timezone, ports or credentials.
|
||||
Native mode installs the Go binaries and shared OpenCode `pipelines` skill without
|
||||
login checks or automatic services. Docker mode configures ntfy accounts/token,
|
||||
checks publishing/health, and opens container OpenCode provider login on first setup;
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ services:
|
||||
secrets:
|
||||
- ntfy_token
|
||||
ports:
|
||||
- "127.0.0.1:${PIPELINES_PORT:-8080}:8080"
|
||||
- "${PIPELINES_BIND_ADDRESS:-0.0.0.0}:${PIPELINES_PORT:-8080}:8080"
|
||||
volumes:
|
||||
- pipelines-data:/data
|
||||
- opencode-home:/home/pipelines
|
||||
@@ -44,7 +44,7 @@ services:
|
||||
NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT: 1G
|
||||
NTFY_ATTACHMENT_FILE_SIZE_LIMIT: 1M
|
||||
ports:
|
||||
- "${NTFY_BIND_ADDRESS:-127.0.0.1}:8090:80"
|
||||
- "${NTFY_BIND_ADDRESS:-0.0.0.0}:8090:80"
|
||||
volumes:
|
||||
- ntfy-data:/var/lib/ntfy
|
||||
healthcheck:
|
||||
|
||||
+5
-4
@@ -10,8 +10,8 @@ in the Docker volume, not your host OpenCode account. Re-run to update while
|
||||
preserving `.env`, tokens, histories and volumes. Use `--relogin` to connect another
|
||||
provider. No fixed OpenCode Go login is required. Health/publishing checks do not
|
||||
prove model inference or phone reception.
|
||||
LAN IP, phone-facing ntfy URL and listen IP are detected/configured automatically;
|
||||
there are no networking questions. Advanced URL/bind/timezone flags remain optional.
|
||||
The phone-facing ntfy URL uses the detected LAN IP; both services bind `0.0.0.0` by default.
|
||||
There are no networking questions. Advanced URL/bind/timezone flags remain optional.
|
||||
|
||||
The steps below are for manual setup or a local Pipelines server with Docker ntfy.
|
||||
|
||||
@@ -69,13 +69,14 @@ your actual IANA timezone). Rerun/edit settings if you move/change timezones.
|
||||
The helper creates an empty, protected token file for bootstrap; no notifications
|
||||
are sent until it is filled. `.env`, `secrets/`, and `data/` are git-ignored and
|
||||
excluded from image builds. Default pipeline port is **8081**, bound to host
|
||||
loopback, avoiding the existing native server on 8080. Android does not need
|
||||
`0.0.0.0`, avoiding the existing native server on 8080. Android does not need
|
||||
access to the unauthenticated pipeline API.
|
||||
|
||||
Use HTTP only on a trusted LAN or encrypted VPN. For public access, use HTTPS
|
||||
with a reverse proxy/VPN; configure the external URL in `NTFY_BASE_URL`. The
|
||||
container's attachment URLs use that external URL, not the internal service name.
|
||||
`NTFY_BIND_ADDRESS=0.0.0.0` explicitly exposes port 8090; firewall it appropriately.
|
||||
Both host port mappings default to `0.0.0.0`; firewall them appropriately. The
|
||||
Pipelines API has no authentication and must not be exposed to untrusted networks.
|
||||
|
||||
## 2. Bootstrap ntfy users and token
|
||||
|
||||
|
||||
+8
-4
@@ -21,8 +21,9 @@ Re-running installation updates the binaries and bundled OpenCode skill without
|
||||
changing databases, login, or OpenCode configuration files.
|
||||
|
||||
Docker mode detects the computer's LAN IPv4 address and timezone automatically,
|
||||
configures `http://LAN_IP:8090`, and binds ntfy to that LAN interface without asking
|
||||
for networking settings (timezone falls back to UTC). It preserves an existing `.env`, bootstraps
|
||||
configures `http://LAN_IP:8090`, and binds both Docker services to `0.0.0.0` without asking
|
||||
for networking settings (timezone falls back to UTC). On reinstall it updates only
|
||||
the bind settings to `0.0.0.0` and retains existing URLs/timezone/ports/credentials. It bootstraps
|
||||
the publishing/phone accounts and publishing token, builds the server, installs
|
||||
the skill inside the container, and opens **container OpenCode provider login**
|
||||
on first setup. Choose any supported provider; signup is handled by that provider.
|
||||
@@ -36,10 +37,13 @@ Phone reception/model inference are not verified by installation.
|
||||
For fresh configuration you can supply `--ntfy-url https://ntfy.example.com
|
||||
--bind-address 127.0.0.1 --timezone Europe/London --port 8081` directly to `./install.sh`.
|
||||
The defaults are ready for direct phone access on your trusted LAN. Only use
|
||||
plain HTTP on a trusted network. Existing `.env` settings are never silently
|
||||
replaced. Docker is also the default without a terminal; setup fails rather than
|
||||
plain HTTP on a trusted network. Other existing `.env` settings are not replaced.
|
||||
Docker is also the default without a terminal; setup fails rather than
|
||||
silently falling back to native binaries if the LAN address cannot be detected.
|
||||
Use an interactive terminal for first Docker/provider setup.
|
||||
The Docker Pipelines API is unauthenticated: keep its port on a trusted network
|
||||
and do not forward it to the Internet. For a manual loopback-only deployment,
|
||||
set `PIPELINES_BIND_ADDRESS=127.0.0.1` after installation and use Compose directly.
|
||||
Ctrl+C cancels cleanly without deleting configuration, credentials or volumes.
|
||||
Install native mode as well if you want host CLI/TUI binaries; Docker mode installs
|
||||
the server and CLI in its image. See [Docker setup](docker.md).
|
||||
|
||||
@@ -41,6 +41,9 @@ LAN detection and `.env` generation were executed without networking input.
|
||||
The isolated Docker ntfy endpoint was also reached through the detected LAN IP:
|
||||
health succeeded, anonymous publishing was denied, and authenticated publishing
|
||||
succeeded. These host-side checks do not prove reception on another device.
|
||||
Docker bindings now default to `0.0.0.0` for both services. Reinstall tests check
|
||||
normalization of old bind settings without replacing URLs/timezone/ports/tokens;
|
||||
`docker compose config --format json` confirmed both host bindings are `0.0.0.0`.
|
||||
|
||||
Consequential-action regressions check run/retry/cancellation and CLI publication/
|
||||
draft deletion confirmation, default-No behavior, JSON stdout cleanliness, and
|
||||
|
||||
@@ -60,7 +60,7 @@ def configure(directory, ntfy_url, bind_address, timezone=None, port=8081):
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--ntfy-url", required=True)
|
||||
parser.add_argument("--bind-address", default="127.0.0.1")
|
||||
parser.add_argument("--bind-address", default="0.0.0.0")
|
||||
parser.add_argument("--timezone")
|
||||
parser.add_argument("--port", type=int, default=8081)
|
||||
args = parser.parse_args()
|
||||
|
||||
+17
-4
@@ -2,6 +2,7 @@
|
||||
"""Configure, authenticate and verify the full Docker installation."""
|
||||
import argparse
|
||||
import importlib.util
|
||||
import ipaddress
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
@@ -35,14 +36,26 @@ class Setup:
|
||||
|
||||
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.bind_address, args.timezone, args.port)):
|
||||
if any((args.ntfy_url, args.timezone, args.port)):
|
||||
raise ValueError(".env already exists; edit it explicitly rather than replace existing configuration")
|
||||
print("Keeping existing .env and credentials.")
|
||||
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"
|
||||
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.")
|
||||
return
|
||||
address = lan.detect_lan() if not args.ntfy_url else None
|
||||
url = args.ntfy_url or f"http://{address}:8090"
|
||||
bind = args.bind_address or address or "127.0.0.1"
|
||||
timezone = args.timezone
|
||||
if not timezone:
|
||||
try:
|
||||
@@ -132,7 +145,7 @@ 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 the detected LAN bind IP")
|
||||
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")
|
||||
|
||||
@@ -53,7 +53,7 @@ class DockerSetupTests(unittest.TestCase):
|
||||
setup.Setup(directory).settings(setup.arguments([]))
|
||||
text=Path(directory,".env").read_text()
|
||||
self.assertIn("NTFY_BASE_URL=http://192.168.1.25:8090\n",text)
|
||||
self.assertIn("NTFY_BIND_ADDRESS=192.168.1.25\n",text)
|
||||
self.assertIn("NTFY_BIND_ADDRESS=0.0.0.0\n",text)
|
||||
self.assertIn("TZ=Europe/London\n",text)
|
||||
|
||||
def test_timezone_fallback_does_not_prompt(self):
|
||||
@@ -118,7 +118,11 @@ class DockerSetupTests(unittest.TestCase):
|
||||
before = [p.read_bytes() for p in files]
|
||||
calls, _ = self.exercise(directory, existing=True)
|
||||
self.assertFalse(any("login" in c or "token" in c for c in calls))
|
||||
self.assertEqual(before, [p.read_bytes() for p in files])
|
||||
self.assertEqual(before[1],files[1].read_bytes())
|
||||
self.assertEqual(files[0].read_bytes(),before[0].replace(b"NTFY_BIND_ADDRESS=192.168.1.20",b"NTFY_BIND_ADDRESS=0.0.0.0")+b"PIPELINES_BIND_ADDRESS=0.0.0.0\n")
|
||||
normalized=files[0].read_bytes()
|
||||
self.exercise(directory,existing=True)
|
||||
self.assertEqual(normalized,files[0].read_bytes())
|
||||
|
||||
def test_login_failure_or_cancel_does_not_mark_complete_or_start_server(self):
|
||||
for fail, confirm in [("login", "yes"), (None, "no")]:
|
||||
@@ -141,6 +145,21 @@ class DockerSetupTests(unittest.TestCase):
|
||||
setup.Setup(directory).settings(setup.arguments(["--ntfy-url", "https://example.com"]))
|
||||
self.assertEqual(path.read_text(), "existing settings")
|
||||
|
||||
def test_existing_env_rejects_unsafe_bind_override(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path=Path(directory,".env");path.write_text("NTFY_BIND_ADDRESS=127.0.0.1\n")
|
||||
with self.assertRaises(ValueError):
|
||||
setup.Setup(directory).settings(setup.arguments(["--bind-address","0.0.0.0\nOTHER=bad"]))
|
||||
self.assertEqual(path.read_text(),"NTFY_BIND_ADDRESS=127.0.0.1\n")
|
||||
|
||||
def test_existing_env_symlink_is_not_modified(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
target=Path(directory,"custom.env");target.write_text("keep")
|
||||
Path(directory,".env").symlink_to(target)
|
||||
with self.assertRaises(ValueError):
|
||||
setup.Setup(directory).settings(setup.arguments([]))
|
||||
self.assertEqual(target.read_text(),"keep")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user