compose

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const GB = 1 << 30 // 1 GB in bytes

Variables

This section is empty.

Functions

func CreateComposeFile

func CreateComposeFile(nodeName string, config NetworkConfig, extraServiceNames []string, extraServiceConfigs []NetworkConfig, cwd string) (string, error)

func RemoveInitContainersAndVolumes

func RemoveInitContainersAndVolumes() error

RemoveInitContainersAndVolumes removes all containers that match "init-config-*" and their associated volumes, deletes volumes with the label "nodevin.init.volume", and anonymous volumes created within the last minute.

Types

type ComposeFile

type ComposeFile struct {
	//Version  string                    `yaml:"version"`
	Services map[string]Service        `yaml:"services"`
	Networks map[string]NetworkDetails `yaml:"networks"`
	Volumes  map[string]VolumeDetails  `yaml:"volumes"`
}

ComposeFile defines the top-level structure of the Docker Compose file.

type Deploy

type Deploy struct {
	Resources Resources `yaml:"resources,omitempty"`
}

Deploy holds the resource deployment configuration for a service.

type Healthcheck

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

Healthcheck defines the parameters for a health check.

type NetworkConfig

type NetworkConfig struct {
	Image                string
	Version              string
	ContainerName        string
	Command              string
	Restart              string
	Ports                []string
	Volumes              []string
	Networks             []string
	Deploy               Deploy
	Environment          map[string]string
	NetworkDefs          map[string]NetworkDetails
	VolumeDefs           map[string]VolumeDetails
	LocalPath            string
	SnapshotSyncCID      string
	LocalChainDataPath   string
	SnapshotDataFilename string
	SnapshotSyncCommand  string
}

NetworkConfig holds the configuration used to override or define services.

func GetBitcoinNetworkComposeConfig

func GetBitcoinNetworkComposeConfig(network string) (NetworkConfig, error)

func GetDogecoinNetworkComposeConfig added in v0.1.1

func GetDogecoinNetworkComposeConfig(network string) (NetworkConfig, error)

func GetIpfsClusterNetworkComposeConfig added in v0.0.8

func GetIpfsClusterNetworkComposeConfig(network string) (NetworkConfig, error)

func GetKuboNetworkComposeConfig added in v0.0.7

func GetKuboNetworkComposeConfig(network string) (NetworkConfig, error)

func GetLitecoinNetworkComposeConfig

func GetLitecoinNetworkComposeConfig(network string) (NetworkConfig, error)

func GetOrdLitecoinNetworkComposeConfig

func GetOrdLitecoinNetworkComposeConfig(network string) (NetworkConfig, error)

func GetOrdNetworkComposeConfig

func GetOrdNetworkComposeConfig(network string) (NetworkConfig, error)

type NetworkDetails

type NetworkDetails struct {
	Driver string `yaml:"driver"`
}

NetworkDetails defines the network configuration for a service.

type ResourceDetails

type ResourceDetails struct {
	CPUs   string `yaml:"cpus,omitempty"`
	Memory string `yaml:"memory,omitempty"`
}

ResourceDetails defines CPU and memory limits and reservations.

type Resources

type Resources struct {
	Limits       ResourceDetails `yaml:"limits,omitempty"`
	Reservations ResourceDetails `yaml:"reservations,omitempty"`
}

Resources defines resource limits and reservations for a service.

type Service

type Service struct {
	Image         string                               `yaml:"image"`
	ContainerName string                               `yaml:"container_name"`
	User          string                               `yaml:"user,omitempty"`
	Restart       string                               `yaml:"restart"`
	Command       string                               `yaml:"command"`
	Entrypoint    string                               `yaml:"entrypoint,omitempty"`
	Ports         []string                             `yaml:"ports"`
	Volumes       []string                             `yaml:"volumes"`
	Networks      []string                             `yaml:"networks"`
	Healthcheck   *Healthcheck                         `yaml:"healthcheck,omitempty"`
	Environment   map[string]string                    `yaml:"environment,omitempty"`
	DependsOn     map[string]ServiceDependsOnCondition `yaml:"depends_on,omitempty"`
	Deploy        *Deploy                              `yaml:"deploy,omitempty"`
}

Service defines the configuration of a service in the Docker Compose file.

type ServiceDependsOnCondition

type ServiceDependsOnCondition struct {
	Condition string `yaml:"condition"`
}

ServiceDependsOnCondition defines the health condition for depends_on.

type VolumeDetails

type VolumeDetails struct {
	Labels map[string]string `yaml:"labels"`
}

VolumeDetails defines the volume configuration for a service.

Jump to

Keyboard shortcuts

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