Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorToMap(err error) map[string]interface{}
- func NewListener(p *project.Project) chan<- events.Event
- type Action
- type Command
- type Config
- type Exec
- type InstallCommand
- type InstallOptions
- type Installer
- type Listener
- type LogFormatter
- type Messages
- type Operation
- type Project
- func (p *Project) Execute(ctx context.Context, service string, cmd ...string) error
- func (p *Project) Install(ctx context.Context, opts *InstallOptions) error
- func (p *Project) MustRenderTemplate(tmpl string, vars map[string]interface{}) string
- func (p *Project) RenderTemplate(tmpl string, vars map[string]interface{}) (string, error)
- func (p *Project) Start(ctx context.Context, opts *StartOptions) error
- func (p *Project) Status(ctx context.Context) error
- func (p *Project) Stop(ctx context.Context, opts *StopOptions) error
- func (p *Project) Uninstall(ctx context.Context, opts *UninstallOptions) error
- type StartCommand
- type StartOptions
- type StatusCommand
- type StopCommand
- type StopOptions
- type UninstallCommand
- type UninstallOptions
Constants ¶
const (
// EnvComposeFile overrides the built-in composer file.
EnvComposeFile = "INSTALLER_COMPOSE"
)
Variables ¶
var DefaultShell = []string{"/bin/sh", "-c"}
Functions ¶
func ErrorToMap ¶
Types ¶
type Command ¶
type Command struct { Debug bool `long:"debug" description:"enables the debug mode."` NoExec bool `long:"no-exec" description:"disable any execution after the action."` // contains filtered or unexported fields }
Command defines a the base CLI command. It implements the non-interface for a command, for go-flags, where a `Execute([]string) error` is expected. The flags defined here are common to any other command.
type Config ¶
type Config struct { // ProjectName is the name given to the project being installed. ProjectName string // Compose is the content of one or more docker compose files in YAML format. Compose [][]byte // TemplateVars are custom defined variable to be replace on the values // supporting templates, such as docker compose files or text messages. TemplateVars map[string]interface{} // Install operation configuration. Install Operation // Uninstall operation configuration. Uninstall Operation // Status operation configuration. Status Operation // Start operation configuration. Start Operation // Stop operation configuration. Stop Operation }
Config contains all the messages and exec operations for each command.
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig returns a Config object will all Messages already configured with standard text suitable for any application.
type InstallCommand ¶
type InstallCommand struct {
Command
}
InstallCommand defines the "install" command from the installer.
func (*InstallCommand) Execute ¶
func (c *InstallCommand) Execute([]string) error
type InstallOptions ¶
type InstallOptions struct { // NoExec skip the execution of the exec command configured for this command. NoExec bool }
type Installer ¶
type Installer struct {
Parser *flags.Parser
}
Installer represent the CLI application based on `go-flags` providing all the core commands: `install`, `start`, `stop` and `uninstall`.
type LogFormatter ¶
type Messages ¶
type Messages struct { // Description to be shown in the help of the command. Description string // Announcement information shown before execute the command. Announcement string // Failure is the text to be shown just after an error happend. Failure string // Success in case of a successfully execution. Success string }
Messages are the message to be printed after, before, etc, every command.
type Project ¶
type Project struct { Compose project.APIProject Docker *client.Client // contains filtered or unexported fields }
Project performs all the operations at docker compose level.
func NewProject ¶
NewProject returns a new Project based on the given Config.
func (*Project) Install ¶
func (p *Project) Install(ctx context.Context, opts *InstallOptions) error
func (*Project) MustRenderTemplate ¶
func (*Project) RenderTemplate ¶
type StartCommand ¶
type StartCommand struct {
Command
}
StartCommand defines the "start" command from the installer.
func (*StartCommand) Execute ¶
func (c *StartCommand) Execute([]string) error
type StartOptions ¶
type StartOptions struct { // NoExec skip the execution of the exec command configured for this command. NoExec bool }
type StatusCommand ¶
type StatusCommand struct {
Command
}
StatusCommand defines the "status" command from the installer.
func (*StatusCommand) Execute ¶
func (c *StatusCommand) Execute([]string) error
type StopCommand ¶
type StopCommand struct {
Command
}
StopCommand defines the "stop" command from the installer.
func (*StopCommand) Execute ¶
func (c *StopCommand) Execute([]string) error
type StopOptions ¶
type StopOptions struct { // NoExec skip the execution of the exec command configured for this command. NoExec bool }
type UninstallCommand ¶
type UninstallCommand struct { Purge bool `long:"purge" description:"remove the docker images and volumes."` Force bool `long:"force" description:"force the uninstall process."` Command }
UninstallCommand defines the "uninstall" command from the installer.
func (*UninstallCommand) Execute ¶
func (c *UninstallCommand) Execute([]string) error