Skip to content

ADR-0001. Traefik label-based dynamic routing over a static route table

FieldValue
StatusAccepted
Date2025-01-20
Deciders@platform
Supersedes

Context

  • The platform runs ~13 backend services in Docker Compose, each owning its own /v1/api/<svc> prefix; the set grows over time.
  • A hand-maintained central route table drifts: every new service or port change needs a coordinated edit + gateway reload.
  • We want zero gateway redeploy when a service is added, and a mechanical migration path to Kubernetes.
  • Each service already sets APP_ENV_SERVER_BASE_PATH=/v1/api/<svc> — routing is fully derivable from the service itself.

Decision

We will use Traefik v3.6 with the Docker provider: each service self-registers its router, load-balancer port, health check, and middleware references via Docker labels. There is no central route table in the production proxy layer.

Consequences

ProsCons
New service routes appear automatically — no gateway config changeRouting is decentralized; the full route map lives across many compose files
Labels convert mechanically to Traefik IngressRoute CRDs for K8sPathPrefix is a pure prefix match — overlaps need explicit priority (see Routing)
Built-in resilience (circuit breaker, rate limit, health checks) without pluginsTraefik adds a dependency on the Docker socket
Hot-reload of shared middlewares via the file providerShared middlewares must use the @file suffix or fail silently

Alternatives Considered

OptionProsConsWhy rejected
Static central route table (Nginx/HAProxy file)One file to read; predictableManual edit + reload per change; driftsOperational toil; no auto-discovery
Kong / APISIX (DB/etcd-backed routes)Rich plugin ecosystemRequires PostgreSQL/etcd; heavier footprintOperational overhead for a gateway-only need
Envoy (xDS)Most powerful, mesh-readyHighest config complexity; no Docker label discoveryOverkill without a service mesh

References

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.