Documentation ¶
Overview ¶
Package runner holds the building blocks for cmd runner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrNonUniqueProcessTypeName is returned when starting the runner, it detects that its configuration possesses non unique process type names after it normalizes them.
Functions ¶
This section is empty.
Types ¶
type LogMessage ¶
type LogMessage struct { PaddedName string `json:"paddedName"` Name string `json:"name"` Line string `json:"line"` }
LogMessage broadcasted through websocket.
type ProcessType ¶
type ProcessType struct { // Name of the process type. If the name is prefixed with "build" it is // executed before the others. Name string // Cmd is the command necessary to start the process type. Cmd string // WaitFor is the network address or process type name that the process // type waits to be available before finalizing the start. WaitFor string // Restart is the flag that forces the process type to restart. It means // that all steps are executed upon restart. This option does not apply // to build steps. // // - yes|onbuild: alway restart the process type. // - no|<empty>: restart the process type on rebuild. // - on-failure|fail: restart the process type if any of the steps fail. // - temporary|tmp: start the process once and skip restart on rebuild. // Temporary processes do not show up in the discovery service. Restart RestartMode `json:"restart,omitempty"` // Signal indicates how a process should be halted. Signal Signal // Timeout indicates how long to wait for a process to be finished // before releasing it. Timeout time.Duration }
ProcessType is the piece of software you want to start. Cmd accepts multiple commands. All commands are executed in order of declaration. The last command is considered the call which activates the process type. If WaitFor is defined, it will wait for network readiness on the defined target before executing the last command. Process types named with prefix "build" are special, they are executed first in preparation for all other process types, upon their completion the application initialized.
type RestartMode ¶
type RestartMode string
RestartMode defines if a process should restart itself.
const ( OnBuild RestartMode = "onbuild" OnFailure RestartMode = "fail" Temporary RestartMode = "temporary" Loop RestartMode = "loop" Never RestartMode = "" )
Restart modes
func ParseRestartMode ¶
func ParseRestartMode(m string) RestartMode
ParseRestartMode takes a string and converts to RestartMode. If the parsing fails, it silently defaults to Never.
type Runner ¶
type Runner struct { // WorkDir is the working directory from which all commands are going // to be executed. WorkDir string // Observables are the filepath.Match() patterns used to scan for files // with changes. File patterns preceded with exclamation mark (!) will // not trigger builds. Observables []string // SkipDirs are the directory names that are ignored during changed file // scanning. SkipDirs []string // Processes is the list of processes necessary to start this // application. Processes []*ProcessType // BasePort is the IP port number used to calculate an IP port for each // process type and set to its $PORT environment variable. Build // processes do not earn an IP port. BasePort int // Formation allows to start more than one process type each time. Each // start will yield its own exclusive $PORT. Formation does not apply // to build process types. Formation map[string]int // map of process type name and count // SkipProcs is the list of process types that should not be started. // This is useful to disable a process type that is not necessary for // the current environment. SkipProcs []string // BaseEnvironment is the set of environment variables loaded into // the service. BaseEnvironment []string // ServiceDiscoveryAddr is the net.Listen address used to bind the // service discovery service. Set to empty to disable it. If activated // this address is passed to the processes through the environment // variable named "DISCOVERY". ServiceDiscoveryAddr string // contains filtered or unexported fields }
Runner defines how this application should be started.