Documentation
¶
Overview ¶
Package resapp provides bases for other app drivers
Index ¶
- Variables
- type BaseT
- type T
- func (t *T) BaseCmdArgs(s string, action string) ([]string, error)
- func (t *T) CmdArgs(ctx context.Context, s string, action string) ([]string, error)
- func (t *T) CommonStatus(ctx context.Context) status.T
- func (t *T) CommonStop(ctx context.Context, r statuser) (err error)
- func (t *T) ExitCodeToStatus(exitCode int) (status.T, error)
- func (t *T) GetFuncOpts(ctx context.Context, s string, action string) ([]funcopt.O, error)
- func (t *T) GetTimeout(action string) time.Duration
- func (t *T) Info(ctx context.Context) (resource.InfoKeys, error)
- func (t *T) NetNSPath(ctx context.Context) (string, error)
- func (t *T) Provision(ctx context.Context) error
- func (t *T) Provisioned(ctx context.Context) (provisioned.T, error)
- func (t *T) SortKey() string
- func (t *T) Unprovision(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BaseKeywordTimeout = keywords.Keyword{ Attr: "Timeout", Converter: "duration", Example: "180", Option: "timeout", Scopable: true, Text: keywords.NewText(fs, "text/kw/timeout"), } BaseKeywordStopTimeout = keywords.Keyword{ Attr: "StopTimeout", Converter: "duration", Example: "180", Option: "stop_timeout", Scopable: true, Text: keywords.NewText(fs, "text/kw/stop_timeout"), } BaseKeywordSecretsEnv = keywords.Keyword{ Attr: "SecretsEnv", Converter: "shlex", Example: "CRT=cert1/server.pem sec1/*", Option: "secrets_environment", Scopable: true, Text: keywords.NewText(fs, "text/kw/secrets_environment"), } BaseKeywordConfigsEnv = keywords.Keyword{ Attr: "ConfigsEnv", Converter: "shlex", Example: "PORT=http/port webapp/app1* {name}/* {name}-debug/settings", Option: "configs_environment", Scopable: true, Text: keywords.NewText(fs, "text/kw/configs_environment"), } BaseKeywordEnv = keywords.Keyword{ Attr: "Env", Example: "CRT=cert1/server.crt PEM=cert1/server.pem", Option: "environment", Converter: "shlex", Scopable: true, Text: keywords.NewText(fs, "text/kw/environment"), } BaseKeywordRetCodes = keywords.Keyword{ Attr: "RetCodes", Default: "0:up 1:down", Example: "0:up 1:down 3:warn 4: n/a 5:undef", Option: "retcodes", Required: false, Scopable: true, Text: keywords.NewText(fs, "text/kw/retcodes"), } BaseKeywordUmask = keywords.Keyword{ Attr: "Umask", Converter: "umask", Example: "022", Option: "umask", Scopable: true, Text: keywords.NewText(fs, "text/kw/umask"), } BaseKeywords = []keywords.Keyword{ BaseKeywordTimeout, BaseKeywordStopTimeout, BaseKeywordSecretsEnv, BaseKeywordConfigsEnv, BaseKeywordEnv, BaseKeywordRetCodes, BaseKeywordUmask, } )
View Source
var ( UnixKeywordScriptPath = keywords.Keyword{ Attr: "ScriptPath", Option: "script", Scopable: true, Text: keywords.NewText(fs, "text/kw/script"), } UnixKeywordStartCmd = keywords.Keyword{ Attr: "StartCmd", Option: "start", Scopable: true, Text: keywords.NewText(fs, "text/kw/start"), } UnixKeywordStopCmd = keywords.Keyword{ Attr: "StopCmd", Option: "stop", Scopable: true, Text: keywords.NewText(fs, "text/kw/stop"), } UnixKeywordCheckCmd = keywords.Keyword{ Attr: "CheckCmd", Option: "check", Scopable: true, Text: keywords.NewText(fs, "text/kw/check"), } UnixKeywordInfoCmd = keywords.Keyword{ Attr: "InfoCmd", Default: "false", Option: "info", Scopable: true, Text: keywords.NewText(fs, "text/kw/info"), } UnixKeywordStatusLogKw = keywords.Keyword{ Attr: "StatusLogKw", Converter: "bool", Default: "false", Option: "status_log", Scopable: true, Text: keywords.NewText(fs, "text/kw/status_log"), } UnixKeywordCheckTimeout = keywords.Keyword{ Attr: "CheckTimeout", Converter: "duration", Example: "180", Option: "check_timeout", Scopable: true, Text: keywords.NewText(fs, "text/kw/check_timeout"), } UnixKeywordInfoTimeout = keywords.Keyword{ Attr: "InfoTimeout", Converter: "duration", Example: "180", Option: "info_timeout", Scopable: true, Text: keywords.NewText(fs, "text/kw/info_timeout"), } UnixKeywordCwd = keywords.Keyword{ Attr: "Cwd", Option: "cwd", Scopable: true, Text: keywords.NewText(fs, "text/kw/cwd"), } UnixKeywordUser = keywords.Keyword{ Attr: "User", Option: "user", Scopable: true, Text: keywords.NewText(fs, "text/kw/user"), } UnixKeywordGroup = keywords.Keyword{ Attr: "Group", Option: "group", Scopable: true, Text: keywords.NewText(fs, "text/kw/group"), } UnixKeywordLimitCPU = keywords.Keyword{ Attr: "Limit.CPU", Converter: "duration", Example: "30s", Option: "limit_cpu", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_cpu"), } UnixKeywordLimitCore = keywords.Keyword{ Attr: "Limit.Core", Converter: "size", Option: "limit_core", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_core"), } UnixKeywordLimitData = keywords.Keyword{ Attr: "Limit.Data", Converter: "size", Option: "limit_data", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_data"), } UnixKeywordLimitFSize = keywords.Keyword{ Attr: "Limit.FSize", Converter: "size", Option: "limit_fsize", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_fsize"), } UnixKeywordLimitMemLock = keywords.Keyword{ Attr: "Limit.MemLock", Converter: "size", Option: "limit_memlock", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_memlock"), } UnixKeywordLimitNoFile = keywords.Keyword{ Attr: "Limit.NoFile", Converter: "size", Option: "limit_nofile", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_nofile"), } UnixKeywordLimitNProc = keywords.Keyword{ Attr: "Limit.NProc", Converter: "size", Option: "limit_nproc", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_nproc"), } UnixKeywordLimitRSS = keywords.Keyword{ Attr: "Limit.RSS", Converter: "size", Option: "limit_rss", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_rss"), } UnixKeywordLimitStack = keywords.Keyword{ Attr: "Limit.Stack", Converter: "size", Option: "limit_stack", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_stack"), } UnixKeywordLimitVmem = keywords.Keyword{ Attr: "Limit.VMem", Converter: "size", Option: "limit_vmem", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_vmem"), } UnixKeywordLimitAS = keywords.Keyword{ Attr: "Limit.AS", Converter: "size", Option: "limit_as", Scopable: true, Text: keywords.NewText(fs, "text/kw/limit_as"), } UnixKeywordNetNS = keywords.Keyword{ Attr: "NetNS", Example: "ip#0", Option: "netns", Scopable: true, Text: keywords.NewText(fs, "text/kw/netns"), } UnixKeywords = []keywords.Keyword{ UnixKeywordScriptPath, UnixKeywordStartCmd, UnixKeywordStopCmd, UnixKeywordCheckCmd, UnixKeywordInfoCmd, UnixKeywordStatusLogKw, UnixKeywordCheckTimeout, UnixKeywordInfoTimeout, UnixKeywordCwd, UnixKeywordUser, UnixKeywordGroup, UnixKeywordLimitCPU, UnixKeywordLimitCore, UnixKeywordLimitData, UnixKeywordLimitFSize, UnixKeywordLimitMemLock, UnixKeywordLimitNoFile, UnixKeywordLimitNProc, UnixKeywordLimitRSS, UnixKeywordLimitStack, UnixKeywordLimitVmem, UnixKeywordLimitAS, UnixKeywordNetNS, } )
Functions ¶
This section is empty.
Types ¶
type BaseT ¶
type BaseT struct {
resource.T
RetCodes string `json:"retcodes"`
Path naming.Path `json:"path"`
Nodes []string `json:"nodes"`
SecretsEnv []string `json:"secret_environment"`
ConfigsEnv []string `json:"configs_environment"`
Env []string `json:"environment"`
Timeout *time.Duration `json:"timeout"`
StartTimeout *time.Duration `json:"start_timeout"`
StopTimeout *time.Duration `json:"stop_timeout"`
Umask *os.FileMode `json:"umask"`
ObjectID uuid.UUID `json:"objectID"`
}
BaseT is the app base driver structure
type T ¶
type T struct {
BaseT
Path naming.Path `json:"path"`
Nodes []string `json:"nodes"`
ScriptPath string `json:"script"`
StartCmd string `json:"start"`
StopCmd string `json:"stop"`
CheckCmd string `json:"check"`
InfoCmd string `json:"info"`
StatusLogKw bool `json:"status_log"`
CheckTimeout *time.Duration `json:"check_timeout"`
InfoTimeout *time.Duration `json:"info_timeout"`
Cwd string `json:"cwd"`
User string `json:"user"`
Group string `json:"group"`
PG pg.Config `json:"pg"`
Limit ulimit.Config `json:"limit"`
NetNS string `json:"netns"`
}
T is the driver structure for app unix & linux.
func (*T) CommonStatus ¶
CommonStatus evaluates and display the Resource status and logs
func (*T) CommonStop ¶
CommonStop stops the Resource
func (*T) GetFuncOpts ¶
GetFuncOpts returns a list of functional options to use with command.New()
func (*T) Provisioned ¶
Click to show internal directories.
Click to hide internal directories.