Skip to content

deploy/org: a Docker Compose for a self-hosted codeaf organization - #2894

Closed
AbirAbbas wants to merge 14 commits into
devfrom
w24/org-compose
Closed

AbirAbbas wants to merge 14 commits into
devfrom
w24/org-compose

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

deploy/org/: a Docker Compose that anyone can run to host a codeaf organization themselves. One docker compose up brings up the organization server (codeaf factory serve, team mode), the AgentField control plane, a factory runner that registers the factory on AgentField, SWE-AF and PR-AF. Each service has a volume for its state and a health check, and runs as a non-root user (the container starts as root only to hand a freshly mounted volume to that user, then drops to it). Nothing secret is baked into an image: keys come from .env or the environment. Pins: the codeaf dev release (sha256-checked), SWE-AF and PR-AF commits, the AgentField control-plane image by digest.

The README is a walkthrough a stranger can follow: ./setup.sh, docker compose up -d --build, ./operator-link.sh, claiming the organization, inviting a second person, HTTPS for other people, backups, upgrading the pins, and how the same Dockerfiles run as a Railway project.

Besides deploy/org/, one line in internal/provider/funnel_law_test.go exempts deploy/org/modelstub, the scripted model server of the keyless smoke test, the way test/ is exempt (it answers /chat/completions on purpose and the product never runs it).

Validation contract

  • docker compose up on a clean machine brings every service to healthy.
  • The server prints the operator link; ./operator-link.sh prints it from the log. The link claims the organization once.
  • A second person joins by invite, once; a member cannot change the organization policy.
  • A codeaf client connects with the organization server's URL (it is inside the links).
  • A factory job reaches SWE-AF through AgentField with strict run-owner proofs on (proofs accepted, none refused or accepted unproven).
  • A human question (SWE-AF's plan review) reaches the owner, and the answer resumes the run.
  • PR-AF is registered on AgentField and callable.
  • People, runs and registrations survive docker compose restart.
  • No secret in an image; no long-lived root process (tini as PID 1 only reaps children).

Evidence

./smoke.sh runs all of the above keylessly against a scripted stub model. On a clean down -v, with the five images built from this branch: every section passed (control, organization, factory job, restart of every service, organization after the restart); strict counters proven +845, none refused. The same Dockerfiles were also deployed as a Railway project (remote builders, one volume per service, private networking, a public domain on codeaf only); there the runner ran the control and job sections on itself (RUNNER_SELFTEST=1, proven +817), the organization section ran over the public HTTPS name, and the restart sections passed after restarting codeaf and agentfield.

Known limits (also in the README)

  • The runner is a small Python host of the codeaf engine, because codeaf factory serve does not itself register the factory on AgentField.
  • The server names itself by its listen address, so without CODEAF_PUBLIC_DOMAIN its links say http://[::]:8787; a link is only accepted with exactly the address the server gave it. Fine on the same Linux or macOS machine, not for Windows or other machines; a real deployment serves HTTPS on a name.
  • Behind Railway's proxy CODEAF_TRUSTED_PROXIES=100.64.0.0/10 is required, or every password sign-in is refused as plain HTTP.
  • The organization keeps no canvases (no canvas program in the stack).
  • No desktop app was pointed at it; the join API the app uses is what the smoke test drives.

Draft: not for merge until the lead has looked.

🤖 Generated with Claude Code

AbirAbbas and others added 14 commits November 24, 2026 00:00
…WE-AF and PR-AF

Each image runs a pinned artifact: codeaf from a published dev release checked against its
sha256, the AgentField control plane from its published image (built with sqlite_fts5) pinned
by digest, SWE-AF and PR-AF built from pinned commits of their public repositories. The
containers start as root only long enough to give a platform volume to the service's user,
then run as that user. The runner is the engine host that registers the factory on AgentField.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Railway's builder rejects a cache mount that has no id, and an id has to be
spelled with the service it belongs to, which no portable Dockerfile can know.
The two Go reasoners build in about a minute without the cache, so they build
the same way under Compose and on Railway.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
One `docker compose up` runs the organization server, the AgentField control plane, the factory
runner, SWE-AF and PR-AF, each with a volume for its state, a health check, and a published port only
where a person has to reach it (on 127.0.0.1 unless the operator opens it). The scripted stub model is
an optional profile for a keyless smoke test. setup.sh writes .env with fresh random secrets and never
overwrites one; .env, the model keys and the organization token never enter an image.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The control plane's health check used a glibc busybox that the distroless base is too old to run, so it
is now the static musl one. The reasoner images now name the user they run as, so a platform volume is
handed to the right user and git finds its home (PR-AF was looking in SWE-AF's). The node entrypoint can
make a throwaway repository for the keyless smoke test to plan against.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
smoke.sh starts the stack against the scripted stub model and checks, section by section, that the nodes
are registered, the operator link claims the organization, a second person joins by invite, a factory
job reaches SWE-AF through AgentField with strict run-owner proofs and its plan question is answered by
the owner, and that a restart of every service keeps the people, the runs and the registrations.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…point and never uses a fixed password

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…away, then runs unprivileged

The published image is distroless and runs as uid 65532, so a root-owned platform volume left it unable to
write its database, and the only way round was to run it as root. It now gets the same hand-off as the other
images, done with the one busybox binary it already carries for its health check.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nt the Railway services

A link is only accepted with exactly the address the server names itself by, so rewriting the host in
the printed link broke it. The README now says what that address is on a laptop, and lists the variables
each Railway service takes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ontainer stub, not a send path

deploy/org/modelstub answers /chat/completions on purpose so the keyless smoke test spends nothing; like test/remote/stub
it is built into its own image and the product never runs it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@AbirAbbas

Copy link
Copy Markdown
Collaborator Author

Consolidated into #2903, the org/main feature line. This PR's commits are all on that branch. Closing it here so there is one place to review. Follow-ups go against org/main.

@AbirAbbas AbirAbbas closed this Nov 24, 2026
AbirAbbas added a commit that referenced this pull request Nov 25, 2026
…ack (#2903)

The hosted organisation line: a team-mode org server deciding every request through one access model (verbs, roles, grants and policy in SQLite), hosted chats run by the sessionhost under a per-chat uid inside a Landlock fence with minted model bearers, sealed keys and a git helper, shared chats acting through verbs, bots owned by their creator, the Hosting and chats policy settings, and a self-hosting stack (deploy/org Docker Compose, published images behind a leak gate, a Railway path).

Consolidates #2894 #2895 #2896 #2898 #2899 #2900 and the follow-ups #2904 #2905 #2907 #2908 #2910 #2911 #2912 #2913 #2915 #2916 #2918 #2927 #2936 #2944. Proven by the full suite, a keyless Compose smoke, a hostile wire client, sandbox escape probes, a real-model run and a production-style install from the published images.

Co-Authored-By: Santosh kumar <[email protected]>
Co-Authored-By: ZeroPoint95 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant