Documentation
¶
Overview ¶
Package easydeploy makes your deployment easy
Index ¶
- type Command
- type Deploy
- type DeployReport
- type Deployer
- func (sc *Deployer) AddCommand(command Command)
- func (sc *Deployer) DownloadF(localPath, remotePath string)
- func (sc *Deployer) Local(cmd string, args ...interface{})
- func (sc *Deployer) MaxConcurrency(num int)
- func (sc *Deployer) OnceBeforeDeploy(fn func() error)
- func (sc *Deployer) OnceDoneDeploy(fn func(bool) error)
- func (sc *Deployer) RegisterDeployServer(srvConf *ServerConfig)
- func (sc *Deployer) Remote(cmd string, args ...interface{})
- func (sc *Deployer) SLocal(cmd string, args ...interface{})
- func (sc *Deployer) SRemote(cmd string, args ...interface{})
- func (sc *Deployer) Start() []*DeployReport
- func (sc *Deployer) Upload(localPath, remotePath string)
- func (sc *Deployer) Verbose(verbose bool)
- type DownloadCommand
- type LocalCommand
- type RemoteCommand
- type ServerConfig
- type SimpleCommand
- type UploadCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface {
Run(deployCtx Deploy, srvConf *ServerConfig) error
Sensitive()
}
Command is the command interface
func BuildSimpleCommand ¶ added in v1.0.0
func BuildSimpleCommand(fn func(Deploy, *ServerConfig, ...interface{}) error, args ...interface{}) Command
BuildSimpleCommand build the simple command
type Deploy ¶
type Deploy interface {
RegisterDeployServer(srvConf *ServerConfig)
OnceBeforeDeploy(fn func() error)
OnceDoneDeploy(fn func(bool) error)
Local(cmd string, args ...interface{})
Remote(cmd string, args ...interface{})
Upload(localPath, remotePath string)
DownloadF(remotePath, localPath string)
AddCommand(command Command)
MaxConcurrency(num int)
Start() []*DeployReport
Verbose(verbose bool)
// contains filtered or unexported methods
}
Deploy is the deploy interface
type DeployReport ¶
type DeployReport struct {
SrvConf *ServerConfig
Start time.Time
Consumed int64
CmdRuns int
Cmds int
// contains filtered or unexported fields
}
DeployReport is the report of deploy process
func (*DeployReport) String ¶
func (rp *DeployReport) String() string
type Deployer ¶
type Deployer struct {
SrvConf []*ServerConfig
// contains filtered or unexported fields
}
Deployer is the main entry point
func (*Deployer) AddCommand ¶ added in v1.0.0
AddCommand register a custom command
func (*Deployer) MaxConcurrency ¶
MaxConcurrency controls how many deployments will run simultaneously if you deploy to multiple servers. 0 means all deployments will start asynchronously.
func (*Deployer) OnceBeforeDeploy ¶
OnceBeforeDeploy called only once before deployment
func (*Deployer) OnceDoneDeploy ¶
OnceDoneDeploy called only once when deployment is done even if deployment failed
func (*Deployer) RegisterDeployServer ¶
func (sc *Deployer) RegisterDeployServer(srvConf *ServerConfig)
RegisterDeployServer register a deploy server
func (*Deployer) Start ¶
func (sc *Deployer) Start() []*DeployReport
Start will start the deploy process
type DownloadCommand ¶ added in v1.0.4
type DownloadCommand struct {
LocalPath string
RemotePath string
// contains filtered or unexported fields
}
DownloadCommand is the download command
func (*DownloadCommand) Run ¶ added in v1.0.4
func (downloadCmd *DownloadCommand) Run(deployCtx Deploy, srvConf *ServerConfig) error
Run the download command
func (*DownloadCommand) Sensitive ¶ added in v1.0.6
func (downloadCmd *DownloadCommand) Sensitive()
type LocalCommand ¶
type LocalCommand struct {
CmdStr string
// contains filtered or unexported fields
}
LocalCommand is a local command
func (*LocalCommand) Run ¶
func (localCmd *LocalCommand) Run(deployCtx Deploy, srvConf *ServerConfig) error
Run the local command
func (*LocalCommand) Sensitive ¶ added in v1.0.6
func (localCmd *LocalCommand) Sensitive()
type RemoteCommand ¶
type RemoteCommand struct {
CmdStr string
// contains filtered or unexported fields
}
RemoteCommand is a remote command
func (*RemoteCommand) Run ¶
func (remoteCmd *RemoteCommand) Run(deployCtx Deploy, srvConf *ServerConfig) error
Run the remote command on the remote server
func (*RemoteCommand) Sensitive ¶ added in v1.0.6
func (remoteCmd *RemoteCommand) Sensitive()
type ServerConfig ¶
ServerConfig is the ssh server config used to connect to remote server
func NewSrvConf ¶
func NewSrvConf(format string) *ServerConfig
NewSrvConf parse server config from string with format: user@host:port/password
func (*ServerConfig) MakeSSHConfig ¶
func (sc *ServerConfig) MakeSSHConfig() *easyssh.SSHConfig
MakeSSHConfig converts ServerConfig to easyssh.SSHConfig to ease using easyssh
func (*ServerConfig) Simple ¶
func (sc *ServerConfig) Simple() string
Simple is too simple too naive to say anything about it
func (*ServerConfig) String ¶
func (sc *ServerConfig) String() string
type SimpleCommand ¶ added in v1.0.0
type SimpleCommand struct {
Handler func(Deploy, *ServerConfig, ...interface{}) error
Args []interface{}
// contains filtered or unexported fields
}
SimpleCommand represents a simple customized command
func (*SimpleCommand) Run ¶ added in v1.0.0
func (cmd *SimpleCommand) Run(deployCtx Deploy, srvConf *ServerConfig) error
Run this simple customized command
func (*SimpleCommand) Sensitive ¶ added in v1.0.6
func (cmd *SimpleCommand) Sensitive()
type UploadCommand ¶
type UploadCommand struct {
LocalPath string
RemotePath string
// contains filtered or unexported fields
}
UploadCommand is the upload command
func (*UploadCommand) Run ¶
func (uploadCmd *UploadCommand) Run(deployCtx Deploy, srvConf *ServerConfig) error
Run the upload command
func (*UploadCommand) Sensitive ¶ added in v1.0.6
func (uploadCmd *UploadCommand) Sensitive()