Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigurationAreEqual(c1 ApplicationConfiguration, c2 ApplicationConfiguration) bool
- func MapApplications(models []*Application) []output.Application
- func MapBranch(model Branch) output.Branch
- func MapCheckoutObject(model CheckoutObject) output.CheckoutObject
- func MapCommand(model Command) output.Command
- func MapForward(model Forward) output.Forward
- func MapMetric(model Metric) output.Metric
- func MapSession(model *Session) *output.Session
- func MapSessionLog(log Log) output.SessionLog
- func MapSessionStatus(model *Session) output.SessionStatus
- func MapSessions(models []*Session) []output.Session
- func MapTag(model Tag) output.Tag
- func NewContextStore() *contextStore
- func NewMetricsForSession(session *Session) func(string) func()
- type Application
- func (a *Application) GetConfiguration() ApplicationConfiguration
- func (a *Application) GetStatus() ApplicationStatus
- func (a *Application) SetBaseFolder(baseFolder string)
- func (a *Application) SetConfiguration(conf ApplicationConfiguration)
- func (a *Application) SetFolder(folder string)
- func (a *Application) SetStatus(status ApplicationStatus)
- func (a *Application) ToOutput() output.Application
- func (a *Application) WithLock(f func(*Application))
- func (a *Application) WithRLock(f func(*Application))
- type ApplicationCommand
- type ApplicationCommandOutput
- type ApplicationConfiguration
- func (a *ApplicationConfiguration) OverrideWith(override SharedConfiguration)
- func (a ApplicationConfiguration) ToOutput() output.ApplicationConfiguration
- func (a *ApplicationConfiguration) WithLock(f func(*ApplicationConfiguration))
- func (a *ApplicationConfiguration) WithRLock(f func(*ApplicationConfiguration))
- type ApplicationStatus
- type Branch
- type BranchConfiguration
- type BranchConfigurationMatch
- type Branches
- type CheckoutObject
- type Command
- type Commands
- type CompiledForwardPattern
- type Fetch
- type Forward
- type GlobalConfiguration
- type Header
- type Headers
- type Healthcheck
- type Helper
- type HelperPosition
- type KillReason
- type Log
- type LogType
- type Metric
- type Metrics
- type PortConfiguration
- type Recycle
- type RemoteObject
- type RequestConfiguration
- type RootConfiguration
- type Session
- func (session *Session) DecreaseMaxAge()
- func (session *Session) GetConfiguration() ApplicationConfiguration
- func (session *Session) GetInactiveAt() time.Time
- func (session *Session) GetKillReason() KillReason
- func (session *Session) GetLogs() []Log
- func (session *Session) GetMaxAge() int
- func (session *Session) GetReplacedBy() string
- func (session *Session) GetReplaces() *Session
- func (session *Session) GetStartupRetriesCount() int
- func (session *Session) GetStatus() SessionStatus
- func (session *Session) IncStartupRetriesCount()
- func (session *Session) InitializeConfiguration()
- func (session *Session) IsAlive() bool
- func (session *Session) LogCritical(message string)
- func (session *Session) LogDebug(message string)
- func (session *Session) LogError(message string)
- func (session *Session) LogInfo(message string)
- func (session *Session) LogStderr(message string)
- func (session *Session) LogStdin(message string)
- func (session *Session) LogStdout(message string)
- func (session *Session) LogTrace(message string)
- func (session *Session) LogWarn(message string)
- func (session *Session) MarkAsBeingRequested()
- func (session *Session) ResetStartupRetriesCount()
- func (session *Session) ResetVariables()
- func (session *Session) SetInactiveAt(at time.Time)
- func (session *Session) SetKillReason(reason KillReason)
- func (session *Session) SetMaxAge(age int)
- func (session *Session) SetReplacedBy(newSessionUUID string)
- func (session *Session) SetReplaces(previous *Session)
- func (session *Session) SetStatus(status SessionStatus)
- func (session *Session) SetVariable(k string, v string)
- func (session *Session) ToOutput() output.Session
- type SessionStatus
- type SharedConfiguration
- type Startup
- type Tag
- type Variables
- type Warmup
- type Warmups
Constants ¶
const ( // SessionStatusStarting - When the session is being built SessionStatusStarting SessionStatus = "starting" // SessionStatusStarted - When the session has been built // and the session is available to be proxied to SessionStatusStarted SessionStatus = "started" // SessionStatusStartFailed - When the session build process failed SessionStatusStartFailed SessionStatus = "start_failed" // SessionStatusStopFailed - When the session stop process failed SessionStatusStopFailed SessionStatus = "stop_failed" // SessionStatusStopping - When the session is being stopped SessionStatusStopping SessionStatus = "stopping" // SessionStatusStopped - When the session has been stopped successfully SessionStatusStopped SessionStatus = "stopped" // SessionStatusDegraded - When the healthcheck failed // and the session is NOT available to be proxied to SessionStatusDegraded SessionStatus = "degraded" // LogTypeStdin is the command being executed LogTypeStdin LogType = "stdin" // LogTypeStdout is the output printed on the stdout LogTypeStdout LogType = "stdout" // LogTypeStderr is the output printed on the stderr LogTypeStderr LogType = "stderr" // KillReasonNone - The reason has not been set. Maybe because there has not been a kill yet KillReasonNone KillReason = "" // KillReasonStopped - The session has been manually stopped by the user KillReasonStopped KillReason = "stopped" // KillReasonBuildFailed - The session has been killed because its build process failed KillReasonBuildFailed KillReason = "build_failed" // KillReasonHealthcheckFailed - The session has been killed because the healthcheck process // could not check the service reachability. It depends on user-provided configuration KillReasonHealthcheckFailed KillReason = "healthcheck_failed" // KillReasonReplaced - Means the session is going to be replaced with an updated one KillReasonReplaced KillReason = "replaced" // SessionBuildContextKey is the name of the shared BUILD context. // It is shared to allow an early session destruction to stop a running build of a session SessionBuildContextKey string = "build" )
Variables ¶
var (
ErrMalformedHeader error = errors.New("Malformed header; the format should be key=value")
)
Functions ¶
func ConfigurationAreEqual ¶
func ConfigurationAreEqual(c1 ApplicationConfiguration, c2 ApplicationConfiguration) bool
func MapApplications ¶
func MapApplications(models []*Application) []output.Application
MapApplications converts an application model to an output model
func MapCheckoutObject ¶
func MapCheckoutObject(model CheckoutObject) output.CheckoutObject
func MapCommand ¶
func MapForward ¶
func MapSession ¶
func MapSessionLog ¶
func MapSessionLog(log Log) output.SessionLog
func MapSessionStatus ¶
func MapSessionStatus(model *Session) output.SessionStatus
MapSessionStatus maps a session to a status output model
func MapSessions ¶
func NewContextStore ¶
func NewContextStore() *contextStore
func NewMetricsForSession ¶
Types ¶
type Application ¶
type Application struct { utils.RWLocker `json:"-"` Filename string `json:"filename"` Status ApplicationStatus `json:"status"` Folder string `json:"folder"` BaseFolder string `json:"baseFolder"` ObjectsToHashMap map[string]string `json:"-"` HashToObjectsMap map[string]*RemoteObject `json:"-"` BranchesMap map[string]*Branch `json:"branchesMap"` TagsMap map[string]*Tag `json:"tagsMap"` Commits []string `json:"-"` CommitMap map[string]*object.Commit `json:"-"` CompiledForwardPatterns []CompiledForwardPattern `json:"-"` // contains filtered or unexported fields }
func NewApplication ¶
func NewApplication(configuration *ApplicationConfiguration, filename string) (*Application, error)
func (*Application) GetConfiguration ¶
func (a *Application) GetConfiguration() ApplicationConfiguration
func (*Application) GetStatus ¶
func (a *Application) GetStatus() ApplicationStatus
func (*Application) SetBaseFolder ¶
func (a *Application) SetBaseFolder(baseFolder string)
func (*Application) SetConfiguration ¶
func (a *Application) SetConfiguration(conf ApplicationConfiguration)
func (*Application) SetFolder ¶
func (a *Application) SetFolder(folder string)
func (*Application) SetStatus ¶
func (a *Application) SetStatus(status ApplicationStatus)
func (*Application) ToOutput ¶
func (a *Application) ToOutput() output.Application
ToOutput converts this model into an output model
func (*Application) WithLock ¶
func (a *Application) WithLock(f func(*Application))
func (*Application) WithRLock ¶
func (a *Application) WithRLock(f func(*Application))
type ApplicationCommand ¶
type ApplicationConfiguration ¶
type ApplicationConfiguration struct { utils.RWLocker `json:"-"` Name string `json:"name"` Fetch Fetch `json:"fetch"` IsDefault bool `yaml:"is_default" json:"isDefault"` MaxConcurrentSessions int `yaml:"max_concurrent_sessions" json:"maxConcurrentSessions"` Branches Branches `yaml:"branches"` UseFolderCopy bool `yaml:"use_folder_copy" json:"useFolderCopy"` CleanOnExit *bool `yaml:"clean_on_exit" json:"cleanOnExit" default:"true"` }
ApplicationConfiguration contains the configuration of the application Usually its retrieval methods override the SharedConfiguration struct with the checkout-specific configuration
func NewApplicationConfiguration ¶
func NewApplicationConfiguration(configuration *ApplicationConfiguration) (*ApplicationConfiguration, error)
func (*ApplicationConfiguration) OverrideWith ¶
func (a *ApplicationConfiguration) OverrideWith(override SharedConfiguration)
func (ApplicationConfiguration) ToOutput ¶
func (a ApplicationConfiguration) ToOutput() output.ApplicationConfiguration
ToOutput converts this model into an output model
func (*ApplicationConfiguration) WithLock ¶
func (a *ApplicationConfiguration) WithLock(f func(*ApplicationConfiguration))
func (*ApplicationConfiguration) WithRLock ¶
func (a *ApplicationConfiguration) WithRLock(f func(*ApplicationConfiguration))
type ApplicationStatus ¶
type ApplicationStatus string
var ( ApplicationStatusLoading ApplicationStatus = "loading" ApplicationStatusReady ApplicationStatus = "ready" )
type Branch ¶
type Branch struct {
CheckoutObject
}
type BranchConfiguration ¶
type BranchConfigurationMatch ¶
type BranchConfigurationMatch struct { BranchConfiguration `yaml:",inline"` Test string `yaml:"test"` }
type Branches ¶
type Branches []BranchConfigurationMatch
func (Branches) BranchIsBeingWatched ¶
func (Branches) BranchIsMain ¶
type CheckoutObject ¶
type Command ¶
type Command struct { Command string `json:"command"` Environment []string `yaml:"environment,omitempty" json:"environment"` OutputVariable string `yaml:"output_variable,omitempty" json:"outputVariable"` ContinueOnError bool `yaml:"continue_on_error" json:"continueOnError"` WorkingDir string `yaml:"working_dir" json:"workingDir"` StartHealthchecking bool `yaml:"start_healthchecking" json:"startHealthchecking"` Timeout int `json:"timeout"` }
type CompiledForwardPattern ¶
type GlobalConfiguration ¶
type Headers ¶
type Healthcheck ¶
type Healthcheck struct { RequestConfiguration `yaml:",inline"` MaxRetries int `yaml:"max_retries" json:"maxRetries"` RetryInterval int `yaml:"retry_interval" json:"retryInterval"` }
type Helper ¶
type Helper struct {
Position HelperPosition `json:"position"`
}
type HelperPosition ¶
type HelperPosition string
func (*HelperPosition) GetStyle ¶
func (p *HelperPosition) GetStyle() (x string, y string)
type Log ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics() *Metrics
type PortConfiguration ¶
type PortConfiguration struct {
Except []int `json:"except"`
}
type Recycle ¶
type Recycle struct {
InactivityTimeout int `yaml:"inactivity_timeout" json:"inactivityTimeout"`
}
type RemoteObject ¶
type RequestConfiguration ¶
type RootConfiguration ¶
type RootConfiguration struct { Global GlobalConfiguration ApplicationConfigurations []*ApplicationConfiguration `yaml:"applications"` }
type Session ¶
type Session struct { utils.RWLocker `json:"-"` UUID string `json:"uuid"` Name string `json:"name"` Target string `json:"target"` Port int `json:"port"` ApplicationName string `json:"applicationName"` Application *Application `json:"-"` Status SessionStatus `json:"status"` CommitID string `json:"commitID"` // The object to be checked out (branch/tag/commit id) Checkout string `json:"checkout"` Commit object.Commit `json:"commit"` Folder string `json:"folder"` Variables Variables `json:"variables"` Metrics []Metric `json:"metrics"` Context *contextStore `json:"-"` // contains filtered or unexported fields }
Session is a process on which an application is available. When a session is started it gets built starting from a branch, and when all is ready the reverse proxy will start pointing to it.
func NewSession ¶
NewSession builds a session starting from a pre-built one. It is useful to set variable that needs to be set at initialization time
func (*Session) DecreaseMaxAge ¶
func (session *Session) DecreaseMaxAge()
DecreaseMaxAge decreases the max-age parameter of the session thread-safely
func (*Session) GetConfiguration ¶
func (session *Session) GetConfiguration() ApplicationConfiguration
GetConfiguration allows to retrieve the CURRENT configuration in a thread-safe manner. This configuration gets replaced whenever there's an update by the user. So it is advisable to not store indefinitely this configuration, but to ask for it when needed
func (*Session) GetInactiveAt ¶
GetInactiveAt retrieves the inactive-at value for the session thread-safely
func (*Session) GetKillReason ¶
func (session *Session) GetKillReason() KillReason
GetKillReason returns the reason why the session has been killed thread-safely. Returns KillReasonNone if the session has not been killed
func (*Session) GetReplacedBy ¶
GetReplacedBy thread-safely retrieves the UUID of the session by which this session has been replaced
func (*Session) GetReplaces ¶
GetReplaces thread-safely retrieves the session which will be replaced when this session will go online
func (*Session) GetStartupRetriesCount ¶
GetStartupRetriesCount retrieves the current count of startup retries thread-safely
func (*Session) GetStatus ¶
func (session *Session) GetStatus() SessionStatus
GetStatus allows to get the session status thread-safely
func (*Session) IncStartupRetriesCount ¶
func (session *Session) IncStartupRetriesCount()
IncStartupRetriesCount thread-safely increments the current count of startup retries
func (*Session) InitializeConfiguration ¶
func (session *Session) InitializeConfiguration()
InitializeConfiguration gets called whenever a secondary actor knows that application's configuration changed. This allows the session to get its matching configuration
func (*Session) LogCritical ¶
LogCritical logs a message to stdout and stores it in the session logs slice
func (*Session) LogDebug ¶
LogDebug logs a message to stdout and stores it in the session logs slice
func (*Session) LogError ¶
LogError logs a message to stdout and stores it in the session logs slice
func (*Session) LogStderr ¶
LogStderr logs a message to stdout and stores it in the session logs slice
func (*Session) LogStdin ¶
LogStdin logs a message to stdout and stores it in the session logs slice
func (*Session) LogStdout ¶
LogStdout logs a message to stdout and stores it in the session logs slice
func (*Session) LogTrace ¶
LogTrace logs a message to stdout and stores it in the session logs slice
func (*Session) MarkAsBeingRequested ¶
func (session *Session) MarkAsBeingRequested()
MarkAsBeingRequested informs the session that it has been used by a proxy so it must reset its inactivity timer, if available
func (*Session) ResetStartupRetriesCount ¶
func (session *Session) ResetStartupRetriesCount()
ResetStartupRetriesCount thread-safely resets the current count of startup retries
func (*Session) ResetVariables ¶
func (session *Session) ResetVariables()
ResetVariables thread-safely resets the session variables dictionary
func (*Session) SetInactiveAt ¶
SetInactiveAt is the thread-safe setter for InactiveAt
func (*Session) SetKillReason ¶
func (session *Session) SetKillReason(reason KillReason)
SetKillReason allows to set the session kill reason thread-safely
func (*Session) SetMaxAge ¶
SetMaxAge allows to set an exact max-age value for the session thread-safely
func (*Session) SetReplacedBy ¶
SetReplacedBy thread-safely sets the UUID of the session by which this session has been replaced
func (*Session) SetReplaces ¶
SetReplaces thread-safely sets the session which will be replaced when this session will go online
func (*Session) SetStatus ¶
func (session *Session) SetStatus(status SessionStatus)
SetStatus allows to set the session status thread-safely
func (*Session) SetVariable ¶
SetVariable thread-safely sets a variable value into the session variables dictionary
type SessionStatus ¶
type SessionStatus string
SessionStatus is the status of the session
func (SessionStatus) IsAlive ¶
func (status SessionStatus) IsAlive() bool
IsAlive states whether the session is started or about be started
type SharedConfiguration ¶
type SharedConfiguration struct {}
type Tag ¶
type Tag struct {
CheckoutObject
}
type Variables ¶
Variables are those variables used by a single session. May contain data put by the session build process or the output of build commands
type Warmup ¶
type Warmup struct {
RequestConfiguration `yaml:",inline"`
}