6.8 KiB
Pipeline server + ntfy in one Compose project (Android)
Local pipeline server, Docker ntfy
To reuse your host OpenCode login without container authentication:
docker compose up -d ntfy
# Bootstrap ntfy users/token as described below, then:
sh scripts/run-local-server.sh
go run ./cmd/pipelines-tui -url ws://127.0.0.1:8080/connect
Do not run docker compose up -d for this mode: that starts the pipeline container
too. The local launcher uses the existing host database and OpenCode account,
publishes via localhost:8090, and advertises .env's NTFY_BASE_URL to the TUI.
The top bar shows ntfy, the external server URL, and topic beside the pipeline
server address on every page.
No credentials are included in the public setup data. Stop any existing local
pipeline server before launching another against the same database/port.
compose.yaml runs two services: pipelines (Go server + OpenCode V2) and ntfy.
The pipeline server publishes internally to http://ntfy/pipelines; Android connects
to your host's LAN/VPN URL. No host OpenCode service or credential database is
mounted. Separate volumes persist pipeline history, workspace files, OpenCode
credentials/sessions, and ntfy data. Do not use docker compose down -v unless
you intend to delete those volumes.
Verification: docker compose build pipelines completed, and
docker compose up -d ntfy started ntfy. A local authenticated Markdown upload
was accepted with a phone-facing attachment URL. The local server's WebSocket
advertised the public URL/topic and accepted the notification test pipeline.
Go race tests and vet passed. Pipeline-container startup/model authentication
and Android delivery are still not tested. Existing host history is preserved;
the local server was restarted with notification configuration.
1. Local settings
Start Docker Desktop/Colima/your Docker daemon first. Choose the host address your phone can reach. Example (replace the LAN IP):
python3 scripts/configure-compose.py \
--ntfy-url http://192.168.1.20:8090 \
--bind-address 0.0.0.0
docker compose config --quiet
The helper detects the host's timezone and writes it to .env, so the Linux
containers do not silently schedule in UTC. It refuses to overwrite .env or an
existing token. If detection is unavailable, use --timezone Europe/London (or
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
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.
2. Bootstrap ntfy users and token
docker compose up -d ntfy
docker compose exec ntfy ntfy user add pipeline-publisher
docker compose exec ntfy ntfy access pipeline-publisher pipelines write-only
docker compose exec ntfy ntfy user add phone-reader
docker compose exec ntfy ntfy access phone-reader pipelines read-only
docker compose exec -T ntfy ntfy token add pipeline-publisher | python3 scripts/save-ntfy-token.py
User creation prompts for passwords. Keep secrets/ mode 0700 on the host.
The helper extracts only the raw token (the ntfy CLI includes prose in its response)
and makes the final file readable inside the non-root pipeline container: local Compose
file secrets are bind mounts and do not reliably remap uid/mode. Its private parent
directory protects the source file from other host users. Do not commit tokens
or paste them into a chat. Recreating/replacing the secret file requires restarting
the pipeline container. The application accepts _TOKEN_FILE or _TOKEN, not
both, and never puts the token in model prompts, outputs, or diagnostics.
3. Authenticate OpenCode, then start the server
docker compose build pipelines
docker compose run --rm --no-deps --entrypoint opencode pipelines auth login
docker compose up -d
docker compose logs -f pipelines
Select OpenCode Go and follow its authentication flow. Credentials are stored
in the dedicated opencode-home volume, separate from your host account. These
container commands are not tested here. The image includes Go/git for the
existing narrowly approved verification tools; the actual server runs as uid 10001.
The Docker workspace is persistent and separate from your host checkout.
Connect the native TUI:
go run ./cmd/pipelines-tui -url ws://127.0.0.1:8081/connect
If the TUI is on another machine, use an SSH/VPN tunnel instead of exposing the
unauthenticated pipeline port publicly. The bundled examples are not automatically
submitted. Copy examples/anime-digest.md into an editor draft to create that
pipeline; submitting activates its daily 19:00 schedule.
4. Android
Install ntfy, add the custom server http://192.168.1.20:8090 (or your HTTPS/VPN
URL), sign in as phone-reader, and subscribe to pipelines. This is the single
system-wide notification topic, shared by every pipeline. Grant notifications
and background operation as required by your Android app/device. Outside your
LAN, enable the VPN or use your HTTPS address. localhost on Android is the
phone, not your server. No iOS/APNS upstream is needed for this Android setup.
Use the app to confirm a test notification and download an attachment before relying on unattended schedules. This phone/background-delivery check has not been performed. Attachments/messages expire after seven days in this config.
Existing data and rebuilds
The containers initially use a fresh SQLite database; the host's pipelines.db
is left untouched. To migrate, first stop the host pipeline server (preventing
two schedulers), make a consistent SQLite backup, and import it into the stopped
container's /data/pipelines.db. Copying only a live .db without its WAL is
unsafe. Do not import over an existing container database without backing it up.
The database import and OpenCode session-recovery implications are not tested.
Rebuild executable changes with docker compose up -d --build pipelines.
The workspace volume does not automatically replace its existing source tree
on image rebuild; back it up and update it explicitly if you need new source for
Go verification. Do not delete it casually: it may contain user-created artifacts.
compose.yaml currently uses ntfy's latest tag; pin a tested version/digest
before production. OpenCode is pinned to 2.0.20.