Help us shape the future of Go! Take the 2026 Go Developer Survey

deploy

package
v0.4.120 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 79 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWaitTimeout            = 5 * time.Minute
	DefaultReleaseCommandTimeout  = 5 * time.Minute
	DefaultLeaseTtl               = 13 * time.Second
	DefaultMaxUnavailable         = 0.33
	DefaultVolumeInitialSizeGB    = 1
	DefaultGPUVolumeInitialSizeGB = 100
)
View Source
const (
	STOPPED_MACHINES_POOL_SIZE = 30
)

Variables

View Source
var (
	ErrTagForDeletion        = errors.New("failed to mark as safe for deletion")
	ErrAborted               = errors.New("deployment aborted by user")
	ErrWaitTimeout           = errors.New("wait timeout")
	ErrCreateGreenMachine    = errors.New("failed to create green machines")
	ErrWaitForStartedState   = errors.New("could not get all green machines into started state")
	ErrWaitForHealthy        = errors.New("could not get all green machines to be healthy")
	ErrMarkReadyForTraffic   = errors.New("failed to mark green machines as ready")
	ErrCordonBlueMachines    = errors.New("failed to cordon blue machines")
	ErrStopBlueMachines      = errors.New("failed to stop blue machines")
	ErrWaitForStoppedState   = errors.New("could not get all blue machines into stopped state")
	ErrDestroyBlueMachines   = errors.New("failed to destroy previous deployment")
	ErrValidationError       = errors.New("app not in valid state for bluegreen deployments")
	ErrMultipleImageVersions = errors.New("found multiple image versions")
)
View Source
var CommonFlags = flag.Set{
	flag.Image(),
	flag.Now(),
	flag.RemoteOnly(false),
	flag.LocalOnly(),
	flag.Push(),
	flag.Wireguard(),
	flag.HttpsFailover(),
	flag.Detach(),
	flag.Strategy(),
	flag.Dockerfile(),
	flag.Ignorefile(),
	flag.ImageLabel(),
	flag.BuildArg(),
	flag.BuildSecret(),
	flag.BuildTarget(),
	flag.BuildContextWarnSize(),
	flag.NoCache(),
	flag.Depot(),
	flag.DepotScope(),
	flag.Nixpacks(),
	flag.BuildkitAddr(),
	flag.BuildkitImage(),
	flag.Buildkit(),
	flag.BuildOnly(),
	flag.BpDockerHost(),
	flag.BpVolume(),
	flag.RecreateBuilder(),
	flag.Yes(),
	flag.VMSizeFlags,
	flag.Env(),
	flag.String{
		Name:        "wait-timeout",
		Description: "Time duration to wait for individual machines to transition states and become healthy.",
		Default:     DefaultWaitTimeout.String(),
	},
	flag.String{
		Name:        "release-command-timeout",
		Description: "Time duration to wait for a release command finish running, or 'none' to disable.",
		Default:     DefaultReleaseCommandTimeout.String(),
	},
	flag.String{
		Name: "lease-timeout",
		Description: "Time duration to lease individual machines while running deployment." +
			" All machines are leased at the beginning and released at the end." +
			"The lease is refreshed periodically for this same time, which is why it is short." +
			"flyctl releases leases in most cases.",
		Default: DefaultLeaseTtl.String(),
	},
	flag.Bool{
		Name:        "force-machines",
		Description: "Use the Apps v2 platform built with Machines",
		Default:     false,
		Hidden:      true,
	},
	flag.Bool{
		Name:        "ha",
		Description: "Create spare machines that increases app availability",
		Default:     true,
	},
	flag.Bool{
		Name:        "smoke-checks",
		Description: "Perform smoke checks during deployment",
		Default:     true,
	},
	flag.Bool{
		Name:        "dns-checks",
		Description: "Perform DNS checks during deployment",
		Default:     true,
	},
	flag.Float64{
		Name:        "max-unavailable",
		Description: "Max number of unavailable machines during rolling updates. A number between 0 and 1 means percent of total machines",
		Default:     DefaultMaxUnavailable,
	},
	flag.Bool{
		Name:        "no-public-ips",
		Description: "Do not allocate any new public IP addresses",
	},
	flag.Bool{
		Name:        "flycast",
		Description: "Allocate a private IPv6 addresses",
	},
	flag.StringArray{
		Name:        "file-local",
		Description: "Set of files in the form of /path/inside/machine=<local/path> pairs. Can be specified multiple times.",
	},
	flag.StringArray{
		Name:        "file-literal",
		Description: "Set of literals in the form of /path/inside/machine=VALUE pairs where VALUE is the content. Can be specified multiple times.",
	},
	flag.StringArray{
		Name:        "file-secret",
		Description: "Set of secrets in the form of /path/inside/machine=SECRET pairs where SECRET is the name of the secret. Can be specified multiple times.",
	},
	flag.String{
		Name:        "primary-region",
		Description: "Override primary region in fly.toml configuration.",
	},
	flag.StringSlice{
		Name:        "regions",
		Aliases:     []string{"only-regions"},
		Description: "Deploy to machines only in these regions. Multiple regions can be specified with comma separated values or by providing the flag multiple times.",
	},
	flag.StringSlice{
		Name:        "exclude-regions",
		Description: "Deploy to all machines except machines in these regions. Multiple regions can be specified with comma separated values or by providing the flag multiple times.",
	},
	flag.StringSlice{
		Name:        "only-machines",
		Description: "Deploy to machines only with these IDs. Multiple IDs can be specified with comma separated values or by providing the flag multiple times.",
	},
	flag.StringSlice{
		Name:        "exclude-machines",
		Description: "Deploy to all machines except machines with these IDs. Multiple IDs can be specified with comma separated values or by providing the flag multiple times.",
	},
	flag.StringSlice{
		Name:        "process-groups",
		Description: "Deploy to machines only in these process groups",
	},
	flag.StringArray{
		Name:        "label",
		Description: "Add custom metadata to an image via docker labels",
	},
	flag.Int{
		Name:        "max-concurrent",
		Description: "Maximum number of machines to operate on concurrently.",
		Default:     defaultMaxConcurrent,
	},
	flag.Int{
		Name:        "immediate-max-concurrent",
		Description: "Maximum number of machines to update concurrently when using the immediate deployment strategy.",
		Default:     defaultMaxConcurrent,
		Hidden:      true,
	},
	flag.Int{
		Name:        "volume-initial-size",
		Description: "The initial size in GB for volumes created on first deploy",
	},
	flag.String{
		Name:        "signal",
		Shorthand:   "s",
		Description: "Signal to stop the machine with for bluegreen strategy (default: SIGINT)",
	},
	flag.String{
		Name:        "deploy-retries",
		Description: "Number of times to retry a deployment if it fails",
		Default:     "auto",
	},
	flag.String{
		Name:        "builder-pool",
		Default:     "auto",
		NoOptDefVal: "true",
		Description: "Experimental: Use pooled builder from Fly.io",
		Hidden:      true,
	},
	flag.Compression(),
	flag.CompressionLevel(),
}

Functions

func BlueGreenStrategy added in v0.1.40

func BlueGreenStrategy(md *machineDeployment, blueMachines []*machineUpdateEntry) *blueGreen

func DeployWithConfig added in v0.0.337

func DeployWithConfig(ctx context.Context, appConfig *appconfig.Config, userID int, forceYes bool) (err error)

Types

type AppState added in v0.2.94

type AppState struct {
	Machines []*fly.Machine
}

type Command added in v0.2.57

type Command struct {
	*cobra.Command
}

func New

func New() *Command

type DeployManifest added in v0.2.114

type DeployManifest struct {
	AppName               string
	Config                *appconfig.Config         `json:"config"`
	DeploymentImage       string                    `json:"deployment_image,omitempty"`
	Strategy              string                    `json:"strategy,omitempty"`
	EnvFromFlags          []string                  `json:"env_from_flags,omitempty"`
	PrimaryRegionFlag     string                    `json:"primary_region_flag,omitempty"`
	SkipSmokeChecks       bool                      `json:"skip_smoke_checks,omitempty"`
	SkipHealthChecks      bool                      `json:"skip_health_checks,omitempty"`
	SkipDNSChecks         bool                      `json:"skip_dns_checks,omitempty"`
	SkipReleaseCommand    bool                      `json:"skip_release_command,omitempty"`
	MaxUnavailable        *float64                  `json:"max_unavailable,omitempty"`
	RestartOnly           bool                      `json:"restart_only,omitempty"`
	WaitTimeout           *time.Duration            `json:"wait_timeout,omitempty"`
	StopSignal            string                    `json:"stop_signal,omitempty"`
	LeaseTimeout          *time.Duration            `json:"lease_timeout,omitempty"`
	ReleaseCmdTimeout     *time.Duration            `json:"release_cmd_timeout,omitempty"`
	Guest                 *fly.MachineGuest         `json:"guest,omitempty"`
	IncreasedAvailability bool                      `json:"increased_availability,omitempty"`
	AllocPublicIP         bool                      `json:"alloc_public_ip,omitempty"`
	UpdateOnly            bool                      `json:"update_only,omitempty"`
	Files                 []*fly.File               `json:"files,omitempty"`
	ExcludeRegions        map[string]bool           `json:"exclude_regions,omitempty"`
	OnlyRegions           map[string]bool           `json:"only_regions,omitempty"`
	ExcludeMachines       map[string]bool           `json:"exclude_machines,omitempty"`
	OnlyMachines          map[string]bool           `json:"only_machines,omitempty"`
	ProcessGroups         map[string]bool           `json:"process_groups,omitempty"`
	MaxConcurrent         int                       `json:"max_concurrent,omitempty"`
	VolumeInitialSize     int                       `json:"volume_initial_size,omitempty"`
	RestartPolicy         *fly.MachineRestartPolicy `json:"restart_policy,omitempty"`
	RestartMaxRetries     int                       `json:"restart_max_retrie,omitempty"`
	DeployRetries         int                       `json:"deploy_retries,omitempty"`
}

func NewManifest added in v0.2.114

func NewManifest(AppName string, config *appconfig.Config, args MachineDeploymentArgs) *DeployManifest

func (*DeployManifest) Encode added in v0.2.114

func (m *DeployManifest) Encode(w io.Writer) error

func (*DeployManifest) ToBase64 added in v0.2.114

func (m *DeployManifest) ToBase64() (string, error)

func (*DeployManifest) WriteToFile added in v0.2.114

func (m *DeployManifest) WriteToFile(filename string) error

type MachineDeployment added in v0.0.452

type MachineDeployment interface {
	DeployMachinesApp(context.Context) error
}

func NewMachineDeployment added in v0.0.452

func NewMachineDeployment(ctx context.Context, args MachineDeploymentArgs) (_ MachineDeployment, err error)

type MachineDeploymentArgs added in v0.0.452

type MachineDeploymentArgs struct {
	App                   *flaps.App
	DeploymentImage       string
	Strategy              string
	EnvFromFlags          []string
	PrimaryRegionFlag     string
	SkipSmokeChecks       bool
	SkipHealthChecks      bool
	SkipDNSChecks         bool
	SkipReleaseCommand    bool
	MaxUnavailable        *float64
	RestartOnly           bool
	WaitTimeout           *time.Duration
	StopSignal            string
	LeaseTimeout          *time.Duration
	ReleaseCmdTimeout     *time.Duration
	Guest                 *fly.MachineGuest
	IncreasedAvailability bool
	AllocIP               string
	Org                   string
	UpdateOnly            bool
	Files                 []*fly.File
	ExcludeRegions        map[string]bool
	OnlyRegions           map[string]bool
	ExcludeMachines       map[string]bool
	OnlyMachines          map[string]bool
	ProcessGroups         map[string]bool
	MaxConcurrent         int
	VolumeInitialSize     int
	RestartPolicy         *fly.MachineRestartPolicy
	RestartMaxRetries     int
	DeployRetries         int
	BuildID               int64
	BuilderID             string
}

type MachineLogger added in v0.2.109

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

func NewMachineLogger added in v0.2.109

func NewMachineLogger(store map[string]statuslogger.StatusLine, sl statuslogger.StatusLogger) *MachineLogger

type ProcessGroupsDiff added in v0.0.490

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

type RollbackLog added in v0.2.32

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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