application

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

adapted from https://github.com/DefangLabs/defang LICENSE MIT License Copyright (c) 2024 Defang Software Labs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bind

type Bind struct {
	Type   string `yaml:"type"`
	Source string `yaml:"source"`
	Target string `yaml:"target"`
	Shift  bool   `yaml:"shift,omitempty"`
}

type Compose

type Compose struct {
	Name           string                      `yaml:"name" validate:"required"`
	Project        string                      `yaml:"project,omitempty" validate:"project-exists"`
	Services       map[string]Service          `yaml:"services" validate:"required,dive,required"`
	Profiles       []string                    `yaml:"profiles" validate:"dive,profile-exists"`
	ExportPath     string                      `yaml:"export_path,omitempty"`
	Dag            graph.Graph[string, string] `yaml:"-"`
	ComposeProject *types.Project              `yaml:"-"`
	// contains filtered or unexported fields
}

func BuildDirect

func BuildDirect(p *types.Project, conf *cliconfig.Config) (*Compose, error)

func (*Compose) AttachVolumesForService

func (app *Compose) AttachVolumesForService(service string) error

func (*Compose) CreateBindsForService

func (app *Compose) CreateBindsForService(service string) error

func (*Compose) CreateGPUForService

func (app *Compose) CreateGPUForService(service string) error

func (*Compose) CreateVolumesForService

func (app *Compose) CreateVolumesForService(service string) error

func (*Compose) DeleteVolumesForService

func (app *Compose) DeleteVolumesForService(service string) error

func (*Compose) DependentsForService

func (c *Compose) DependentsForService(s string) ([]string, error)

func (*Compose) Down

func (app *Compose) Down(force, volumes bool, timeout int) error

func (*Compose) Export

func (app *Compose) Export(volumes bool, customVolumesOnly bool) error

func (*Compose) ExportInstance

func (app *Compose) ExportInstance(service string, volumes bool) error

func (*Compose) ExportVolume

func (app *Compose) ExportVolume(pool, volume string) error

func (*Compose) GetProfiles

func (app *Compose) GetProfiles() []string

func (*Compose) GetProject

func (app *Compose) GetProject() string

func (*Compose) Info

func (app *Compose) Info() error

func (*Compose) InitContainerForService

func (app *Compose) InitContainerForService(service string) error

func (*Compose) ListServices

func (c *Compose) ListServices() []string

func (*Compose) ListVolumesForService

func (app *Compose) ListVolumesForService(service string) ([]string, error)

func (*Compose) Order

func (app *Compose) Order(reverse bool) []string

Order returns the order in which services should be started or stopped. If reverse is true, the order is reversed. Use reverse=true for starting services. Use reverse=false for stopping services.

func (*Compose) ParseServers

func (c *Compose) ParseServers(remotes ...string) ([]remoteResource, error)

func (*Compose) Remove

func (app *Compose) Remove(timeout int, force, stop, volumes bool) error

func (*Compose) RemoveContainerForService

func (app *Compose) RemoveContainerForService(service string, force bool) error

func (*Compose) Restart

func (app *Compose) Restart() error

func (*Compose) RestartContainerForService

func (app *Compose) RestartContainerForService(service string) error

func (*Compose) SanityCheck

func (app *Compose) SanityCheck() error

func (*Compose) Snapshot

func (app *Compose) Snapshot(noexpiry, stateful, volumes bool) error

func (*Compose) SnapshotInstance

func (app *Compose) SnapshotInstance(service string, noexpiry, stateful, volumes bool) error

func (*Compose) SnapshotVolume

func (app *Compose) SnapshotVolume(pool, volume string, noexpiry, stateful, volumes bool) error

func (*Compose) Start

func (app *Compose) Start(wait bool) error

func (*Compose) StartAll

func (c *Compose) StartAll(wait bool) error

func (*Compose) StartContainerForService

func (app *Compose) StartContainerForService(service string, wait bool) error

func (*Compose) StartService

func (c *Compose) StartService(s string, wait bool) error

func (*Compose) Stop

func (app *Compose) Stop(stateful, force bool, timeout int) error

func (*Compose) StopAll

func (c *Compose) StopAll(stateful, force bool, timeout int) error

func (*Compose) StopContainerForService

func (app *Compose) StopContainerForService(service string, stateful, force bool, timeout int) error

func (*Compose) StopService

func (c *Compose) StopService(s string, stateful, force bool, timeout int) error

func (*Compose) String

func (c *Compose) String() string

func (*Compose) Up

func (app *Compose) Up() error

keep all the external commands in one place

type SanityCheckError

type SanityCheckError struct {
	Step string
	Err  error
}

func (*SanityCheckError) Error

func (e *SanityCheckError) Error() string

type Service

type Service struct {
	Name                  string             `yaml:"name" validate:"required"`
	Image                 string             `yaml:"image" validate:"required"`
	GPU                   bool               `yaml:"gpu,omitempty"`
	Volumes               map[string]*Volume `yaml:"volumes,omitempty" validate:"dive,required"`
	BindMounts            map[string]Bind    `yaml:"binds,omitempty"`
	AdditionalProfiles    []string           `yaml:"additional_profiles,omitempty" validate:"dive,profile-exists"`
	EnvironmentFile       string             `yaml:"environment_file,omitempty"`
	Environment           map[string]*string `yaml:"environment,omitempty"`
	CloudInitUserData     string             `yaml:"cloud_init_user_data,omitempty"`
	CloudInitUserDataFile string             `yaml:"cloud_init_user_data_file,omitempty"`
	Snapshot              *Snapshot          `yaml:"snapshot,omitempty"`
	DependsOn             []string           `yaml:"depends_on,omitempty"`
	InventoryGroups       []string           `yaml:"inventory_groups,omitempty"`
	Storage               string             `yaml:"storage,omitempty"`
}

func (*Service) String

func (s *Service) String() string

type Snapshot

type Snapshot struct {
	Schedule string `yaml:"schedule,omitempty"`
	Expiry   string `yaml:"expiry,omitempty"`
	Pattern  string `yaml:"pattern,omitempty"`
}

type Volume

type Volume struct {
	Name       string    `yaml:"name,omitempty"`
	Mountpoint string    `yaml:"mountpoint"`
	Pool       string    `yaml:"pool" validate:"pool-exists"`
	Snapshot   *Snapshot `yaml:"snapshot,omitempty"`
}

func (*Volume) CreateName

func (v *Volume) CreateName(application string, service string, volume string) string

Jump to

Keyboard shortcuts

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