Documentation
¶
Overview ¶
Package router describes mutti's machine-wide reverse proxy: one Traefik container that owns the HTTP(S) ports on loopback and routes hostnames to instances. Traefik reads its routes from files mutti renders; it gets no access to the Docker socket.
Index ¶
Constants ¶
const ( Role = "router" LabelVersion = "mutti.router.version" )
Labels and roles of the router container.
const ConfigFile = "/etc/mutti/dynamic/mutti.yml"
ConfigFile is where mutti puts the routes inside the router container. mutti copies it in through the Docker API, so it needs no path on the host: that works the same from inside a container, with Docker Desktop and on any OS.
const Image = "traefik:v3.6.25@sha256:31267173a15b4944e797a76ffd9c419707c8d8b32fe5b610f80cd0cfa05f372d"
Image is the Traefik release the router runs, pinned by digest.
const ReadyHost = "mutti-ready.internal"
ReadyHost is the host the router answers ReadyPath on. No instance route matches it: on an instance's own host, a catch-all route (a single-page app answering every path) would answer the probe while the router still runs the previous configuration.
Variables ¶
This section is empty.
Functions ¶
func ReadyPath ¶
ReadyPath is the path under which the router answers on ReadyHost once it loaded the configuration with the given token.
func Render ¶
Render returns the Traefik dynamic configuration of all routed instances, certificates inline, and its token: a hash of the content, which the configuration also serves under ReadyPath on ReadyHost. Seeing that path answer proves Traefik loaded exactly this version. JSON is valid YAML, which Traefik's file provider reads; encoding/json keeps it deterministic and correctly quoted.
func Spec ¶
func Spec(s Settings) engine.ContainerSpec
Spec returns the container spec of the router. Its version label changes whenever anything in the spec changes, which is the only reason mutti ever replaces a running router.
Types ¶
type Instance ¶
type Instance struct {
Name string
MainHost string
Routes []Route
CertPEM []byte // certificate for MainHost and *.MainHost
KeyPEM []byte
}
Instance is everything the router needs to serve one instance.