Documentation ¶
Index ¶
- func ConnectTokenDB(path string) *sql.DB
- func GenerateToken(length int) string
- func GetActiveProject(db *sql.DB) (string, error)
- func NodeSchema() string
- func ProjectSchema() string
- func TokenPart() string
- func TokenSchema() string
- type Command
- type Init
- type MinionCommand
- type Node
- func (node Node) IsLocal() bool
- func (node Node) Remote() string
- func (node Node) RsyncFileCMD(filePath, targetFolder string) Command
- func (node Node) RsyncFolderCMD(execFolder, targetFolder string) Command
- func (node Node) RsyncTarget(targetFolder string) string
- func (node Node) SSHCommand(args ...string) Command
- func (node *Node) SetToMinion(db *sql.DB) error
- func (node Node) ToMinon() util.ServerConfig
- type Project
- type Service
- func (service Service) GetEnvVars() []string
- func (service Service) GetKeywordArgs() []string
- func (service *Service) GetServiceDef(path string) error
- func (service Service) PullCommand() Command
- func (service Service) PushCommand() Command
- func (service Service) RunCommand(network string) Command
- func (service Service) ServiceFilePath(path string) string
- func (service Service) StopCommand() Command
- type Token
- type TokenBundle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectTokenDB ¶
ConnectTokenDB Connects to a token db and returns the handler
func GenerateToken ¶
GenerateToken Creates a random token consiting of aspecified number of sha256 hashes
func GetActiveProject ¶
GetActiveProject Fetches the name of the current active project
func ProjectSchema ¶
func ProjectSchema() string
ProjectSchema Returns the database schema for projects
Types ¶
type Command ¶
Command Holds the main command and argument to be executed against os/exec
func DockerCommand ¶
DockerCommand creates a general docker command
type MinionCommand ¶
MinionCommand Holds a command and the minon it should be sent to
type Node ¶
type Node struct { Project string `json:"project"` IP string `json:"ip"` OS string `json:"os"` IsMaster bool `json:"isMaster"` User string `json:"user"` }
Node contains node metadata
func (Node) RsyncFileCMD ¶
RsyncFileCMD Creates a command to rsync a file to the node
func (Node) RsyncFolderCMD ¶
RsyncFolderCMD Creates a command to rsync minion executables to the node
func (Node) RsyncTarget ¶
RsyncTarget Prepends user@hostname: to target folder if node is not local
func (Node) SSHCommand ¶
SSHCommand Creates an ssh command to be executed on the node
func (*Node) SetToMinion ¶
SetToMinion sets a node struct to hold values of a minion
func (Node) ToMinon ¶
func (node Node) ToMinon() util.ServerConfig
ToMinon Turns a node into a minion server config
type Project ¶
type Project struct { Name string `json:"name"` Folder string `json:"folder"` SwarmToken string `json:"swarmToken"` IsActive bool `json:"isActive"` Network string `json:"network"` MasterToken string `json:"masterToken"` Master string `json:"master"` }
Project holds metadata about a project
func NewProject ¶
NewProject generates a new project based on name an folder
func (Project) InactivateOthers ¶
InactivateOthers Sets all other projects besides the supplied one to inactive
func (Project) MakeMasterNode ¶
MakeMasterNode creates node struct for a project master node
type Service ¶
type Service struct { Name string `json:"name"` Image string `json:"image"` EnvVars []string `json:"envVars"` KeywordArgs []string `json:"keywordArgs"` }
Service Holds service configuration info
func (Service) GetEnvVars ¶
GetEnvVars Formats the environment arguments in a service definition to be runnable
func (Service) GetKeywordArgs ¶
GetKeywordArgs Formats the keyword arguments in a service definition to be runnable
func (*Service) GetServiceDef ¶
GetServiceDef reads a given service definition file and stores the content in the given service struct
func (Service) PullCommand ¶
PullCommand creates a command to pull a docker image
func (Service) PushCommand ¶
PushCommand creates a command to push a docker image
func (Service) RunCommand ¶
RunCommand creates a command to start a servcie
func (Service) ServiceFilePath ¶
ServiceFilePath Creates a file path to a service's definition file
func (Service) StopCommand ¶
StopCommand creates a command to pull a docker image
type Token ¶
Token Struct to keep a token and its timestamp
func NewToken ¶
func NewToken() Token
NewToken Return a new random token with timestamp set to the current UTC time
func (Token) ToBundle ¶
func (token Token) ToBundle(masterToken string) TokenBundle
ToBundle Turns a token to a TokenBundle with a given master token
type TokenBundle ¶
TokenBundle Struct to keep all project tokens
func GetTokenBundle ¶
func GetTokenBundle(path string) TokenBundle
GetTokenBundle Retrives tokens from the token-db
func (TokenBundle) Print ¶
func (tokens TokenBundle) Print()
Print Prints the content of the token bundle in a formated way