diff --git a/README.md b/README.md index 369aab19..1dc53d6c 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,15 @@ server reuse your OpenCode login; Docker ntfy handles phone notifications. ## Install -Interactive installation offers a full **Docker server + ntfy** setup (default) -or **native binaries only**. Docker mode needs Docker Compose and Python 3; native +`./install.sh` defaults to full **Docker server + ntfy** setup; use `--native` for +native binaries only. Docker mode needs Docker Compose and Python 3; native mode needs Go 1.27+ and uses your existing OpenCode for model stages. ```sh git clone https://git.a-wan.net/alan/pipelines.git cd pipelines -./install.sh --native # host CLI/TUI/server + shared OpenCode skill -pipelines help -# Or: ./install.sh --docker # configure/start both services and connect a provider +./install.sh # configure/start Docker services and connect a provider +# Optional host CLI/TUI binaries: ./install.sh --native ``` Go uses `GOBIN` or its normal `GOPATH/bin` default; put that directory on PATH. diff --git a/docs/docker.md b/docs/docker.md index d41f4d53..2ae0952c 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -2,7 +2,7 @@ ## Complete installer (recommended for both services in Docker) -Run `./install.sh --docker` from an interactive terminal. It handles Compose +Run `./install.sh` from an interactive terminal (Docker is the default). It handles Compose configuration, ntfy users/permissions/token, image build, container skill install, first-time container OpenCode provider login, startup, and an authenticated test notification. Choose your own provider in OpenCode; signup/login credentials stay diff --git a/docs/install.md b/docs/install.md index 5f4a760f..2d0c088e 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,7 +1,7 @@ # Installation -The interactive installer offers **Docker server + ntfy** (default) or **native -binaries only**. Native installation requires Go; Docker setup requires Docker +`./install.sh` sets up **Docker server + ntfy** by default. Use `--native` for +native binaries only. Native installation requires Go; Docker setup requires Docker Compose and Python 3, and includes OpenCode in the persistent server container. ```sh @@ -26,18 +26,19 @@ 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. Provider credentials remain in the `opencode-home` volume. Reinstalls skip login -after completed setup; `./install.sh --docker --relogin` opens it again without +after completed setup; `./install.sh --relogin` opens it again without deleting accounts. The installer then starts/recreates the Compose services, checks ntfy health through Pipelines, and sends an authenticated test notification. It does not register an OS service, delete volumes, or seed pipeline definitions. 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` after `--docker`. +--bind-address 127.0.0.1 --timezone Europe/London --port 8081` directly to `./install.sh`. Use a LAN/VPN interface IP instead of loopback for direct phone access; only use plain HTTP on a trusted network. Existing `.env` settings are never silently -replaced. Without a terminal, no-argument installation remains binary-only and -prints that limitation; use an interactive terminal for first Docker/provider setup. +replaced. Docker is also the default without a terminal; setup fails rather than +silently falling back to native binaries if required setup input is unavailable. +Use an interactive terminal for first Docker/provider setup. 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). diff --git a/install.sh b/install.sh index 3fd6f0ff..cd7c13f1 100755 --- a/install.sh +++ b/install.sh @@ -1,12 +1,7 @@ #!/bin/sh set -eu cd "$(dirname "$0")" -mode=${1:-} -if [ -z "$mode" ] && [ -t 0 ]; then - printf 'Install Docker server + ntfy, or native binaries only? [docker/native] (docker): ' - read -r mode - mode=${mode:-docker} -fi +mode=${1:---docker} case "$mode" in --docker|docker) if [ "$#" -gt 0 ]; then shift; fi @@ -15,8 +10,7 @@ case "$mode" in --native|native) if [ "$#" -gt 0 ]; then shift; fi ;; - '') echo 'Non-interactive binary-only install. Use ./install.sh --docker for the configured server + ntfy.' >&2 ;; - *) echo 'Usage: ./install.sh [--native | --docker [setup options]] (native honors GOBIN and GOPATH)' >&2; exit 2 ;; + *) exec python3 scripts/setup-docker.py "$@" ;; esac if [ "$#" -ne 0 ]; then echo 'Usage: ./install.sh --native (honors GOBIN and GOPATH)' >&2 diff --git a/scripts/test_installation.py b/scripts/test_installation.py index 67103b45..5ae99afb 100644 --- a/scripts/test_installation.py +++ b/scripts/test_installation.py @@ -13,7 +13,23 @@ class InstallationTests(unittest.TestCase): self.assertIn("--ntfy-url",result.stdout) self.assertIn("--relogin",result.stdout) - def test_standard_installer_needs_only_go_and_honors_gobin(self): + def test_default_installer_delegates_to_docker_without_terminal(self): + with tempfile.TemporaryDirectory() as directory: + root=Path(directory) + capture=root/"args" + executable=root/"python3" + executable.write_text('#!/bin/sh\nprintf "%s\\n" "$@" > "'+str(capture)+'"\n') + executable.chmod(0o700) + env=dict(os.environ,PATH=str(root)+os.pathsep+os.environ["PATH"]) + subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh")],env=env,stdin=subprocess.DEVNULL,check=True) + self.assertEqual(capture.read_text().splitlines(),["scripts/setup-docker.py"]) + + def test_default_installer_forwards_docker_options(self): + result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--help"],capture_output=True,text=True) + self.assertEqual(result.returncode,0) + self.assertIn("--ntfy-url",result.stdout) + + def test_native_installer_needs_only_go_and_honors_gobin(self): with tempfile.TemporaryDirectory() as directory: root=Path(directory) capture=root/"args" @@ -21,14 +37,14 @@ class InstallationTests(unittest.TestCase): executable.write_text('#!/bin/sh\nprintf "%s\\n" "$GOBIN" "$@" >> "'+str(capture)+'"\n') executable.chmod(0o700) env=dict(os.environ,PATH=str(root)+os.pathsep+os.environ["PATH"],GOBIN=str(root/"bin")) - subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh")],env=env,check=True) + subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--native"],env=env,check=True) self.assertEqual(capture.read_text().splitlines(),[str(root/"bin"),"install","-trimpath","./cmd/...",str(root/"bin"),"run","./cmd/pipelines","skill","install"]) self.assertFalse((root/"bin").exists()) def test_standard_installer_rejects_legacy_provisioning_flags(self): result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--system-command"],capture_output=True,text=True) self.assertEqual(result.returncode,2) - self.assertIn("GOBIN",result.stderr) + self.assertIn("unrecognized arguments",result.stderr) def test_legacy_management_requires_owned_marker(self): with tempfile.TemporaryDirectory() as directory: