Documentation
¶
Index ¶
- Constants
- func LoadGlobalEnv(file string, secs *Secrets) (map[string]string, error)
- func UnzipTo(zipfile string, dir string) error
- func ValidateUnitDir(dir string) error
- func ZipDir(w io.Writer, dir string) error
- type CTLResponse
- type Command
- type CommandDeploy
- type CommandDisable
- type CommandEnable
- type CommandResponse
- func (cr *CommandResponse) AddError(err error)
- func (cr *CommandResponse) AddMsg(pattern string, args ...any)
- func (cr CommandResponse) Error() error
- func (cr CommandResponse) ErrorStrings() []string
- func (cr *CommandResponse) Errorf(pattern string, args ...any)
- func (cr CommandResponse) HasErrors() bool
- type CommandStart
- type CommandStartAll
- type CommandStop
- type CommandStopAll
- type Controller
- func (c *Controller) Deploy(unit string, dir string) CommandResponse
- func (c *Controller) Disable(unit string) CommandResponse
- func (c *Controller) Enable(unit string) CommandResponse
- func (c *Controller) RunCtx(ctx context.Context)
- func (c *Controller) Start(unit string) CommandResponse
- func (c *Controller) StartAll() CommandResponse
- func (c *Controller) Stat(unit string) CommandResponse
- func (c *Controller) StatAll() CommandResponse
- func (c *Controller) Stop(unit string) CommandResponse
- func (c *Controller) StopAll() CommandResponse
- type Guard
- type GuardOption
- func WithArgs(args ...string) GuardOption
- func WithEnv(env ...string) GuardOption
- func WithKillTimeout(d time.Duration) GuardOption
- func WithOnChange(onChange func(rs GuardRunningState, pid int)) GuardOption
- func WithRestartAfter(d time.Duration) GuardOption
- func WithStdErr(w io.Writer) GuardOption
- func WithStdIn(r io.Reader) GuardOption
- func WithStdOut(w io.Writer) GuardOption
- func WithWd(wd string) GuardOption
- type GuardRunningState
- type GuardState
- type Secrets
- type Service
- type StatsDescriptor
- type Unit
- type UnitConfig
- type UnitStatsCache
- type Units
Constants ¶
View Source
const (
GlobalEnvFile = "copr.global.env"
)
View Source
const (
SecretFile = "copr.secrets"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateUnitDir ¶
Types ¶
type CTLResponse ¶
type CommandDeploy ¶
type CommandDeploy struct {
// contains filtered or unexported fields
}
func NewCommandDeploy ¶
func NewCommandDeploy(unit string, dir string) *CommandDeploy
type CommandDisable ¶
type CommandDisable struct {
// contains filtered or unexported fields
}
func NewCommandDisable ¶
func NewCommandDisable(unit string) *CommandDisable
type CommandEnable ¶
type CommandEnable struct {
// contains filtered or unexported fields
}
func NewCommandEnable ¶
func NewCommandEnable(unit string) *CommandEnable
type CommandResponse ¶
func (*CommandResponse) AddError ¶
func (cr *CommandResponse) AddError(err error)
func (*CommandResponse) AddMsg ¶
func (cr *CommandResponse) AddMsg(pattern string, args ...any)
func (CommandResponse) Error ¶
func (cr CommandResponse) Error() error
func (CommandResponse) ErrorStrings ¶
func (cr CommandResponse) ErrorStrings() []string
func (*CommandResponse) Errorf ¶
func (cr *CommandResponse) Errorf(pattern string, args ...any)
func (CommandResponse) HasErrors ¶
func (cr CommandResponse) HasErrors() bool
type CommandStart ¶
type CommandStart struct {
// contains filtered or unexported fields
}
func NewCommandStart ¶
func NewCommandStart(unit string) *CommandStart
type CommandStartAll ¶
type CommandStartAll struct {
// contains filtered or unexported fields
}
func NewCommandStartAll ¶
func NewCommandStartAll() *CommandStartAll
type CommandStop ¶
type CommandStop struct {
// contains filtered or unexported fields
}
func NewCommandStop ¶
func NewCommandStop(unit string) *CommandStop
type CommandStopAll ¶
type CommandStopAll struct {
// contains filtered or unexported fields
}
func NewCommandStopAll ¶
func NewCommandStopAll() *CommandStopAll
type Controller ¶
func NewController ¶
func (*Controller) Deploy ¶
func (c *Controller) Deploy(unit string, dir string) CommandResponse
func (*Controller) Disable ¶
func (c *Controller) Disable(unit string) CommandResponse
func (*Controller) Enable ¶
func (c *Controller) Enable(unit string) CommandResponse
func (*Controller) RunCtx ¶
func (c *Controller) RunCtx(ctx context.Context)
func (*Controller) Start ¶
func (c *Controller) Start(unit string) CommandResponse
func (*Controller) Stat ¶
func (c *Controller) Stat(unit string) CommandResponse
func (*Controller) StatAll ¶
func (c *Controller) StatAll() CommandResponse
func (*Controller) Stop ¶
func (c *Controller) Stop(unit string) CommandResponse
func (*Controller) StopAll ¶
func (c *Controller) StopAll() CommandResponse
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
func (*Guard) Status ¶
func (g *Guard) Status() GuardState
func (*Guard) UpdateOpts ¶
func (g *Guard) UpdateOpts(opts ...GuardOption) error
type GuardOption ¶
func WithArgs ¶
func WithArgs(args ...string) GuardOption
func WithEnv ¶
func WithEnv(env ...string) GuardOption
func WithKillTimeout ¶
func WithKillTimeout(d time.Duration) GuardOption
func WithOnChange ¶
func WithOnChange(onChange func(rs GuardRunningState, pid int)) GuardOption
func WithRestartAfter ¶
func WithRestartAfter(d time.Duration) GuardOption
func WithStdErr ¶
func WithStdErr(w io.Writer) GuardOption
func WithStdIn ¶
func WithStdIn(r io.Reader) GuardOption
func WithStdOut ¶
func WithStdOut(w io.Writer) GuardOption
func WithWd ¶
func WithWd(wd string) GuardOption
type GuardRunningState ¶
type GuardRunningState string
const ( GuardStatusNotRunning GuardRunningState = "not-running" GuardStatusRunningStopped GuardRunningState = "running-stopped" GuardStatusRunningStarted GuardRunningState = "running-started" )
type GuardState ¶
type GuardState struct { RunningState GuardRunningState PID int }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(bind string, controller *Controller, apiKey string) (*Service, error)
type StatsDescriptor ¶
type StatsDescriptor struct { Name string Enabled bool Started bool PID int RSS uint64 VM uint64 CPUPerc float64 MEMPerc float64 RLimitSoftFD uint64 RLimitHardFD uint64 NumFD uint64 StartedAt time.Time }
Stats is a collection of typical process stats
func (StatsDescriptor) RSSH ¶
func (s StatsDescriptor) RSSH() string
RSSH returns RSS in a human-readable format
func (StatsDescriptor) String ¶
func (s StatsDescriptor) String() string
String outputs the stats as string
func (StatsDescriptor) VMH ¶
func (s StatsDescriptor) VMH() string
VMH returns VM in a human-readable format
type Unit ¶
type Unit struct { Dir string Name string Config UnitConfig }
type UnitConfig ¶
type UnitConfig struct { //Name string `json:"name"` Enabled bool `json:"enabled"` Program string `json:"program"` Args []string `json:"args,omitempty"` Env []string `json:"env,omitempty"` RestartAfterSec int `json:"restart-after-sec"` }
Unit represenst on Service/Program, considered to reside in one directory
type UnitStatsCache ¶
func NewUnitStatsCache ¶
func NewUnitStatsCache() *UnitStatsCache
Source Files
¶
Click to show internal directories.
Click to hide internal directories.