Add route declarations and automatic port allocation #1
Reference in New Issue
Block a user
Delete Branch "mcp-routes-port-allocation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary\n\n- Service definitions can now declare
[[components.routes]]instead of manual port mappings\n- Agent allocates free host ports at deploy time (random 10000-60000, availability check)\n- Containers receive$PORT/$PORT_<NAME>env vars with assigned ports\n- Backward compatible: components with old-styleports=work unchanged\n\n## Changes\n\n- Proto:RouteSpecmessage,routes+envfields onComponentSpec\n- Servicedef:RouteDefparsing and validation from TOML\n- Registry:component_routestable withhost_porttracking\n- Runtime:Envfield onContainerSpec,-eflag inBuildRunArgs()\n- Agent:PortAllocatorwith mutex serialization, deploy wiring for route→port mapping + env injection\n\n## Test plan\n\n- [x] Servicedef: route parsing, validation (duplicate names, missing port, invalid mode), proto round-trip\n- [x] Registry: route CRUD, cascade delete, host_port updates\n- [x] Runtime: BuildRunArgs with env vars\n- [x] Port allocator: allocation, release, double-allocation returns different ports\n- [x] Agent deploy: deploy with routes (verify -p and -e args), deploy with old-style ports (backward compat)\n- [x] All tests pass (go test ./...)