Documentation ¶
Overview ¶
Maestro is a development system able to build and deploy applications (docker images) on a distrubuted CoreOS cluster. Applications are described using a simple JSON configuration and converted into runnable Fleet units and all the burden about namespaces, DNS, container linking, etc is automatically handled by Maestro
Prerequisites ¶
Install Vagrant and Fleetctl and Golang for your architecture.
Installation and Usage ¶
Please read README.md for full installation instructions and usage.
Index ¶
- func EtcdCheckExec()
- func EtcdExec(args []string, output chan string, exit chan int, key string)
- func EtcdPrepareArgs(key string) (etcdArgs []string)
- func EtcdPullKeys(skydns, all bool, key string) (exitCode int)
- func FleetBuildUnit(_, unitPath string) (exitCode int)
- func FleetCheckExec()
- func FleetCheckPath(unitPath string)
- func FleetExec(args []string, output chan string, exit chan int)
- func FleetExecCommand(cmd, unitPath string) (exitCode int)
- func FleetIsUnitRunning(unitPath string) (ret bool)
- func FleetPrepareArgs(args []string) (fleetArgs []string)
- func FleetProcessOutput(output chan string, exit chan int) (exitCode int)
- func FleetRunUnit(_, unitPath string) (exitCode int)
- func GetTmpl(name string) string
- func GetUnitFd(filepath string) *os.File
- func HandleExit(exitCode int)
- func Init(maestroDir, domainName, address, volumes, endpoints string, options []string, ...)
- func MaestroBuildContainers(unit string) (exitCode int)
- func MaestroBuildLocalUnits()
- func MaestroBuildNuke(unit string) (exitCode int)
- func MaestroBuildStatus(unit string) (exitCode int)
- func MaestroCommandExec(cmd *exec.Cmd, output chan string) (exitCode int)
- func MaestroCoreStatus() (exitCode int)
- func MaestroExecBuild(fn MaestroCommand, cmd, unit string) (exitCode int)
- func MaestroExecRun(fn MaestroCommand, cmd, unit string) (exitCode int)
- func MaestroJournal(unit string, follow, all bool) (exitCode int)
- func MaestroNuke(unit string) (exitCode int)
- func MaestroNukeAll() (exitCode int)
- func MaestroRun(unit string) (exitCode int)
- func MaestroStatus(unit string) (exitCode int)
- func MaestroStop(unit string) (exitCode int)
- func ProcessUnitTmpl(component MaestroComponent, unitName, unitPath, tmplName string)
- func SetupMaestroDir(dir string)
- type MaestroCommand
- type MaestroComponent
- type MaestroConfig
- func (c *MaestroConfig) GetAfterUnit(name string) (after string)
- func (c *MaestroConfig) GetAppPath(stage string) string
- func (c *MaestroConfig) GetContainerName(component *MaestroComponent) string
- func (c *MaestroConfig) GetNumberedUnitPath(path, number string) string
- func (c *MaestroConfig) GetUnitInternalDNS(component *MaestroComponent, domain string) string
- func (c *MaestroConfig) GetUnitName(component *MaestroComponent, suffix string) string
- func (c *MaestroConfig) GetUnitPath(component *MaestroComponent, suffix string) string
- func (c *MaestroConfig) GetUsername()
- func (c *MaestroConfig) GetVolumePath(stage, volume, volumesDir string) string
- func (c *MaestroConfig) LoadMaestroConfig(path string) MaestroConfig
- func (c *MaestroConfig) Print()
- func (c *MaestroConfig) SetMaestroComponentConfig()
- func (c *MaestroConfig) SetupMaestroAppDirs()
- func (c *MaestroConfig) SetupUsername()
- func (c *MaestroConfig) UsernameWizard()
- func (c *MaestroConfig) WriteUsernameFile()
- type MaestroLog
- func (l MaestroLog) Debug(msg string, prefix ...string)
- func (l MaestroLog) Debug2(msg, suffix string, prefix ...string)
- func (l MaestroLog) DebugError(err error)
- func (l MaestroLog) Error(err error)
- func (l MaestroLog) Fatal(err error)
- func (l MaestroLog) Out(msg string)
- func (l MaestroLog) OutRaw(msg string)
- func (l MaestroLog) SetupBase()
- func (l MaestroLog) SetupDebug()
- func (l MaestroLog) SetupPrefix(prefix ...string) (base string)
- type MaestroUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EtcdExec ¶
Wrapper around etcdctl, able to run every command. It uses two channels to communicate output and return code of every command issued.
func EtcdPrepareArgs ¶
Prepares etcdctl arguments with info based from command line
func EtcdPullKeys ¶
Pulls maestro related keys
func FleetBuildUnit ¶
Wrapper to run a container build on the coreos cluster.
func FleetCheckPath ¶
func FleetCheckPath(unitPath string)
Checks if a unit path is valid, either build unit and run unit.
func FleetExec ¶
Wrapper around fleetctl, able to run every command. It uses two channels to communicate output and return code of every command issued.
func FleetExecCommand ¶
Function able to run a command on a unit path. Output is processed and printed and fleetctl exit code is returned.
func FleetIsUnitRunning ¶
Utility function to check if a unit is already running on the cluster.
func FleetPrepareArgs ¶
Prepares fleetctl arguments with info based from command line
func FleetProcessOutput ¶
Process output and exit channel from a fleetctl command.
func FleetRunUnit ¶
Wrapper to run a unit on the coreos cluster.
func HandleExit ¶
func HandleExit(exitCode int)
func MaestroBuildContainers ¶
Build local unit files to build new docker images. After the unit is build, it will destroy, submit, load and start using fleetctl. The image will be pushed to the local registry.
func MaestroBuildLocalUnits ¶
func MaestroBuildLocalUnits()
Build local unit files for all components in configuration.
func MaestroBuildNuke ¶
Destroys all units used for building docker images. It can stop also a single unit, using `unit` argument.
func MaestroBuildStatus ¶
Check and prints the status of all units used to build new docker images.
func MaestroCoreStatus ¶
func MaestroCoreStatus() (exitCode int)
Executes a global coreos status, running `list-machines`, `list-units`, `list-unit-files`.
func MaestroExecBuild ¶
func MaestroExecBuild(fn MaestroCommand, cmd, unit string) (exitCode int)
Exec an arbitrary function on a build unit
func MaestroExecRun ¶
func MaestroExecRun(fn MaestroCommand, cmd, unit string) (exitCode int)
Exec an arbitrary function on a run unit
func MaestroJournal ¶
Prints the journal for all units in the current app It can also get the journal of a single unit, using `unit` argument.
func MaestroNuke ¶
Destroys all units in the current app. It can stop also a single unit, using `unit` argument.
func MaestroNukeAll ¶
func MaestroNukeAll() (exitCode int)
func MaestroRun ¶
Function used to submit, load and start all the units inside the current app. It can start also a single unit, using `unit` argument. If the unit is already running, it will print a message and do nothing.
func MaestroStatus ¶
Prints status for all units in the current app It can also get the status of a single unit, using `unit` argument.
func MaestroStop ¶
Stops all units in the current app. It can stop also a single unit, using `unit` argument.
func ProcessUnitTmpl ¶
func ProcessUnitTmpl(component MaestroComponent, unitName, unitPath, tmplName string)
Renders a template onto a file.
func SetupMaestroDir ¶
func SetupMaestroDir(dir string)
Setup directory ($CWD/.maestro) used to store user informations and temporary build file before submitting to coreos. Directory will be created if not existent.
Types ¶
type MaestroComponent ¶
type MaestroComponent struct { After string `json:"after"` App string `json:"app"` BuildUnitPath string `json:"build_unitpath"` Cmd string `json:"cmd"` ContainerName string `json:"container_name"` DNS string `json:"dns"` DockerArgs string `json:"docker_args"` Env []string `json:"env"` Frontend bool `json:"frontend"` GitSrc string `json:"gitsrc"` Global bool `json:"global"` InternalDNS string `json:"internal_dns"` KeepOnExit bool `json:"keep_on_exit"` Name string `json:"name"` Ports []int `json:"ports"` Scale int `json:"scale"` Single bool `json:"single"` Src string `json:"src"` Stage string `json:"stage"` UnitName string `json:"unitname"` UnitPath string `json:"unitpath"` Username string `json:"username"` Volumes []string `json:"volumes"` VolumesDir string `json:"volumes_dir"` }
MaestroComponent structure
type MaestroConfig ¶
type MaestroConfig struct { App string `json:"app"` Stages []struct { Components []MaestroComponent `json:"components"` Name string `json:"name"` } `json:"stages"` Username string `json:"username"` }
MaestroConfig structure
func BuildMaestroConfig ¶
func BuildMaestroConfig(cfg string) MaestroConfig
Public function used in the main to load the configuration.
func (*MaestroConfig) GetAfterUnit ¶
func (c *MaestroConfig) GetAfterUnit(name string) (after string)
func (*MaestroConfig) GetAppPath ¶
func (c *MaestroConfig) GetAppPath(stage string) string
Returns the local path for an app.
func (*MaestroConfig) GetContainerName ¶
func (c *MaestroConfig) GetContainerName(component *MaestroComponent) string
Returns the container name for a component (mainly for debugging purposes).
func (*MaestroConfig) GetNumberedUnitPath ¶
func (c *MaestroConfig) GetNumberedUnitPath(path, number string) string
Return a path for a numbered unit, used to start scalable components.
func (*MaestroConfig) GetUnitInternalDNS ¶
func (c *MaestroConfig) GetUnitInternalDNS(component *MaestroComponent, domain string) string
Returns an inernal DNS name for a unit (mainly for debugging purposes).
func (*MaestroConfig) GetUnitName ¶
func (c *MaestroConfig) GetUnitName(component *MaestroComponent, suffix string) string
Returns a name for a unit, starting from a `stage`, a `component` and a `suffix`.
func (*MaestroConfig) GetUnitPath ¶
func (c *MaestroConfig) GetUnitPath(component *MaestroComponent, suffix string) string
Returns the local path for a run unit. A run unit is a component of an application which will be run as docker container on the coreos cluster.
func (*MaestroConfig) GetUsername ¶
func (c *MaestroConfig) GetUsername()
func (*MaestroConfig) GetVolumePath ¶
func (c *MaestroConfig) GetVolumePath(stage, volume, volumesDir string) string
Returns a proper volume path, bound to the shared directory on the node.
func (*MaestroConfig) LoadMaestroConfig ¶
func (c *MaestroConfig) LoadMaestroConfig(path string) MaestroConfig
Parses JSON config file into MaestroConfig struct.
func (*MaestroConfig) SetMaestroComponentConfig ¶
func (c *MaestroConfig) SetMaestroComponentConfig()
Sets components config values.
func (*MaestroConfig) SetupMaestroAppDirs ¶
func (c *MaestroConfig) SetupMaestroAppDirs()
Creates directories for unit file building. Schema: $CWD/.maestro/$username/$stage/$app
func (*MaestroConfig) SetupUsername ¶
func (c *MaestroConfig) SetupUsername()
Manages username creation, loading and saving to file.
func (*MaestroConfig) UsernameWizard ¶
func (c *MaestroConfig) UsernameWizard()
Wizard to create a new username.
func (*MaestroConfig) WriteUsernameFile ¶
func (c *MaestroConfig) WriteUsernameFile()
Writes username JSON informations onto user file
type MaestroLog ¶
type MaestroLog struct {
// contains filtered or unexported fields
}
Logger with function to print colors
func (MaestroLog) Debug ¶
func (l MaestroLog) Debug(msg string, prefix ...string)
Logs to standard error with colors
func (MaestroLog) Debug2 ¶
func (l MaestroLog) Debug2(msg, suffix string, prefix ...string)
Logs to standard error with colors also in the message
func (MaestroLog) OutRaw ¶
func (l MaestroLog) OutRaw(msg string)
Logs to standard output without carriage return
func (MaestroLog) SetupBase ¶
func (l MaestroLog) SetupBase()
Setup "base" application name for debugging
func (MaestroLog) SetupPrefix ¶
func (l MaestroLog) SetupPrefix(prefix ...string) (base string)
Setup prefix for debugging with colors
type MaestroUser ¶
type MaestroUser struct {
Name string `json:"name"`
}