Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWrite ¶
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 ¶
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) version: version number to tag built images with
Returns the generated YAML as a string, or an error
func GenerateTraefikCompose ¶
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