Skip to content

Build the box environment in the core, and reach the proxy control channel by URL - #113

Merged
splitbrain merged 1 commit into
splitbrain:mainfrom
splitbrain-bot:proxy-url
Oct 11, 2026
Merged

splitbrain merged 1 commit into
splitbrain:mainfrom
splitbrain-bot:proxy-url

Conversation

@splitbrain-bot

Copy link
Copy Markdown

Part of #109 (step 2).

Changes

  • The core builds the full environment of a box as a plain record, in boxEnv of the new orchestrator/src/boxenv.ts:
    the harness variables, the credential placeholders, the git identity, TERM, the proxy variables and the CA
    variables. Empty values are dropped there. Before, credentialEnv in docker.ts built the placeholders and the
    identity, and boxEnv in docker.ts added the rest and made the KEY=value list. createContainer now only converts
    the record to the list. The field caCertificate of CreateContainerSpec is gone; the CA is part of the record.
  • The proxy URL comes from the runtime: proxyUrl(cfg) in docker.ts makes it from EGRESS_PROXY_ALIAS and
    EGRESS_PROXY_PORT. The core passes it into boxEnv.
  • The orchestrator reaches the control channel of the proxy at the URL EGRESS_CONTROL_URL (default
    http://boxes-egress-proxy:3129, must be an http: URL). Before, it was built from EGRESS_PROXY_CONTAINER and
    EGRESS_CONTROL_PORT. EGRESS_CONTROL_PORT is gone. EGRESS_PROXY_CONTAINER stays for the attachment of the proxy
    to the box networks and for the image footer.
  • doc/environment.md describes EGRESS_CONTROL_URL instead of EGRESS_CONTROL_PORT.

Breaking change: a deployment that sets EGRESS_CONTROL_PORT must set EGRESS_CONTROL_URL instead. The old
variable is ignored without an error.

Tests

  • Orchestrator: tsc --noEmit is clean, 881 tests passed, 1 skipped (as before). The boxEnv tests moved from
    docker.test.ts to boxenv.test.ts with the same assertions. The egress tests set EGRESS_CONTROL_URL; before, they
    set EGRESS_PROXY_CONTAINER to 127.0.0.1 to reach a local test server. The config test checks the new default.
  • The URL validation was checked by hand: https://x:1 and a non-URL are rejected, an empty value gives the default.

Not tested against a real Docker daemon or a real proxy.

Notes for the next steps

  • Step 7, the Runtime interface. proxyUrl(cfg) in docker.ts becomes Runtime.proxyUrl(). EGRESS_PROXY_ALIAS
    and EGRESS_PROXY_PORT are then details of the Docker runtime. boxEnv in boxenv.ts is the record of section 7 of
    the concept; the Docker runtime converts it with the one line in createContainer. EGRESS_PROXY_CONTAINER is used
    by the proxy attachment in docker.ts and the image footer in images.ts; both move behind the interface.
  • Step 9, Kubernetes. The record of boxEnv becomes the env list of the pod spec without a change. The URL
    EGRESS_CONTROL_URL then names the proxy Service, for example http://boxes-egress-proxy:3129. The orchestrator joins
    the path with new URL(path, EGRESS_CONTROL_URL), so the URL must have no path of its own.

…annel by URL

The Docker code built the environment of a box: it put the proxy URL,
the CA variables and TERM next to the placeholders that the core gave
it, and it made the proxy URL from the alias and the port settings. On
another runtime, this code had to be written again.

The core now builds the full environment as a plain record in boxEnv,
and the Docker code only converts it to its KEY=value list. The proxy
URL comes from the runtime through proxyUrl, because only the runtime
knows how a box reaches the proxy.

The control channel of the proxy was reached at the container name
EGRESS_PROXY_CONTAINER and the port EGRESS_CONTROL_PORT. On a runtime
without container names, this address has no meaning. It is now the
URL EGRESS_CONTROL_URL, with the same default address.

Part of splitbrain#109
@splitbrain
splitbrain merged commit 036cae8 into splitbrain:main Oct 11, 2026
9 checks passed
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.

2 participants