proxy

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func StackMiddlewareName added in v0.2.0

func StackMiddlewareName(stackID, name string) string

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.

func TileAlias

func TileAlias(tileID string) string

TileAlias is the tile's globally-unique DNS alias. Traefik sits on every environment network, so its target must be unique across envs (plain slugs are only unique within one env). Must match envnet.TileAlias.

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 New

func New(clus *cluster.Cluster, store repo.Store, dataDir, httpPort, httpsPort, acmeEmail, panelURL, panelHost string, noTLS bool) *Proxy

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

func (p *Proxy) CurrentStatic() string

CurrentStatic is the traefik.yml actually on disk, the generated config, or the operator override when one is active.

func (*Proxy) EnsureTraefik

func (p *Proxy) EnsureTraefik(ctx context.Context) error

EnsureTraefik writes static config and starts the managed Traefik container if it is not already running.

func (*Proxy) RefreshCloudflare added in v0.4.0

func (p *Proxy) RefreshCloudflare(ctx context.Context) error

RefreshCloudflare fetches Cloudflare's ranges and caches them in cloudflare_cidrs. The cache is untouched on failure.

func (*Proxy) RemoveApp

func (p *Proxy) RemoveApp(appID string) error

RemoveApp deletes an app's dynamic config file.

func (*Proxy) Resync

func (p *Proxy) Resync(ctx context.Context) error

Resync regenerates every app's dynamic config from the DB, heals a wiped or restored data dir at boot.

func (*Proxy) SyncCustomDynamic

func (p *Proxy) SyncCustomDynamic(entries map[string]string) error

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

func (p *Proxy) WriteApp(app *repo.Tile, domains []repo.Domain) error

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

func (p *Proxy) WriteRegistry(host string) error

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

func (p *Proxy) WriteStackMiddlewares(s *repo.Stack) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL