Documentation ¶
Index ¶
- Constants
- Variables
- func LocalTarCmdArgs(path, exclude string) []string
- func NewTarStreamReader(cwd, path, exclude string) (io.Reader, error)
- func RemoteTarCommand(dir string) string
- func ResolveLocalPath(cwd, path, env string) (string, error)
- type Client
- type Command
- type EnvList
- type EnvVar
- type ErrConnect
- type ErrMustUpdate
- type ErrTask
- type LocalhostClient
- func (c *LocalhostClient) Close() error
- func (c *LocalhostClient) Connect(_ string) error
- func (c *LocalhostClient) Prefix() (string, int)
- func (c *LocalhostClient) Run(task *Task) error
- func (c *LocalhostClient) Signal(sig os.Signal) error
- func (c *LocalhostClient) Stderr() io.Reader
- func (c *LocalhostClient) Stdin() io.WriteCloser
- func (c *LocalhostClient) Stdout() io.Reader
- func (c *LocalhostClient) Wait() error
- func (c *LocalhostClient) Write(p []byte) (n int, err error)
- func (c *LocalhostClient) WriteClose() error
- type Network
- type SSHClient
- func (c *SSHClient) Close() error
- func (c *SSHClient) Connect(host string) error
- func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error
- func (sc *SSHClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func (c *SSHClient) Prefix() (string, int)
- func (c *SSHClient) Run(task *Task) error
- func (c *SSHClient) Signal(sig os.Signal) error
- func (c *SSHClient) Stderr() io.Reader
- func (c *SSHClient) Stdin() io.WriteCloser
- func (c *SSHClient) Stdout() io.Reader
- func (c *SSHClient) Wait() error
- func (c *SSHClient) Write(p []byte) (n int, err error)
- func (c *SSHClient) WriteClose() error
- type SSHDialFunc
- type Stackup
- type Supfile
- type Task
- type Upload
Constants ¶
const VERSION = "0.4"
Variables ¶
var ( Colors = []string{ "\033[32m", "\033[33m", "\033[36m", "\033[35m", "\033[31m", "\033[34m", } ResetColor = "\033[0m" )
Functions ¶
func LocalTarCmdArgs ¶
func NewTarStreamReader ¶
NewTarStreamReader creates a tar stream reader from a local path. TODO: Refactor. Use "archive/tar" instead.
func RemoteTarCommand ¶
RemoteTarCommand returns command to be run on remote SSH host to properly receive the created TAR stream. TODO: Check for relative directory.
func ResolveLocalPath ¶
Types ¶
type Command ¶
type Command struct { Name string `yaml:"-"` // Command name. Desc string `yaml:"desc"` // Command description. Local string `yaml:"local"` // Command(s) to be run locally. Run string `yaml:"run"` // Command(s) to be run remotelly. Script string `yaml:"script"` // Load command(s) from script and run it remotelly. Upload []Upload `yaml:"upload"` // See Upload struct. Stdin bool `yaml:"stdin"` // Attach localhost STDOUT to remote commands' STDIN? Once bool `yaml:"once"` // The command should be run "once" (on one host only). Serial int `yaml:"serial"` // Max number of clients processing a task in parallel. // API backward compatibility. Will be deprecated in v1.0. RunOnce bool `yaml:"run_once"` // The command should be run once only. }
Command represents command(s) to be run remotely.
type EnvList ¶
type EnvList []EnvVar
EnvList is a list of environment variables that maps to a YAML map, but maintains order, enabling late variables to reference early variables.
func (*EnvList) UnmarshalYAML ¶
type EnvVar ¶
EnvVar represents an environment variable
type ErrConnect ¶
func (ErrConnect) Error ¶
func (e ErrConnect) Error() string
type ErrMustUpdate ¶
type ErrMustUpdate struct {
Msg string
}
func (ErrMustUpdate) Error ¶
func (e ErrMustUpdate) Error() string
type LocalhostClient ¶
type LocalhostClient struct {
// contains filtered or unexported fields
}
Client is a wrapper over the SSH connection/sessions.
func (*LocalhostClient) Close ¶
func (c *LocalhostClient) Close() error
func (*LocalhostClient) Connect ¶
func (c *LocalhostClient) Connect(_ string) error
func (*LocalhostClient) Prefix ¶
func (c *LocalhostClient) Prefix() (string, int)
func (*LocalhostClient) Run ¶
func (c *LocalhostClient) Run(task *Task) error
func (*LocalhostClient) Stderr ¶
func (c *LocalhostClient) Stderr() io.Reader
func (*LocalhostClient) Stdin ¶
func (c *LocalhostClient) Stdin() io.WriteCloser
func (*LocalhostClient) Stdout ¶
func (c *LocalhostClient) Stdout() io.Reader
func (*LocalhostClient) Wait ¶
func (c *LocalhostClient) Wait() error
func (*LocalhostClient) WriteClose ¶
func (c *LocalhostClient) WriteClose() error
type Network ¶
type Network struct { Env EnvList `yaml:"env"` Inventory string `yaml:"inventory"` Hosts []string `yaml:"hosts"` Bastion string `yaml:"bastion"` // Jump host for the environment }
Network is group of hosts with extra custom env vars.
func (Network) ParseInventory ¶
ParseInventory runs the inventory command, if provided, and appends the command's output lines to the manually defined list of hosts.
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
Client is a wrapper over the SSH connection/sessions.
func (*SSHClient) Connect ¶
Connect creates SSH connection to a specified host. It expects the host of the form "[ssh://]host[:port]".
func (*SSHClient) ConnectWith ¶
func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error
ConnectWith creates a SSH connection to a specified host. It will use dialer to establish the connection. TODO: Split Signers to its own method.
func (*SSHClient) DialThrough ¶
DialThrough will create a new connection from the ssh server sc is connected to. DialThrough is an SSHDialer.
func (*SSHClient) Stdin ¶
func (c *SSHClient) Stdin() io.WriteCloser
func (*SSHClient) Wait ¶
Wait waits until the remote command finishes and exits. It closes the SSH session.
func (*SSHClient) WriteClose ¶
type SSHDialFunc ¶
SSHDialFunc can dial an ssh server and return a client
type Supfile ¶
type Supfile struct { Networks map[string]Network `yaml:"networks"` Commands map[string]Command `yaml:"commands"` Targets map[string][]string `yaml:"targets"` Env EnvList `yaml:"env"` Version string `yaml:"version"` }
Supfile represents the Stack Up configuration YAML file.
func NewSupfile ¶
NewSupfile parses configuration file and returns Supfile or error.