feat(cloudflare): run DO-attached containers in alchemy dev#584
Draft
Butch78 wants to merge 2 commits into
Draft
feat(cloudflare): run DO-attached containers in alchemy dev#584Butch78 wants to merge 2 commits into
Butch78 wants to merge 2 commits into
Conversation
Thread a per-class container image from binding data
(containers: [{ className, imageName }]) through LocalWorkerProvider
into workerd's native container support: each DO namespace with an
attached image gets container: { imageName }, and the worker gets a
localDocker containerEngine pointing at the host's docker socket
(egress sidecar image overridable via ALCHEMY_CONTAINER_EGRESS_IMAGE).
Inert until @distilled.cloud/cloudflare-runtime threads the container
config through to workerd (alchemy-run/cloudflare-tools#46): the
fields typecheck today via spreads and are dropped by the 0.10.12
config assembly, so behavior is unchanged until the catalog bump.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extract the inline className->imageName loop into an exported, documented `collectContainerImages` helper and export `toRuntimeDurableObjectNamespaces`, then cover both with unit tests (remote-only attachments skipped, className collision, container attached only to mapped namespaces). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Added unit tests in 472532b ( |
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.
Run Durable-Object-attached containers under
alchemy dev, using workerd's native container support against the local Docker daemon (whatwrangler dev/ miniflare do).A worker binds a container class to a DO namespace with an image name; locally that image is started per DO instance and exposed as
ctx.container:containersbinding data gains an optionalimageName; entries without one are remote-only attachments and are ignored locally (ctx.containerstays absent)LocalWorkerProvidermapsclassName -> imageNamefrom binding data, attachescontainer: { imageName }to the matching workerd DO namespace, and configures alocalDockercontainer engine (socketunix:///var/run/docker.sock)cloudflare/proxy-everythingminiflare uses;ALCHEMY_CONTAINER_EGRESS_IMAGEoverrides it (e.g. to work around Containers local dev sidecar can intercept Docker bridge traffic and break readiness cloudflare/workerd#6792 on hosts where TPROXY intercepts bridge-local traffic and hangs the sidecar readiness probe)Draft because it activates only once
@distilled.cloud/cloudflare-runtimethreads the container config through to workerd: alchemy-run/cloudflare-tools#46, then a catalog bump here. The new fields typecheck against 0.10.12 and are dropped by its config assembly, so behavior is unchanged until that lands.Validated end-to-end on the cloudflare-tools#46 runtime: a Rust DataFusion container attached to a DO class under
alchemy devcold-starts on first request, serves proxied traffic, and is destroyed by the DO's idle alarm.