compose

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 6 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicWrite

func AtomicWrite(content, destPath string) error

AtomicWrite writes content to destPath atomically after validating it as YAML. The write is atomic: if validation fails, the destination file is not modified. This prevents partial writes or invalid YAML from being written to disk.

func GenerateCompose

func GenerateCompose(services map[string]*config.Config, stack string, versions map[string]int) (string, error)

GenerateCompose generates a docker-compose.yaml file for the given services services: map of service name to config stack: full path to stack directory (used to derive project name) versions: map of service name to version number

Returns the generated YAML as a string, or an error

func GenerateComposeWithCanary added in v0.2.0

func GenerateComposeWithCanary(
	services map[string]*config.Config,
	stack string,
	versions map[string]int,
	canaryName string,
	canaryVersion int,
) (string, error)

GenerateComposeWithCanary generates compose YAML with a canary service alongside all services. The canary clones the target service's Traefik labels, networks, healthcheck, and env_file but uses "{canaryName}-canary" as its compose service name. Canary has no depends_on or volumes (it is ephemeral).

func GenerateTraefikCompose

func GenerateTraefikCompose(email string) string

GenerateTraefikCompose generates a docker-compose.yaml for Traefik reverse proxy. email: email address for ACME/Let's Encrypt certificate registration

Returns a compose file configured for: - Traefik v3 with HTTP (80) and HTTPS (443) entrypoints - Let's Encrypt ACME with provided email - Certificate resolver named "letsencrypt" - Volume for acme.json persistence - traefik_web network for service discovery

Types

type ComposeFile

type ComposeFile struct {
	Services map[string]Service     `yaml:"services"`
	Networks map[string]Network     `yaml:"networks"`
	Volumes  map[string]interface{} `yaml:"volumes,omitempty"`
}

ComposeFile represents the structure of a docker-compose.yaml file

type HealthCheck

type HealthCheck struct {
	Test     []string `yaml:"test"`
	Interval string   `yaml:"interval,omitempty"`
	Timeout  string   `yaml:"timeout,omitempty"`
	Retries  int      `yaml:"retries,omitempty"`
}

HealthCheck represents a Docker Compose healthcheck definition

type Network

type Network struct {
	External bool   `yaml:"external,omitempty"`
	Driver   string `yaml:"driver,omitempty"`
}

Network represents a Docker Compose network definition

type Service

type Service struct {
	Image       string       `yaml:"image"`
	Restart     string       `yaml:"restart"`
	EnvFile     string       `yaml:"env_file,omitempty"`
	Ports       []string     `yaml:"ports,omitempty"`
	Command     []string     `yaml:"command,omitempty"`
	Networks    []string     `yaml:"networks"`
	Volumes     []string     `yaml:"volumes,omitempty"`
	Labels      []string     `yaml:"labels,omitempty"`
	DependsOn   []string     `yaml:"depends_on,omitempty"`
	HealthCheck *HealthCheck `yaml:"healthcheck,omitempty"`
}

Service represents a Docker Compose service definition

Jump to

Keyboard shortcuts

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