feat: add gateway to OSS docker deploy with auto-registration#854
Open
harshithmullapudi wants to merge 8 commits into
Open
feat: add gateway to OSS docker deploy with auto-registration#854harshithmullapudi wants to merge 8 commits into
harshithmullapudi wants to merge 8 commits into
Conversation
Adds a Docker Compose overlay that lets users bring up the CoreBrain
gateway alongside the core stack with a single two-file compose command.
The gateway joins the internal `core` network so it talks to the webapp
at http://core:3000 without exposing the API publicly, and uses
${GATEWAY_VERSION:-latest} to allow version pinning via .env.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…setup Covers quick-start (core only), running both compose files with -f, env var wiring, auto-registration via DEFAULT_GATEWAY_URL, and how to retrieve the auto-generated security key from container logs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…setup Also pass DEFAULT_GATEWAY_URL, DEFAULT_GATEWAY_NAME, COREBRAIN_GATEWAY_SECURITY_KEY env vars through to the core service in docker-compose.yaml so auto-registration works. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When DEFAULT_GATEWAY_URL and COREBRAIN_GATEWAY_SECURITY_KEY env vars are set, every newly-created workspace automatically registers the configured gateway with no user action required. Registration failures are logged but never block workspace creation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename DEFAULT_GATEWAY_URL → COREBRAIN_DEFAULT_GATEWAY_URL - Rename DEFAULT_GATEWAY_NAME → COREBRAIN_DEFAULT_GATEWAY_NAME - Add COREBRAIN_DEFAULT_GATEWAY_SECURITY_KEY (distinct from the gateway container's own COREBRAIN_GATEWAY_SECURITY_KEY, same value) - Add defensive try/catch at workspace.server.ts call site - Update .env.example, docker-compose.yaml passthrough, and README Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 tests covering: - Guard conditions (missing URL, key, both, empty string) - Successful registration with correct args - Custom gateway name from env - Success logging - Failure logging (ok: false) - Error resilience (registerGateway throws → logged, not re-thrown) - Idempotency pass-through to registerGateway Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Delete hosting/docker/docker-compose.gateway.yaml (duplicate overlay)
- Update README to instruct running both compose files from the repo root:
docker compose \
-f hosting/docker/docker-compose.yaml \
-f hosting/gateway/docker-compose.yaml \
up -d
- Document network topology: gateway reaches webapp via host-exposed port
(COREBRAIN_API_URL), not Docker internal DNS, since the two services are
on different Docker networks
- Update .env.example: COREBRAIN_API_URL + COREBRAIN_DEFAULT_GATEWAY_URL
now documented with host.docker.internal examples instead of Docker
service-name addresses
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gateway compose overlay (
hosting/docker/docker-compose.gateway.yaml): new file that adds thecorebrain-gatewayservice to the OSS stack when run with-f. The gateway joins the existingcoreDocker network so it can reach the webapp athttp://core:3000internally. Includesdepends_on: core, shared logging config, andplatform: linux/amd64note..env.exampleupdated (hosting/docker/.env.example): documents all gateway env vars in one place —COREBRAIN_GATEWAY_SECURITY_KEY,COREBRAIN_API_KEY,COREBRAIN_DEFAULT_GATEWAY_*for auto-registration,GATEWAY_VERSION,COREBRAIN_GATEWAY_HTTP_PORT, agent credentials.Docs added (
hosting/docker/README.md): operator guide covering quick start, two-file compose invocation, env var wiring table, auto-registration setup, and first-boot key-from-logs flow.Webapp auto-registration (3 files): when
COREBRAIN_DEFAULT_GATEWAY_URLandCOREBRAIN_DEFAULT_GATEWAY_SECURITY_KEYare both set, the webapp callsregisterGateway()for every new workspace created. Idempotent (re-registration updates the existing row). Never fails workspace creation — errors are caught and logged with[default-gateway]prefix.Usage
New env vars (webapp)
COREBRAIN_DEFAULT_GATEWAY_URLCOREBRAIN_DEFAULT_GATEWAY_SECURITY_KEYCOREBRAIN_DEFAULT_GATEWAY_NAMElocal-gateway)Files changed
hosting/docker/docker-compose.gateway.yamlhosting/docker/.env.examplehosting/docker/README.mdhosting/docker/docker-compose.yamlCOREBRAIN_DEFAULT_GATEWAY_*to core serviceapps/webapp/app/env.server.tsapps/webapp/app/services/gateway/default.server.tsmaybeRegisterDefaultGateway(36 lines)apps/webapp/app/models/workspace.server.tscreateWorkspace()Test plan
docker compose -f docker-compose.yaml -f docker-compose.gateway.yaml up -dstarts both services without errorlocalhost:7787COREBRAIN_DEFAULT_GATEWAY_URL=http://corebrain-gateway:7787andCOREBRAIN_DEFAULT_GATEWAY_SECURITY_KEY=<key>causes the gateway to appear in the workspace sidebar after signup🤖 Generated with Claude Code