app

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RestartPolicyAlways    = "always"
	RestartPolicyOnFailure = "on-failure"
	RestartPolicyNo        = "no"
)
View Source
const (
	ProcessStateDisabled   = "Disabled"
	ProcessStatePending    = "Pending"
	ProcessStateRunning    = "Running"
	ProcessStateRestarting = "Restarting"
	ProcessStateCompleted  = "Completed"
)
View Source
const (
	// ProcessConditionCompleted is the type for waiting until a process has completed (any exit code).
	ProcessConditionCompleted = "process_completed"

	// ProcessConditionCompletedSuccessfully is the type for waiting until a process has completed successfully (exit code 0).
	ProcessConditionCompletedSuccessfully = "process_completed_successfully"

	// ProcessConditionHealthy is the type for waiting until a process is healthy.
	ProcessConditionHealthy = "process_healthy"

	// ProcessConditionStarted is the type for waiting until a process has started (default).
	ProcessConditionStarted = "process_started"
)

Variables

View Source
var DefaultFileNames = []string{"compose.yml", "compose.yaml", "process-compose.yml", "process-compose.yaml"}

DefaultFileNames defines the Compose file names for auto-discovery (in order of preference)

Functions

func AutoDiscoverComposeFile

func AutoDiscoverComposeFile(pwd string) (string, error)

Types

type DependsOnConfig

type DependsOnConfig map[string]ProcessDependency

type Process

type Process struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(
	globalEnv []string,
	logger pclog.PcLogger,
	procConf ProcessConfig,
	procState *ProcessState,
	procLog *pclog.ProcessLogBuffer,
	replica int) *Process

func (*Process) GetName

func (p *Process) GetName() string

func (*Process) GetNameWithReplica

func (p *Process) GetNameWithReplica() string

func (*Process) Run

func (p *Process) Run() error

func (*Process) WaitForCompletion

func (p *Process) WaitForCompletion(waitee string) int

func (*Process) WontRun

func (p *Process) WontRun()

type ProcessConfig

type ProcessConfig struct {
	Name          string
	Disabled      bool                   `yaml:"disabled,omitempty"`
	Command       string                 `yaml:"command"`
	LogLocation   string                 `yaml:"log_location,omitempty"`
	Environment   []string               `yaml:"environment,omitempty"`
	RestartPolicy RestartPolicyConfig    `yaml:"availability,omitempty"`
	DependsOn     DependsOnConfig        `yaml:"depends_on,omitempty"`
	Extensions    map[string]interface{} `yaml:",inline"`
}

func (ProcessConfig) GetDependencies

func (p ProcessConfig) GetDependencies() []string

type ProcessDependency

type ProcessDependency struct {
	Condition  string                 `yaml:",omitempty"`
	Extensions map[string]interface{} `yaml:",inline"`
}

type ProcessFunc

type ProcessFunc func(process ProcessConfig) error

type ProcessState

type ProcessState struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	SystemTime string `json:"system_time"`
	Restarts   int    `json:"restarts"`
	ExitCode   int    `json:"exit_code"`
	Pid        int    `json:"pid"`
}

type Processes

type Processes map[string]ProcessConfig

type Project

type Project struct {
	Version     string    `yaml:"version"`
	LogLocation string    `yaml:"log_location,omitempty"`
	LogLevel    string    `yaml:"log_level,omitempty"`
	Processes   Processes `yaml:"processes"`
	Environment []string  `yaml:"environment,omitempty"`
	// contains filtered or unexported fields
}
var PROJ *Project

func CreateProject

func CreateProject(inputFile string) *Project

func (*Project) GetDependenciesOrderNames

func (p *Project) GetDependenciesOrderNames() ([]string, error)

func (*Project) GetLexicographicProcessNames

func (p *Project) GetLexicographicProcessNames() []string

func (*Project) GetProcessLog

func (p *Project) GetProcessLog(name string, offsetFromEnd, limit int) ([]string, error)

func (*Project) GetProcessState

func (p *Project) GetProcessState(name string) *ProcessState

func (*Project) Run

func (p *Project) Run()

func (*Project) StartProcess

func (p *Project) StartProcess(name string) error

func (*Project) StopProcess

func (p *Project) StopProcess(name string) error

func (*Project) WithProcesses

func (p *Project) WithProcesses(names []string, fn ProcessFunc) error

WithProcesses run ProcesseFunc on each Process and dependencies in dependency order

type RestartPolicyConfig

type RestartPolicyConfig struct {
	Restart        string `yaml:",omitempty"`
	BackoffSeconds int    `yaml:"backoff_seconds,omitempty"`
	MaxRestarts    int    `yaml:"max_restarts,omitempty"`
}

Jump to

Keyboard shortcuts

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