caddy_docker_upstreams

package module
v0.0.0-...-b5895f6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Docker Dynamic Upstreams for Caddy.

This package implements a docker dynamic upstreams module for Caddy.

Requires Caddy 2+.

Docker Labels

This module requires the Docker Labels to provide the necessary information.

  • com.caddyserver.http.enable should be true
  • com.caddyserver.http.upstream.port specify the port

As well as the labels corresponding to the matcher.

Label Matcher
com.caddyserver.http.matchers.protocol protocol
com.caddyserver.http.matchers.host host
com.caddyserver.http.matchers.method method
com.caddyserver.http.matchers.path path
com.caddyserver.http.matchers.query query
com.caddyserver.http.matchers.expression expression

Here is a docker-compose.yml example with vaultwarden.

vaultwarden:
  image: vaultwarden/server:${VAULTWARDEN_VERSION:-latest}
  restart: unless-stopped
  volumes:
    - ${VAULTWARDEN_ROOT}:/data
  labels:
    com.caddyserver.http.enable: true
    com.caddyserver.http.upstream.port: 80
    com.caddyserver.http.matchers.host: vaultwarden.example.com
  environment:
    DOMAIN: https://vaultwarden.example.com

Syntax

List all your domain or use On-Demand TLS.

app1.example.com,
app2.example.com,
app3.example.com {
    reverse_proxy {
        dynamic docker
    }
}

Documentation

Index

Constants

View Source
const (
	LabelMatchProtocol   = "com.caddyserver.http.matchers.protocol"
	LabelMatchHost       = "com.caddyserver.http.matchers.host"
	LabelMatchMethod     = "com.caddyserver.http.matchers.method"
	LabelMatchPath       = "com.caddyserver.http.matchers.path"
	LabelMatchQuery      = "com.caddyserver.http.matchers.query"
	LabelMatchExpression = "com.caddyserver.http.matchers.expression"
)
View Source
const (
	LabelEnable       = "com.caddyserver.http.enable"
	LabelUpstreamPort = "com.caddyserver.http.upstream.port"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Upstreams

type Upstreams struct {
	// contains filtered or unexported fields
}

Upstreams provides upstreams from the docker host.

func (Upstreams) CaddyModule

func (Upstreams) CaddyModule() caddy.ModuleInfo

func (*Upstreams) GetUpstreams

func (u *Upstreams) GetUpstreams(r *http.Request) ([]*reverseproxy.Upstream, error)

func (*Upstreams) Provision

func (u *Upstreams) Provision(ctx caddy.Context) error

func (*Upstreams) UnmarshalCaddyfile

func (u *Upstreams) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile deserializes Caddyfile tokens into u.

dynamic docker

Jump to

Keyboard shortcuts

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