Skip to content

Replace Caddy with Traefik fully #5052

Closed

Description

@yannickmonney

Goal

Replace Caddy with Traefik in Tale, fully: no Caddy image, Caddyfile, config or doc mention is left in this repository once it lands.

Companion to the ops-side move to Traefik with labels (tale-project/ops#143).

Where Caddy is today (from a code search, not exhaustive)

  • services/proxy/: Caddyfile, Dockerfile, docker-entrypoint.sh, README. This is the service itself.
  • tools/cli/src/lib/compose/: services/create-proxy-service.ts, generators/constants.ts, generators/generate-stateful-compose.ts; tools/cli/src/lib/deployment/runtime-model.ts, runtime-prepare.ts; tools/cli/src/lib/backup/constants.ts.
  • Docs in all three locales (docs/en, docs/de, docs/fr): self-hosted/overview.md, self-hosted/configuration/tls-and-domains.md, self-hosted/install/kubernetes.md, self-hosted/install/own-compose.md, develop/contributing-docker.md, self-hosted/operate/backups-and-restore.md.
  • Smaller mentions: services/docs/server.ts, services/platform/README.md, services/web/README.md, services/ui-docs/README.md, tools/load/README.md, scripts/performance/, and a few comments in services/platform (lib/webdav, lib/utils/link-classifier.ts, backend/auth/sign-up-gate.ts, backend/lib/conditional-get.ts).

What the move has to keep

  • Automatic HTTPS / ACME for the configured domains, including the self-signed and internal-name paths the docs describe.
  • Everything the Caddyfile does for the platform today: routing per service, WebDAV/WebSocket pass-through, headers, compression, caching headers, health endpoint.
  • Routing declared with container labels, so a service owns its own route; tale CLI generators emit the labels instead of a Caddyfile.

Open questions

  • Traefik's label-based discovery needs a provider. Which one serves a Compose install, and what does the Kubernetes install use instead (Ingress/IngressRoute)?
  • Migration for existing installs: certificates and tale upgrade path from the Caddy data volume.

Done when

  • git grep -i caddy returns nothing outside the changelog.
  • Install, upgrade and the docs in en/de/fr are exercised on a real Compose install and the Kubernetes path.
  • The proxy service's tests and the CLI generator tests cover the labels.

Activity

  1. added
    improvement
    service: proxy
    agent-ready
    on Oct 24, 2026
  2. tale-review-bot commented on Oct 31, 2026

    @tale-review-bot
    Collaborator

    Decision: TALE-226 / #5052. A Compose install uses Traefik's Docker provider through a read-only Docker API proxy, and never mounts the socket into Traefik. Kubernetes uses the standard Ingress provider. The issue is split in four, and this task is part 1.

    Question. Which provider serves Traefik's label discovery on a Compose install, and what does the Kubernetes install use instead? This is triage's question of 2026-10-29 11:31 UTC.

    Options weighed (checked at tale-project/tale main df6105cef08a78084439c029d5917611c4adcf54):

    • (a) The Docker provider with /var/run/docker.sock mounted into Traefik. This is the simplest option. Its cost is that the one container that faces the internet, holding ports 80 and 443 (tools/cli/src/lib/compose/services/create-proxy-service.ts:13), would hold host root. Today that boundary sits only in the sandbox, which is not public, and the code says so explicitly (tools/cli/src/lib/compose/services/create-sandbox-service.ts:10-11,133). The proxy has no socket today (create-proxy-service.ts:14). Rejected: it widens what the edge can do from routing to controlling the host.
    • (b) The Docker provider behind a Docker API proxy that allows only reads. Labels keep working the way the issue and tale-project/ops#143 want them to, so each service owns its own route. Traefik reaches the Docker API only through a proxy on an internal network, and that proxy answers only the read endpoints the provider uses. The cost is one more small container and its allowlist to maintain.
    • (c) The file provider, with tale writing the dynamic configuration. This needs no Docker API at all. It drops the "routing declared with container labels" requirement of the issue, though, and it departs from the ops move. For an install built with the operator's own Compose file (self-hosted/install/own-compose.md), routes would again live outside the services.

    Decided: (b), the narrowest option that still reaches the outcome the issue asks for:

    • Traefik never mounts the Docker socket. It reads the Docker API through a proxy service of Tale's. That service is built from an official base image (nginx or HAProxy, the Coder's choice), pinned like Tale's other images, and its allowlist configuration lives in this repository. Do not use a third-party socket-proxy image: the one container that holds the socket must run only code Tale can audit.
    • The allowlist permits only GET/HEAD on the endpoints Traefik's Docker provider reads: version, ping, the container list and inspect, events, and networks if the provider needs them. It refuses everything else.
    • The socket proxy sits only on an internal: true network shared with Traefik. It publishes no port, and no other service joins that network.
    • Traefik runs with exposedByDefault=false. A constraint on the install's own Compose project label (com.docker.compose.project) stops a foreign container on the same host from claiming a route on Tale's edge by setting labels.
    • Kubernetes: the standard Ingress provider (networking.k8s.io/v1), limited to the tale namespace, with the narrowest read-only RBAC that works. Use the IngressRoute CRD only where a plain Ingress cannot express a route the Caddyfile serves today, and name that route in the plan. This is Run the Kubernetes install's edge on Traefik with standard Ingress objects #5210.
    • Existing installs keep the Caddy volumes until the new proxy serves, so a rollback still works. Importing the certificates or issuing them again through ACME is the Coder's choice, within the issuer's rate limits. This is Upgrade existing Compose installs from the Caddy proxy to Traefik #5209.
    • Dependencies and licensing: the issue's author, a maintainer, asks for Traefik by name. Traefik (MIT) and the official base image run unmodified as separate containers, the way Caddy (Apache-2.0) does today, so they raise no licensing question for Tale (MIT). Pin each by digest.

    Split, as triage proposed:

    1. This task: the Traefik proxy service, and the tale CLI generators emitting labels for a Compose install, together with the socket proxy above. It keeps everything the Caddyfile does today: routing per service, WebDAV and WebSocket pass-through, headers, compression, caching headers, the health endpoint, and ACME, including the self-signed and internal-name paths.
    2. Upgrade existing Compose installs from the Caddy proxy to Traefik #5209: upgrading existing Compose installs from the Caddy volume.
    3. Run the Kubernetes install's edge on Traefik with standard Ingress objects #5210: the Kubernetes edge on Traefik with standard Ingress objects.
    4. Describe the Traefik proxy in the en/de/fr docs and remove the remaining Caddy mentions #5211: the en/de/fr docs and the remaining Caddy mentions, which ends with git grep -i caddy empty outside the changelog.

    0.6.0 must not ship with part 1 unless part 2 has also landed on release/0.6, because existing installs must be able to upgrade. Until part 4 lands, docs that still describe Caddy are acceptable on the feature line.

    Done for this task when:

    • The generator tests cover the labels for every routed service, exposedByDefault=false and the project constraint.
    • A test proves that the socket proxy refuses a POST (for example /containers/create) and an endpoint not on its list, and answers the read endpoints Traefik needs.
    • The proxy service's tests cover what the Caddyfile did: routes, pass-through, headers, compression, caching and health.
    • A Compose install started from the generated files serves the platform over HTTPS through Traefik. Where the worker cannot run Docker, what was not run is written down, and the train's CI runs the rest.

    Left to the Coder:

    • the socket proxy's base image and how it is configured;
    • how the generators lay out the labels;
    • the Traefik version, from a current stable release;
    • the order of the commits inside the task.

    The squash message ends with Closes #5052. The rest of the issue lives in #5209, #5210 and #5211, which are named on #5052 and close with their own commits.

    Line: feature

    Not reached: tale-project/ops#143 is unavailable to the Lead's credential, so this decision does not depend on its details.

    What would change this decision: a person's answer on this task or on #5052. Another would be evidence that the ops side settles on a provider that cannot share routes with (b). A third would be Traefik's Docker provider needing a Docker API write, which would reopen the choice of the file provider (c).

    How this task lands now: branch from origin/<the train of its line>
    (train or feature-train) and record that commit as the base; open no pull
    request, and close one the task still has. Hand over on this task (train,
    branch, full head, base, the gate you ran, and the squash message ending with
    Closes #<n> or Refs #<n>), then move it to In review. The Lead's decision
    above settles what the task asked a person; a technical choice is yours to make
    and record in the plan (Development's "Who decides"). This replaces whatever an
    older copy of the instructions earlier in this task's conversation says.

  3. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    Collaborator

    TALE-226 (part 1) split off one more part: #5282, feat(cli): prepare managed runtimes for the Traefik edge. The managed runtime that tale deploy prepares reads and rewrites services/proxy/Caddyfile at the pinned revision. Part 1 keeps that working for 0.5 sources and refuses a source that has no Caddyfile, with a clear message. #5282 teaches the managed runtime the Traefik topology.

    The parts of #5052 are now part 1 (TALE-226), #5209, #5210, #5211 and #5282.

  4. 20 remaining items

  5. added 13 commits that reference this issue on Nov 2, 2026
    9fe5d78
    e980be1
    079b2a2
    ee20f64
    6277569
    90d068f
    a500f0a
    af17b56
    3ae6f64
    344b543
    4b739fe
    aeab8ce
    6c9eba1
  6. added a commit that references this issue on Nov 15, 2026
    61ddae4
  7. added a commit that references this issue on Nov 23, 2026
    7c5df38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyimprovementservice: proxy

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions