Expand description
Dev servers that outlive their container.
A container agent’s dev server is a process in its container, so it goes when the container is recreated
(an AgentMux upgrade, an image update). An agent that registers one with the command that starts it
(RegisterDevServer with command) has AgentMux start it and keep it up: when the container next runs a turn
and the server is not listening, srv runs the command again, detached, in the same folder, and registers the
route with the container’s new address. What is remembered is the command the agent itself gave, and it only
ever runs in the container it was registered from.
Structs§
- Spec
- One dev server to keep up.
- Store
- The dev servers kept up, in a file in this instance’s data folder (which an upgrade keeps, and no other channel or checkout shares) so they outlive srv too.
Enums§
- Route
Error - Why a route to a container’s dev server can’t be made.
Functions§
- bring_
up - Make sure
spec’s server is listening: start it if it isn’t, and wait up to the startup wait. - clean_
command - A command worth running: not empty, and short enough to be one.
- clean_
dir - The folder a command runs in:
/workspace/..., or a path relative to it; nothing that leaves it. - restore_
in_ background - Start the dev servers kept up in
containerthat aren’t listening, and register their routes, without holding up the caller. Called when the container is ready for a turn. One restore runs per incarnation of the container: a turn while it is still going has nothing to add, but a container that was recreated meanwhile is restored afresh. - route_
target - How the proxy reaches
portincontainer: its address on the agents network, or through the relay where the daemon runs in a VM and that address isn’t routable from here. - route_
when_ listening - Register
spec’s route once its server listens, in the background; for a server too slow to wait for in a request. - start
- Start
spec’s command unless the server is listening already or was started within the startup wait. Withonly_if_kept(a restore), nothing is started once the agent has dropped the project or replaced its registration, however long this waited. - store
- The store every dev server is kept in.
- wait_
listening - Whether
spec’s server is listening withinwait.