Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigureUI(mainLogger Logger, processLoggerConfig LoggerConfig)
- func Decrypt(data []byte, passphrase string) ([]byte, error)
- func DecryptBase64(encoded string, passphrase string) ([]byte, error)
- func Encrypt(data []byte, passphrase string) ([]byte, error)
- func EncryptToBase64(data []byte, passphrase string) (string, error)
- func IsRunpfileValid(runpfile *Runpfile) (bool, []error)
- func RandomKey() string
- func ResolveRunpfilePath(rp string) (string, error)
- type ApplicationContext
- func (c *ApplicationContext) AddReport(message string)
- func (c *ApplicationContext) GetReport() []string
- func (c *ApplicationContext) GetRunningProcesses() map[string]RunpProcess
- func (c *ApplicationContext) RegisterRunningProcess(proc RunpProcess)
- func (c *ApplicationContext) RemoveRunningProcess(proc RunpProcess)
- type Auth
- type AwaitCondition
- type ContainerProcess
- func (p *ContainerProcess) AwaitResource() string
- func (p *ContainerProcess) AwaitTimeout() string
- func (p *ContainerProcess) Dir() string
- func (p *ContainerProcess) ID() string
- func (p *ContainerProcess) IsStartable() (bool, error)
- func (p *ContainerProcess) Preconditions() error
- func (p *ContainerProcess) SetDir(wd string)
- func (p *ContainerProcess) SetID(id string)
- func (p *ContainerProcess) ShouldWait() bool
- func (p *ContainerProcess) StartCommand() (RunpCommand, error)
- func (p *ContainerProcess) StopCommand() RunpCommand
- func (p *ContainerProcess) StopTimeout() time.Duration
- func (p *ContainerProcess) String() string
- type Endpoint
- type ExecCommandStopper
- func (c *ExecCommandStopper) Pid() int
- func (c *ExecCommandStopper) Run() error
- func (c *ExecCommandStopper) Start() error
- func (c *ExecCommandStopper) Stderr(stderr io.Writer)
- func (c *ExecCommandStopper) Stdout(stdout io.Writer)
- func (c *ExecCommandStopper) Stop() error
- func (c *ExecCommandStopper) String() string
- func (c *ExecCommandStopper) Wait() error
- type ExecCommandWrapper
- func (c *ExecCommandWrapper) Pid() int
- func (c *ExecCommandWrapper) Run() error
- func (c *ExecCommandWrapper) Start() error
- func (c *ExecCommandWrapper) Stderr(stderr io.Writer)
- func (c *ExecCommandWrapper) Stdout(stdout io.Writer)
- func (c *ExecCommandWrapper) Stop() error
- func (c *ExecCommandWrapper) String() string
- func (c *ExecCommandWrapper) Wait() error
- type HostProcess
- func (p *HostProcess) AwaitResource() string
- func (p *HostProcess) AwaitTimeout() string
- func (p *HostProcess) Dir() string
- func (p *HostProcess) ID() string
- func (p *HostProcess) IsStartable() (bool, error)
- func (p *HostProcess) Preconditions() error
- func (p *HostProcess) SetDir(wd string)
- func (p *HostProcess) SetID(id string)
- func (p *HostProcess) ShouldWait() bool
- func (p *HostProcess) StartCommand() (RunpCommand, error)
- func (p *HostProcess) StopCommand() RunpCommand
- func (p *HostProcess) StopTimeout() time.Duration
- func (p *HostProcess) String() string
- type Logger
- type LoggerConfig
- type RunpCommand
- type RunpProcess
- type RunpUnit
- type Runpfile
- type RunpfileExecutor
- type SSHTunnelCommandStopper
- func (c *SSHTunnelCommandStopper) Pid() int
- func (c *SSHTunnelCommandStopper) Run() error
- func (c *SSHTunnelCommandStopper) Start() error
- func (c *SSHTunnelCommandStopper) Stderr(stderr io.Writer)
- func (c *SSHTunnelCommandStopper) Stdout(stdout io.Writer)
- func (c *SSHTunnelCommandStopper) Stop() error
- func (c *SSHTunnelCommandStopper) String() string
- func (c *SSHTunnelCommandStopper) Wait() error
- type SSHTunnelCommandWrapper
- func (c *SSHTunnelCommandWrapper) Pid() int
- func (c *SSHTunnelCommandWrapper) Run() error
- func (c *SSHTunnelCommandWrapper) Start() error
- func (c *SSHTunnelCommandWrapper) Stderr(stderr io.Writer)
- func (c *SSHTunnelCommandWrapper) Stdout(stdout io.Writer)
- func (c *SSHTunnelCommandWrapper) Stop() error
- func (c *SSHTunnelCommandWrapper) String() string
- func (c *SSHTunnelCommandWrapper) Wait() error
- type SSHTunnelProcess
- func (p *SSHTunnelProcess) AwaitResource() string
- func (p *SSHTunnelProcess) AwaitTimeout() string
- func (p *SSHTunnelProcess) Dir() string
- func (p *SSHTunnelProcess) ID() string
- func (p *SSHTunnelProcess) IsStartable() (bool, error)
- func (p *SSHTunnelProcess) Preconditions() error
- func (p *SSHTunnelProcess) SetDir(wd string)
- func (p *SSHTunnelProcess) SetID(id string)
- func (p *SSHTunnelProcess) ShouldWait() bool
- func (p *SSHTunnelProcess) StartCommand() (RunpCommand, error)
- func (p *SSHTunnelProcess) StopCommand() RunpCommand
- func (p *SSHTunnelProcess) StopTimeout() time.Duration
- func (p *SSHTunnelProcess) String() string
- type Shell
- type StartPlan
Constants ¶
const ErrFmtCreateProcess = "Unable to create Process for %s. Check configuration: missing Host, SSHTunnel or Container key?"
ErrFmtCreateProcess format used for error in process creation.
Variables ¶
var BuildTime = ""
BuildTime of the running app.
var GitCommit = ""
GitCommit is the Git hash and a "+CHANGES" suffix if there are uncommitted changes.
var Version = ""
Version of the running app.
Functions ¶
func ConfigureUI ¶
func ConfigureUI(mainLogger Logger, processLoggerConfig LoggerConfig)
ConfigureUI allows to the main package to set main logger instance and configure the process logger instances.
func DecryptBase64 ¶
DecryptBase64 decrypt a secret encoded in base 64
func EncryptToBase64 ¶
EncryptToBase64 encypt secret and encode in base 64
func IsRunpfileValid ¶
IsRunpfileValid returns a boolean rapresenting if any Runpfile value is valid and a list of errors.
func RandomKey ¶
func RandomKey() string
RandomKey generates a random string usable as key to encrypt secrets
func ResolveRunpfilePath ¶
ResolveRunpfilePath Returns the path to the Runpfile and error
Types ¶
type ApplicationContext ¶
ApplicationContext is a singleton object containing some global variables.
func GetApplicationContext ¶
func GetApplicationContext() *ApplicationContext
GetApplicationContext returns the singleton instance of the application context.
func (*ApplicationContext) AddReport ¶
func (c *ApplicationContext) AddReport(message string)
AddReport add a report string to the reports list.
func (*ApplicationContext) GetReport ¶
func (c *ApplicationContext) GetReport() []string
GetReport returns all reports.
func (*ApplicationContext) GetRunningProcesses ¶
func (c *ApplicationContext) GetRunningProcesses() map[string]RunpProcess
GetRunningProcesses returns all running processes.
func (*ApplicationContext) RegisterRunningProcess ¶
func (c *ApplicationContext) RegisterRunningProcess(proc RunpProcess)
RegisterRunningProcess add process to the list of running ones.
func (*ApplicationContext) RemoveRunningProcess ¶
func (c *ApplicationContext) RemoveRunningProcess(proc RunpProcess)
RemoveRunningProcess add process.
type Auth ¶
type Auth struct { Secret string // encrypted secret in base 64 EncryptedSecret string `yaml:"encrypted_secret"` IdentityFile string `yaml:"identity_file"` }
Auth is auth
type AwaitCondition ¶
AwaitCondition defines time to wait for a resource.
type ContainerProcess ¶
type ContainerProcess struct { // image Image string // if not used it will be created Name string // in format docker-compose Ports []string // rm Automatically remove the container when it exits SkipRm bool `yaml:"skip_rm"` // in format docker-compose Volumes []string VolumesFrom []string `yaml:"volumes_from"` Mounts []string ShmSize string `yaml:"shm_size"` Command string // generics WorkingDir string `yaml:"workdir"` Env map[string]string Await AwaitCondition // contains filtered or unexported fields }
ContainerProcess implements RunpProcess.
func (*ContainerProcess) AwaitResource ¶
func (p *ContainerProcess) AwaitResource() string
AwaitResource returns the await resource.
func (*ContainerProcess) AwaitTimeout ¶
func (p *ContainerProcess) AwaitTimeout() string
AwaitTimeout returns the await timeout.
func (*ContainerProcess) IsStartable ¶
func (p *ContainerProcess) IsStartable() (bool, error)
IsStartable always true.
func (*ContainerProcess) Preconditions ¶
func (p *ContainerProcess) Preconditions() error
Preconditions check if process can be started
func (*ContainerProcess) SetDir ¶
func (p *ContainerProcess) SetDir(wd string)
SetDir for the sub process
func (*ContainerProcess) SetID ¶
func (p *ContainerProcess) SetID(id string)
SetID for the sub process
func (*ContainerProcess) ShouldWait ¶
func (p *ContainerProcess) ShouldWait() bool
ShouldWait returns if the process has await set.
func (*ContainerProcess) StartCommand ¶
func (p *ContainerProcess) StartCommand() (RunpCommand, error)
StartCommand ho
func (*ContainerProcess) StopCommand ¶
func (p *ContainerProcess) StopCommand() RunpCommand
StopCommand ho
func (*ContainerProcess) StopTimeout ¶
func (p *ContainerProcess) StopTimeout() time.Duration
StopTimeout duration to wait to force kill process
func (*ContainerProcess) String ¶
func (p *ContainerProcess) String() string
String representation of process
type ExecCommandStopper ¶
type ExecCommandStopper struct {
// contains filtered or unexported fields
}
ExecCommandStopper is the component calling the actual command stopping the process.
func (*ExecCommandStopper) Stderr ¶
func (c *ExecCommandStopper) Stderr(stderr io.Writer)
Stderr ...
func (*ExecCommandStopper) Stdout ¶
func (c *ExecCommandStopper) Stdout(stdout io.Writer)
Stdout ...
func (*ExecCommandStopper) String ¶
func (c *ExecCommandStopper) String() string
type ExecCommandWrapper ¶
type ExecCommandWrapper struct {
// contains filtered or unexported fields
}
ExecCommandWrapper ...
func (*ExecCommandWrapper) Pid ¶
func (c *ExecCommandWrapper) Pid() int
Pid return PID for this command wrapper
func (*ExecCommandWrapper) Stderr ¶
func (c *ExecCommandWrapper) Stderr(stderr io.Writer)
Stderr set the stderr writer
func (*ExecCommandWrapper) Stdout ¶
func (c *ExecCommandWrapper) Stdout(stdout io.Writer)
Stdout set the stdout writer
func (*ExecCommandWrapper) String ¶
func (c *ExecCommandWrapper) String() string
type HostProcess ¶
type HostProcess struct { // command line CommandLine string `yaml:"command"` // executable Executable string Args []string Shell Shell // generic WorkingDir string `yaml:"workdir"` Env map[string]string Await AwaitCondition // contains filtered or unexported fields }
HostProcess implements RunpProcess.
func (*HostProcess) AwaitResource ¶
func (p *HostProcess) AwaitResource() string
AwaitResource returns the await resource.
func (*HostProcess) AwaitTimeout ¶
func (p *HostProcess) AwaitTimeout() string
AwaitTimeout returns the await timeout.
func (*HostProcess) IsStartable ¶
func (p *HostProcess) IsStartable() (bool, error)
IsStartable always true.
func (*HostProcess) Preconditions ¶
func (p *HostProcess) Preconditions() error
Preconditions check if process can be started
func (*HostProcess) ShouldWait ¶
func (p *HostProcess) ShouldWait() bool
ShouldWait returns if the process has await set.
func (*HostProcess) StartCommand ¶
func (p *HostProcess) StartCommand() (RunpCommand, error)
StartCommand ho
func (*HostProcess) StopTimeout ¶
func (p *HostProcess) StopTimeout() time.Duration
StopTimeout duration to wait to force kill process
type Logger ¶
type Logger interface { WriteLinef(format string, a ...interface{}) (int, error) Debugf(format string, a ...interface{}) (int, error) WriteLine(line string) (int, error) Debug(line string) (int, error) Write(p []byte) (int, error) }
Logger writes out messages from the main program and output from the running processes.
type LoggerConfig ¶
LoggerConfig contains configuration for a logger.
type RunpCommand ¶
type RunpCommand interface { Pid() int Stdout(stdout io.Writer) Stderr(stderr io.Writer) Start() error Run() error Stop() error Wait() error }
RunpCommand is the interface for all command types: host, container, aws process...
type RunpProcess ¶
type RunpProcess interface { ID() string Preconditions() error SetID(string) StartCommand() (RunpCommand, error) StopCommand() RunpCommand StopTimeout() time.Duration Dir() string SetDir(string) ShouldWait() bool AwaitResource() string AwaitTimeout() string IsStartable() (bool, error) }
RunpProcess is. questo viene usato come running process
type RunpUnit ¶
type RunpUnit struct { Name string Description string StopTimeout string `yaml:"stop_timeout"` Host *HostProcess Container *ContainerProcess SSHTunnel *SSHTunnelProcess `yaml:"ssh_tunnel"` // contains filtered or unexported fields }
RunpUnit is...
func (*RunpUnit) SkipDirResolution ¶
SkipDirResolution avoid resolve dir for containers
type Runpfile ¶
type Runpfile struct { Name string Description string Version string Vars map[string]string Root string Units map[string]*RunpUnit SecretKey string `yaml:"-"` }
Runpfile is the model containing the full configuration.
func LoadRunpfileFromData ¶
LoadRunpfileFromData returns an Runpfile object reading []byte.
func LoadRunpfileFromPath ¶
LoadRunpfileFromPath returns an Runpfile object reading file from path.
type RunpfileExecutor ¶
type RunpfileExecutor struct { LoggerFactory func(string, int, LoggerConfig) Logger // contains filtered or unexported fields }
RunpfileExecutor Executor implementation for Runpfile.
func NewExecutor ¶
func NewExecutor(rf *Runpfile) *RunpfileExecutor
NewExecutor creates new RunpfileExecutor
func (*RunpfileExecutor) Start ¶
func (e *RunpfileExecutor) Start()
Start call start on all processes.
type SSHTunnelCommandStopper ¶
type SSHTunnelCommandStopper struct {
// contains filtered or unexported fields
}
SSHTunnelCommandStopper is the component calling the actual command stopping the process.
func (*SSHTunnelCommandStopper) Stderr ¶
func (c *SSHTunnelCommandStopper) Stderr(stderr io.Writer)
Stderr ...
func (*SSHTunnelCommandStopper) Stdout ¶
func (c *SSHTunnelCommandStopper) Stdout(stdout io.Writer)
Stdout ...
func (*SSHTunnelCommandStopper) String ¶
func (c *SSHTunnelCommandStopper) String() string
type SSHTunnelCommandWrapper ¶
type SSHTunnelCommandWrapper struct {
// contains filtered or unexported fields
}
SSHTunnelCommandWrapper ...
func (*SSHTunnelCommandWrapper) Stderr ¶
func (c *SSHTunnelCommandWrapper) Stderr(stderr io.Writer)
Stderr ...
func (*SSHTunnelCommandWrapper) Stdout ¶
func (c *SSHTunnelCommandWrapper) Stdout(stdout io.Writer)
Stdout ...
func (*SSHTunnelCommandWrapper) String ¶
func (c *SSHTunnelCommandWrapper) String() string
type SSHTunnelProcess ¶
type SSHTunnelProcess struct { WorkingDir string `yaml:"workdir"` Env map[string]string Await AwaitCondition User string Auth Auth Local Endpoint Jump Endpoint Target Endpoint // command executed to test connection to jump server TestCommand string `yaml:"test_command"` // contains filtered or unexported fields }
SSHTunnelProcess implements RunpProcess.
func (*SSHTunnelProcess) AwaitResource ¶
func (p *SSHTunnelProcess) AwaitResource() string
AwaitResource returns the await resource.
func (*SSHTunnelProcess) AwaitTimeout ¶
func (p *SSHTunnelProcess) AwaitTimeout() string
AwaitTimeout returns the await timeout.
func (*SSHTunnelProcess) IsStartable ¶
func (p *SSHTunnelProcess) IsStartable() (bool, error)
IsStartable always true.
func (*SSHTunnelProcess) Preconditions ¶
func (p *SSHTunnelProcess) Preconditions() error
Preconditions check if process can be started
func (*SSHTunnelProcess) SetDir ¶
func (p *SSHTunnelProcess) SetDir(wd string)
SetDir for the sub process
func (*SSHTunnelProcess) SetID ¶
func (p *SSHTunnelProcess) SetID(id string)
SetID for the sub process
func (*SSHTunnelProcess) ShouldWait ¶
func (p *SSHTunnelProcess) ShouldWait() bool
ShouldWait returns if the process has await set.
func (*SSHTunnelProcess) StartCommand ¶
func (p *SSHTunnelProcess) StartCommand() (RunpCommand, error)
StartCommand ho
func (*SSHTunnelProcess) StopCommand ¶
func (p *SSHTunnelProcess) StopCommand() RunpCommand
StopCommand ho
func (*SSHTunnelProcess) StopTimeout ¶
func (p *SSHTunnelProcess) StopTimeout() time.Duration
StopTimeout duration to wait to force kill process
func (*SSHTunnelProcess) String ¶
func (p *SSHTunnelProcess) String() string
String representation of process
type StartPlan ¶
type StartPlan struct {
Await AwaitCondition
}
StartPlan defines how and when start process.
Source Files
¶
- app_context.go
- encription.go
- log.go
- log_colors.go
- preprocessor.go
- runpfile.go
- runpfile_command.go
- runpfile_command_exec.go
- runpfile_command_sshtunnel.go
- runpfile_executor.go
- runpfile_process.go
- runpfile_process_container.go
- runpfile_process_host.go
- runpfile_process_sshtunnel.go
- shell_unix.go
- utils.go
- version.go