Skip to content

feat: background mode for ollama_tailnet - #46

Merged
wu-json merged 2 commits into
mainfrom
feat/ollama-tailnet-detach
Nov 1, 2026
Merged

wu-json merged 2 commits into
mainfrom
feat/ollama-tailnet-detach

Conversation

@wu-json

@wu-json wu-json commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a background mode to ollama_tailnet:

ollama_tailnet          # foreground, ctrl-c to stop (unchanged)
ollama_tailnet up -d    # background, restarts with Docker
ollama_tailnet down     # stop either mode
ollama_tailnet status

Changes

  • -d / --detach runs both containers with --restart unless-stopped instead of --rm, runs the startup checks in the foreground, then returns.
  • Caddy and Tailscale now share a Docker network (ts-ollama) instead of Caddy joining the Tailscale container's network namespace. With a shared namespace, restarting the Tailscale container would leave Caddy without a network; now each restarts independently. Serve proxies to http://ts-ollama-proxy:8080.
  • Warns about what won't survive a reboot in background mode: OrbStack not set to start at login, or an ollama serve the function started itself (rather than the Ollama app).
  • down also removes the network; status says "not running" instead of a Docker error.

Testing

All against a loopback-only Ollama, with HTTPS requests over the tailnet:

  • Foreground: starts, serves, real ctrl-c (pty) removes both containers.
  • Overlapping foreground runs: first stops cleanly, second keeps serving.
  • up -d: returns, keeps serving; still serves after restarting Caddy alone, Tailscale alone, and a full OrbStack stop/start.
  • Foreground up while -d is running replaces it; ctrl-c leaves nothing behind.
  • down removes both containers and the network.
  • Both reboot warnings show when expected (Ollama started by the function vs. already running via the app).

Reviewed with Codex over 2 rounds; the last round had no findings.

🤖 Generated with Claude Code

wu-json and others added 2 commits November 1, 2026 10:06
`ollama_tailnet up -d` (or `ollama_tailnet -d`) runs the proxy in the
background with --restart unless-stopped, so it keeps serving after the
terminal closes and comes back when Docker restarts. `down` stops it.

Caddy and Tailscale now share a Docker network instead of Caddy joining
the Tailscale container's network namespace, so each container can
restart on its own. Warns when OrbStack isn't set to start at login,
since the containers can't come back after a reboot without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The containers restart with Docker, but an `ollama serve` started by the
function doesn't survive a reboot. Warn about that in background mode,
alongside the OrbStack start-at-login warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wu-json
wu-json merged commit 2be11d6 into main Nov 1, 2026
1 check passed
@wu-json
wu-json deleted the feat/ollama-tailnet-detach branch November 1, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant