deploy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package deploy manages Caddy as an automatic TLS reverse proxy. Caddy is started as a managed subprocess with a generated Caddyfile. Auto-TLS via Let's Encrypt is enabled by default when a domain is provided.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Domain is the public domain name, e.g. "example.com".
	// When set, Caddy enables automatic HTTPS via Let's Encrypt.
	Domain string

	// Email is the ACME account email for Let's Encrypt notifications.
	Email string

	// AppAddr is the address your Go app listens on (Caddy proxies to this).
	// Default: "localhost:8080"
	AppAddr string

	// CaddyBin is the path to the caddy binary (default: "caddy" in PATH).
	CaddyBin string

	// DataDir is where Caddy stores TLS certificates and state.
	// Default: "./data/caddy"
	DataDir string

	// AdminAddr is Caddy's admin API address.
	// Default: "localhost:2019"
	AdminAddr string

	// ExtraDirectives are appended verbatim to the site block.
	ExtraDirectives string

	// Logger defaults to slog.Default().
	Logger *slog.Logger
}

Config holds the Caddy reverse-proxy configuration.

type Manager

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

Manager controls a Caddy subprocess.

func NewManager

func NewManager(cfg Config) *Manager

NewManager creates a Manager. Call Start to launch Caddy.

func (*Manager) GenerateCaddyJSON

func (m *Manager) GenerateCaddyJSON() ([]byte, error)

GenerateCaddyJSON generates a Caddy JSON config (useful for advanced scenarios).

func (*Manager) Reload

func (m *Manager) Reload(ctx context.Context) error

Reload triggers a configuration reload via the Caddy admin API (zero-downtime).

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start generates a Caddyfile and launches the Caddy process.

func (*Manager) Stop

func (m *Manager) Stop() error

Stop gracefully shuts down the Caddy process.

Jump to

Keyboard shortcuts

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