Documentation
¶
Overview ¶
Package proxy owns Traefik: it runs the Traefik container and writes its dynamic file-provider config. One YAML file per app, atomic writes. Containers get a stable network alias (app-<id8>) so config survives redeploys without rewriting.
Index ¶
- func StackMiddlewareName(stackID, name string) string
- func TileAlias(tileID string) string
- type AccessEntry
- type Proxy
- func (p *Proxy) AccessLog(tileID string, limit int) []AccessEntry
- func (p *Proxy) CurrentStatic() string
- func (p *Proxy) EnsureTraefik(ctx context.Context) error
- func (p *Proxy) RemoveApp(appID string) error
- func (p *Proxy) Resync(ctx context.Context) error
- func (p *Proxy) SyncCustomDynamic(entries map[string]string) error
- func (p *Proxy) WriteApp(app *repo.Tile, domains []repo.Domain) error
- func (p *Proxy) WriteRegistry(host string) error
- func (p *Proxy) WriteStackMiddlewares(s *repo.Stack) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StackMiddlewareName ¶ added in v0.2.0
StackMiddlewareName is the traefik name of one entry in a stack's proxy.middlewares. Keyed on the stack id, not its slug: slugs repeat across orgs and change on rename, and either would silently point a router at someone else's middleware or at nothing.
Types ¶
type AccessEntry ¶
type AccessEntry struct {
Time time.Time
Method string
Path string
Status int
MS int64
Client string
}
AccessEntry is one HTTP request that Traefik routed to a tile.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) AccessLog ¶
func (p *Proxy) AccessLog(tileID string, limit int) []AccessEntry
AccessLog returns the tile's most recent proxied requests, newest first. scans the last 2MB of the shared access log, indexing per tile can come with the proper logs viewer.
func (*Proxy) CurrentStatic ¶
CurrentStatic is the traefik.yml actually on disk, the generated config, or the operator override when one is active.
func (*Proxy) EnsureTraefik ¶
EnsureTraefik writes static config and starts the managed Traefik container if it is not already running.
func (*Proxy) Resync ¶
Resync regenerates every app's dynamic config from the DB, heals a wiped or restored data dir at boot.
func (*Proxy) SyncCustomDynamic ¶
SyncCustomDynamic materializes the named entries as dynamic/custom-<name>.yml and prunes custom-*.yml files no longer declared. Traefik's file provider watches the directory, so no restart is needed.
func (*Proxy) WriteApp ¶
WriteApp writes the dynamic config for an app's domains (or removes it when no domains exist). A non-empty TraefikOverride replaces the generated config verbatim, the DB stays the source of truth, this is just the render.
func (*Proxy) WriteRegistry ¶
WriteRegistry routes a TLS domain to the managed registry container (alias "registry" on the stackr network). Empty host removes the route.
func (*Proxy) WriteStackMiddlewares ¶ added in v0.2.0
WriteStackMiddlewares writes a stack's proxy.middlewares as dynamic/stack-<id>.yml, or removes the file when it has none. The bodies are the operator's raw traefik config; only the names are rewritten.