Documentation
¶
Overview ¶
Package proxyinstall plans and applies the start of a managed reverse proxy container through the Docker Engine API.
Index ¶
Constants ¶
View Source
const ( EnvTraefikImage = "APP_PROXY_TRAEFIK_IMAGE" DefaultTraefikImage = "traefik:v3.3.5" )
EnvTraefikImage overrides DefaultTraefikImage, the pinned official image.
View Source
const ( EntrypointHTTP = "web" EntrypointHTTPS = "websecure" CertResolver = "letsencrypt" UpstreamHost = "host.docker.internal" LabelManaged = "managed-by" HTTPPort = 80 HTTPSPort = 443 RestartUnlessStopped = "unless-stopped" ProviderTraefik = "traefik" )
Fixed names of the proxy's own entry points and certificate resolver.
View Source
const ( CodeUnsupportedProvider = "unsupported_provider" CodeInContainer = "control_plane_in_container" CodePortBusy = "port_in_use" CodeOwnIngress = "port_held_by_builtin_ingress" CodeNameTaken = "container_name_taken" CodeNoDataDir = "no_data_dir" )
Refusal codes a plan can carry.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docker ¶
type Docker interface {
InspectByName(ctx context.Context, name string) (*docker.ContainerState, error)
Create(ctx context.Context, spec docker.ContainerSpec) (string, error)
Start(ctx context.Context, id string) error
ListLocalContainers(ctx context.Context) ([]docker.LocalContainer, error)
}
Docker is the slice of the Engine API the install needs.
type Input ¶
type Input struct {
Provider string
Image string
Brand string
DataDir string
PublicCerts bool
ACMEEmail string
}
Input is everything the plan depends on.
type Installer ¶
type Installer struct {
Docker Docker
// PortHolder names what listens on a host TCP port, "" when free.
PortHolder func(ctx context.Context, port int) string
// OwnIngressPorts are the host ports the built-in ingress binds.
OwnIngressPorts func() []int
// InContainer is true when the control plane itself runs in Docker, so
// its data dir is not a host path a new container could mount.
InContainer bool
MkdirAll func(path string, perm os.FileMode) error
WriteFile func(path string, data []byte, perm os.FileMode) error
}
Installer plans and applies the install. Every host fact is injected.
type Mount ¶
type Mount struct {
Host string `json:"host"`
Container string `json:"container"`
ReadOnly bool `json:"read_only"`
}
Mount is one bind mount of the container.
type Plan ¶
type Plan struct {
Provider string `json:"provider"`
Container string `json:"container"`
Image string `json:"image"`
Ports []int `json:"ports"`
Mounts []Mount `json:"mounts"`
Files []File `json:"files"`
Labels map[string]string `json:"labels"`
Restart string `json:"restart"`
RouteDir string `json:"route_dir"`
Resolver string `json:"cert_resolver"`
Upstream string `json:"upstream_host"`
Refusal *Refusal `json:"refusal,omitempty"`
}
Plan is the exact install: nothing in it is decided at apply time.
func (Plan) Spec ¶
func (p Plan) Spec() docker.ContainerSpec
Spec converts the plan to the Docker container spec.
Click to show internal directories.
Click to hide internal directories.