server
server
¶
HTTP gate component wrapping git http-backend with token auth.
Composed by the per-container supervisor as one of its services. The gate serves a single task's repo out of the shared per-project bare mirror, gated on a single minted token.
Token validation
Each request must carry HTTP Basic Auth with the token as the username (password is ignored). The supervisor minted exactly one token for the task this container serves; the requested repo must match the token's scope.
Transport
The supervisor binds the gate on a per-container Unix socket inside
container_runtime_dir (= the in-container /run/terok) in socket
mode, or on a per-container 127.0.0.1 TCP port in TCP mode.
GateServer(*, mirror_root, token, scope, socket_path=None, host=None, port=None)
¶
Per-container git gate, composed by the supervisor alongside the vault.
Serves the task's repo out of the shared per-project bare mirror at
mirror_root, gated on the single token (scoped to scope).
Binds either a per-container Unix socket (socket_path) or a
per-container 127.0.0.1 TCP port (host + port); exactly one
transport must be supplied.
Stateless and self-contained — the only terok dependency is the SELinux socket-labelling helper the Unix listener needs.
Bind the gate's configuration; start brings the listener up.
Source code in src/terok_sandbox/gate/server.py
start()
async
¶
Bind the listener and serve it on a daemon thread.
Source code in src/terok_sandbox/gate/server.py
stop()
async
¶
Stop the listener and join the serving thread.
shutdown() blocks until the accept loop exits, so it runs in
an executor rather than inline on the event loop — calling it on
the loop thread would deadlock.