Documentation
¶
Index ¶
- Constants
- type Application
- type Config
- type Resources
- type Service
- type ServiceOptions
- func (so *ServiceOptions) EnvString() string
- func (so *ServiceOptions) FullEnvFilePath() string
- func (so *ServiceOptions) FullLogPath() string
- func (so *ServiceOptions) IsCustomLogEnabled() bool
- func (so *ServiceOptions) IsEnvFileSet() bool
- func (so *ServiceOptions) IsEnvSet() bool
- func (so *ServiceOptions) IsFileLimitSet() bool
- func (so *ServiceOptions) IsKillModeSet() bool
- func (so *ServiceOptions) IsKillSignalSet() bool
- func (so *ServiceOptions) IsProcLimitSet() bool
- func (so *ServiceOptions) IsReloadSignalSet() bool
- func (so *ServiceOptions) IsResourcesSet() bool
- func (so *ServiceOptions) IsRespawnLimitSet() bool
- func (so *ServiceOptions) Validate() []error
Constants ¶
const ( REGEXP_V1_LINE = `^([A-z\d_]+):\s*(.+)` REGEXP_V2_VERSION = `(?m)^\s*version:\s*2\s*$` REGEXP_PATH_CHECK = `\A[A-Za-z0-9_\-./]+\z` REGEXP_NAME_CHECK = `\A[A-Za-z0-9_\-]+\z` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { Name string // Name of application Services []*Service // List of services in application User string // Working user Group string // Working group StartLevel int // Start level StopLevel int // Stop level WorkingDir string // Working directory ProcVersion int // Proc version 1/2 }
func Read ¶
func Read(path string, config *Config) (*Application, error)
Read reads and parse procfile content
func (*Application) Validate ¶
func (a *Application) Validate() []error
Validate validate all services in application
type Config ¶
type Config struct { Name string // Application name User string // Working user Group string // Working group WorkingDir string // Working directory IsRespawnEnabled bool // Global respawn enabled flag RespawnInterval int // Global respawn interval in seconds RespawnCount int // Global respawn count KillTimeout int // Global kill timeout in seconds LimitProc int // Global processes limit LimitFile int // Global descriptors limit }
type Resources ¶ added in v0.20.0
type Resources struct { CPUWeight int StartupCPUWeight int CPUQuota int MemoryLow string MemoryHigh string MemoryMax string MemorySwapMax string TasksMax int IOWeight int StartupIOWeight int IODeviceWeight string IOReadBandwidthMax string IOWriteBandwidthMax string IOReadIOPSMax string IOWriteIOPSMax string IPAddressAllow string IPAddressDeny string }
type Service ¶
type Service struct { Name string // Service name Cmd string // Command PreCmd string // Pre command PostCmd string // Post command Options *ServiceOptions // Service options Application *Application // Pointer to parent application HelperPath string // Path to helper (will be set by exporter) }
func (*Service) GetCommandExec ¶ added in v0.9.0
GetCommandExecWithEnv return full command exec with env vars setting
func (*Service) HasPostCmd ¶ added in v0.9.0
HasPostCmd return true if post command is defined
type ServiceOptions ¶
type ServiceOptions struct { Env map[string]string // Environment variables EnvFile string // Path to file with environment variables WorkingDir string // Working directory LogFile string // Path to log file KillTimeout int // Kill timeout in seconds KillSignal string // Kill signal name KillMode string // Kill mode (systemd only) ReloadSignal string // Reload signal name Count int // Exec count RespawnInterval int // Respawn interval in seconds RespawnCount int // Respawn count IsRespawnEnabled bool // Respawn enabled flag LimitProc int // Processes limit LimitFile int // Descriptors limit Resources *Resources // Resources limits (systemd only) }
func (*ServiceOptions) EnvString ¶
func (so *ServiceOptions) EnvString() string
EnvString return environment variables as string
func (*ServiceOptions) FullEnvFilePath ¶ added in v0.11.0
func (so *ServiceOptions) FullEnvFilePath() string
FullEnvFilePath return absolute path to file with env vars
func (*ServiceOptions) FullLogPath ¶ added in v0.7.1
func (so *ServiceOptions) FullLogPath() string
FullLogPath return absolute path to service log
func (*ServiceOptions) IsCustomLogEnabled ¶
func (so *ServiceOptions) IsCustomLogEnabled() bool
IsCustomLogEnabled return true if service have custom log
func (*ServiceOptions) IsEnvFileSet ¶ added in v0.11.0
func (so *ServiceOptions) IsEnvFileSet() bool
IsEnvFileSet return true if service have file with env vars
func (*ServiceOptions) IsEnvSet ¶
func (so *ServiceOptions) IsEnvSet() bool
IsEnvSet return true if service have custom env vars
func (*ServiceOptions) IsFileLimitSet ¶
func (so *ServiceOptions) IsFileLimitSet() bool
IsFileLimitSet return true if descriptors limit is set
func (*ServiceOptions) IsKillModeSet ¶ added in v0.20.0
func (so *ServiceOptions) IsKillModeSet() bool
IsKillModeSet return true if custom kill mode set
func (*ServiceOptions) IsKillSignalSet ¶ added in v0.10.0
func (so *ServiceOptions) IsKillSignalSet() bool
IsKillSignalSet return true if custom kill signal set
func (*ServiceOptions) IsProcLimitSet ¶
func (so *ServiceOptions) IsProcLimitSet() bool
IsProcLimitSet return true if processes limit is set
func (*ServiceOptions) IsReloadSignalSet ¶ added in v0.10.0
func (so *ServiceOptions) IsReloadSignalSet() bool
IsReloadSignalSet return true if custom reload signal set
func (*ServiceOptions) IsResourcesSet ¶ added in v0.20.0
func (so *ServiceOptions) IsResourcesSet() bool
IsResourcesSet return true if resources limits are set
func (*ServiceOptions) IsRespawnLimitSet ¶
func (so *ServiceOptions) IsRespawnLimitSet() bool
IsRespawnLimitSet return true if respawn options is set
func (*ServiceOptions) Validate ¶
func (so *ServiceOptions) Validate() []error
Validate validate service options