feat(tower): Add TOWER_HOST env var to bind to different interfaces#721
feat(tower): Add TOWER_HOST env var to bind to different interfaces#721otherview wants to merge 2 commits intocluesmith:mainfrom
Conversation
|
Thanks for the PR and the clean implementation — tests, docs, and validation are all in good shape. That said, I want to share why Tower binds to For remote access, we have cloud.codevos.ai, which gives you secure remote Tower access from anywhere (not just your local network) with proper auth in front of it. That's the recommended path for the use cases this PR seems aimed at. Could you tell me more about your specific use case? If it's Docker/VM/LAN, cloud.codevos.ai likely solves it better. If there's a scenario it doesn't cover, I'd love to hear it — that would help us figure out the right shape for a future change (which would probably need to come bundled with an auth story rather than a bare env var). |
|
Hi @waleedkadous -thanks for the thoughtful feedback. My blocker is slightly different from “remote Tower access”: I need Tower to orchestrate agents running inside a local sandboxed Docker environment, where the relevant filesystem/services/network only exist in that containerized runtime. ( I don't install / run ai tooling directly on host as a practice 😅 ) Cloud access is useful, but it doesn’t replace local sandbox execution for this workflow. I believe the ask is not really about “expose Tower broadly,” but “support explicit local-container bridging safely.” I also agree a bare host-bind env var is too easy to misuse. I’m happy to rework this in a safer shape, for example:
On that note, I'd be happy to also contribute with my “secure local sandbox” profile to reduce risk for this use case, a Docker/Makefile flow where:
This preserves localhost-only as the secure default in core, while giving users a safer documented path for local containerized execution + host browser access. But likely that would fit in a different PR, let me know what you think ! |
|
Thanks @otherview — the Docker sandbox use case is legitimate, and "AI tooling never on the host" is a really cool way to use Codev. A few thoughts on shape: Naming — frame it as "bridge mode" not "host override" Rather than a generic
This makes the use case self-documenting: anyone reading the env or the code immediately sees "ah, this is for container-bridging," not "this is a generic way to expose Tower." It also makes the docs much clearer — we can write a "Bridge Mode" section rather than burying caveats in a Plus the loud startup warning when bridge mode is enabled, and tightening the IPv6 validation (current regex accepts On the Docker sandbox profile Yes please — separate PR, very welcome. The "secure-by-default container profile with allowlisted mounts and explicit port publishing" is exactly the kind of thing that makes bridge mode safe to use, and it deserves its own focused review. |
Summary
Add
TOWER_HOSTenvironment variable to configure the Tower server bind address.Tower currently hardcodes
127.0.0.1. WithTOWER_HOST=0.0.0.0, Tower binds to all network interfaces, enabling access from other machines on the network (e.g., Docker, VMs, LAN).Changes
server-utils.ts— NewvalidateHost()function that accepts127.0.0.1,0.0.0.0,localhost, valid IPv4, and bracketed IPv6 literals. Rejects hostnames and malformed values with a clear error message.tower-server.ts— ReadsTOWER_HOSTenv var (defaults to127.0.0.1), validates it viavalidateHost(), and passes the result toserver.listen(). When bound to0.0.0.0, log output still showslocalhostfor local UX.tower-host.test.ts— Integration tests covering default behavior,0.0.0.0binding, and invalid host rejection.arch.md/agent-farm.md— Documentation updates for the new env var.Usage