commands

package
v0.0.0-...-397181f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectConfigFilePath

func FindProjectConfigFilePath() (string, error)

FindProjectConfigFilePath traverses directory structure looking for an outrigger project config file.

Types

type BaseCommand

type BaseCommand struct {
	RigCommand
	// contains filtered or unexported fields
}

BaseCommand is parent for all rig commands

func (*BaseCommand) Before

func (cmd *BaseCommand) Before(c *cli.Context) error

Before configure the function to run before all commands to setup core services.

func (*BaseCommand) Failure

func (cmd *BaseCommand) Failure(message string, errorName string, exitCode int) error

Failure encapsulates the functionality for reporting command failure

func (*BaseCommand) NewContext

func (cmd *BaseCommand) NewContext(name string, flags []cli.Flag, parent *cli.Context) *cli.Context

NewContext creates a new Context struct to pass along to delegate commands

func (*BaseCommand) SetContextFlag

func (cmd *BaseCommand) SetContextFlag(ctx *cli.Context, name string, value string)

SetContextFlag set a flag on the provided context

func (*BaseCommand) Success

func (cmd *BaseCommand) Success(message string) error

Success encapsulates the functionality for reporting command success

type ComposeFile

type ComposeFile struct {
	Volumes map[string]Volume
}

ComposeFile is a minimal compose file struct to discover volumes

type Config

type Config struct {
	BaseCommand
}

Config is the command for setting docker config to talk to a Docker Machine

func (*Config) Commands

func (cmd *Config) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Config) Run

func (cmd *Config) Run(c *cli.Context) error

Run executes the `rig config` command

type DNS

type DNS struct {
	BaseCommand
}

DNS is the command for starting all DNS services and appropriate network routing to access services

func (*DNS) Commands

func (cmd *DNS) Commands() []cli.Command

Commands returns the operations supported by this command

func (*DNS) ConfigureRoutes

func (cmd *DNS) ConfigureRoutes(machine Machine)

ConfigureRoutes will configure routing to allow access to containers on IP addresses within the Docker Machine bridge network

func (*DNS) Run

func (cmd *DNS) Run(c *cli.Context) error

Run executes the `rig dns` command

func (*DNS) StartDNS

func (cmd *DNS) StartDNS(machine Machine, nameservers string) error

StartDNS will start the dnsdock service

func (*DNS) StopDNS

func (cmd *DNS) StopDNS()

StopDNS stops the dnsdock service and cleans up

type DNSRecords

type DNSRecords struct {
	BaseCommand
}

DNSRecords is the command for exporting all DNS Records in Outrigger DNS in `hosts` file format

func (*DNSRecords) Commands

func (cmd *DNSRecords) Commands() []cli.Command

Commands returns the operations supported by this command

func (*DNSRecords) LoadRecords

func (cmd *DNSRecords) LoadRecords() ([]map[string]interface{}, error)

LoadRecords retrieves the records from DNSDock and processes/return them

func (*DNSRecords) Run

func (cmd *DNSRecords) Run(c *cli.Context) error

Run executes the `rig dns-records` command

type Dashboard

type Dashboard struct {
	BaseCommand
}

Dashboard is the command for launching the Outrigger Dashboard

func (*Dashboard) Commands

func (cmd *Dashboard) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Dashboard) LaunchDashboard

func (cmd *Dashboard) LaunchDashboard(machine Machine) error

LaunchDashboard launches the dashboard, stopping it first for a clean automatic update

func (*Dashboard) Run

func (cmd *Dashboard) Run(ctx *cli.Context) error

Run executes the `rig dashboard` command

func (*Dashboard) StopDashboard

func (cmd *Dashboard) StopDashboard()

StopDashboard stops and removes the dashboard container

type DataBackup

type DataBackup struct {
	BaseCommand
}

DataBackup is the command for backing up the /data directory within the Docker Machine

func (*DataBackup) Commands

func (cmd *DataBackup) Commands() []cli.Command

Commands returns the operations supported by this command

func (*DataBackup) Run

func (cmd *DataBackup) Run(c *cli.Context) error

Run executes the `rig data-backup` command

type DataRestore

type DataRestore struct {
	BaseCommand
}

DataRestore is the command for restoring up the /data directory within the Docker Machine

func (*DataRestore) Commands

func (cmd *DataRestore) Commands() []cli.Command

Commands returns the operations supported by this command

func (*DataRestore) Run

func (cmd *DataRestore) Run(c *cli.Context) error

Run executes the `rig data-restore` command

type Dev

type Dev struct {
	BaseCommand
}

Dev is the command for setting docker config to talk to a Docker Machine

func (*Dev) Commands

func (cmd *Dev) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Dev) RunFail

func (cmd *Dev) RunFail(c *cli.Context) error

RunFail executes the `rig dev:fail` command

func (*Dev) RunSucceed

func (cmd *Dev) RunSucceed(c *cli.Context) error

RunSucceed executes the `rig dev:succeed` command

type Doctor

type Doctor struct {
	BaseCommand
}

Doctor is the command for performing diagnostics on the Outrigger environment

func (*Doctor) Commands

func (cmd *Doctor) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Doctor) Run

func (cmd *Doctor) Run(c *cli.Context) error

Run executes the `rig doctor` command nolint: gocyclo

type Kill

type Kill struct {
	BaseCommand
}

Kill is the command killing a Docker Machine

func (*Kill) Commands

func (cmd *Kill) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Kill) Run

func (cmd *Kill) Run(c *cli.Context) error

Run executes the `rig kill` command

type Machine

type Machine struct {
	Name string
	// contains filtered or unexported fields
}

Machine is the struct for encapsulating operations on a Docker Machine

func (*Machine) CheckXhyveRequirements

func (m *Machine) CheckXhyveRequirements() error

CheckXhyveRequirements verifies that the correct xhyve environment exists

func (*Machine) Create

func (m *Machine) Create(driver string, cpuCount string, memSize string, diskSize string, isoURL string) error

Create will generate a new Docker Machine configured according to user specification

func (*Machine) Exists

func (m *Machine) Exists() bool

Exists determines if the Docker Machine exist

func (*Machine) GetBridgeIP

func (m *Machine) GetBridgeIP() string

GetBridgeIP returns the Bridge IP by looking for a bip= option

func (*Machine) GetCPU

func (m *Machine) GetCPU() int

GetCPU returns the number of configured CPU for this Docker Machine

func (*Machine) GetData

func (m *Machine) GetData() *simplejson.Json

GetData will inspect the Docker Machine and return the parsed JSON describing the machine

func (*Machine) GetDisk

func (m *Machine) GetDisk() int

GetDisk returns the disk size in MB

func (*Machine) GetDiskInGB

func (m *Machine) GetDiskInGB() int

GetDiskInGB returns the disk size in GB

func (*Machine) GetDockerVersion

func (m *Machine) GetDockerVersion() (*version.Version, error)

GetDockerVersion returns the Version of Docker running within Docker Machine

func (*Machine) GetDriver

func (m *Machine) GetDriver() string

GetDriver returns the virtualization driver name

func (*Machine) GetHostDNSResolver

func (m *Machine) GetHostDNSResolver() bool

GetHostDNSResolver checks if the VirtualBox host DNS resolver is working. This should work okay for VMware or other machines without the option, too.

func (*Machine) GetIP

func (m *Machine) GetIP() string

GetIP returns the IP address for the Docker Machine

func (*Machine) GetMemory

func (m *Machine) GetMemory() int

GetMemory returns the amount of configured memory for this Docker Machine

func (*Machine) GetSysctl

func (m *Machine) GetSysctl(setting string) (string, error)

GetSysctl returns the configured value for the provided sysctl setting on the Docker Machine

func (*Machine) IsRunning

func (m *Machine) IsRunning() bool

IsRunning returns the Docker Machine running status

func (*Machine) IsXhyve

func (m *Machine) IsXhyve() bool

IsXhyve returns if the virt driver is xhyve

func (*Machine) Remove

func (m *Machine) Remove() error

Remove deleted the Docker Machine

func (*Machine) SetEnv

func (m *Machine) SetEnv()

SetEnv will set the Docker proxy variables that determine which machine the docker command communicates

func (*Machine) SetSysctl

func (m *Machine) SetSysctl(key string, val string) error

SetSysctl sets the sysctl setting on the Docker Machine

func (*Machine) Start

func (m *Machine) Start() error

Start boots the Docker Machine

func (*Machine) Stop

func (m *Machine) Stop() error

Stop halts the Docker Machine

func (*Machine) UnsetEnv

func (m *Machine) UnsetEnv()

UnsetEnv will remove the Docker proxy variables

func (*Machine) WaitForDev

func (m *Machine) WaitForDev() error

WaitForDev will wait a period of time for communication with the docker daemon to be established

type Project

type Project struct {
	BaseCommand
	Config *ProjectConfig
}

Project is the command enabling projects to define their own custom commands in a project based configuration file

func (*Project) Commands

func (cmd *Project) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Project) GetScriptsAsSubcommands

func (cmd *Project) GetScriptsAsSubcommands(otherSubcommands []cli.Command) []cli.Command

GetScriptsAsSubcommands Processes script configuration into formal subcommands.

func (*Project) Run

func (cmd *Project) Run(c *cli.Context) error

Run executes the specified `rig project` script

func (*Project) ScriptRunHelp

func (cmd *Project) ScriptRunHelp(script *Script) string

ScriptRunHelp generates help details based on script configuration.

type ProjectConfig

type ProjectConfig struct {
	File string
	Path string

	Scripts   map[string]*Script
	Sync      *Sync
	Namespace string
	Version   string
	Bin       string
}

ProjectConfig is the struct for the outrigger.yml file

func NewProjectConfig

func NewProjectConfig() *ProjectConfig

NewProjectConfig creates a new ProjectConfig using configured or default locations

func NewProjectConfigFromFile

func NewProjectConfigFromFile(filename string) (*ProjectConfig, error)

NewProjectConfigFromFile creates a new ProjectConfig from the specified file. @todo do not use the logger here, instead return errors. Use of the logger here initializes it in non-verbose mode. nolint: gocyclo

func (*ProjectConfig) NotEmpty

func (c *ProjectConfig) NotEmpty() bool

NotEmpty is a simple check to confirm you have a populated config object.

func (*ProjectConfig) ValidateConfigVersion

func (c *ProjectConfig) ValidateConfigVersion() error

ValidateConfigVersion ensures our configuration data structure conforms to our ad hoc schema. @TODO do this in a more formal way. See docker/libcompose for an example.

func (*ProjectConfig) ValidateProjectScripts

func (c *ProjectConfig) ValidateProjectScripts(subcommands []cli.Command)

ValidateProjectScripts will validate the config scripts against a set of rules/norms nolint: gocyclo

type ProjectCreate

type ProjectCreate struct {
	BaseCommand
}

ProjectCreate is the command for running the project generator to scaffold a new project

func (*ProjectCreate) Commands

func (cmd *ProjectCreate) Commands() []cli.Command

Commands returns the operations supported by this command

func (*ProjectCreate) Create

func (cmd *ProjectCreate) Create(ctx *cli.Context) error

Create executes the `rig project create` command to execute the desired generator

func (*ProjectCreate) RunGenerator

func (cmd *ProjectCreate) RunGenerator(ctx *cli.Context, machine Machine, image string) error

RunGenerator runs the generator image

type ProjectScript

type ProjectScript struct {
	// contains filtered or unexported fields
}

ProjectScript wraps the evaluation of project scripts. It mimics command struct except with unexported values.

func (*ProjectScript) Capture

func (p *ProjectScript) Capture(script *Script, extra []string) (string, int, error)

Capture matches Run, but returns the data from the command execution instead of "streaming" the result to the terminal.

func (*ProjectScript) CreateCommand

func (p *ProjectScript) CreateCommand(steps, extra []string, workingDirectory string) *exec.Cmd

CreateCommand is a factory method to assemble an executable command from project-derived parameters. @see https://github.com/medhoover/gom/blob/staging/config/command.go

func (*ProjectScript) GetCommand

func (p *ProjectScript) GetCommand(steps, extra []string, workingDirectory string) *exec.Cmd

GetCommand is a deprecation wrapper around NormalizeCommand. It was renamed for improved clarity alongside other methods.

func (*ProjectScript) GetWorkingDirectory

func (p *ProjectScript) GetWorkingDirectory() string

GetWorkingDirectory retrieves the working directory for project commands.

func (*ProjectScript) Run

func (p *ProjectScript) Run(script *Script, extra []string) int

Run takes a Script configuration and executes it per the definition of the project script and bonus arguments from the extra parameter. Commands are run from the directory context of the project if available. This also supports follow-up user interaction.

type ProjectSync

type ProjectSync struct {
	BaseCommand
	Config *ProjectConfig
}

ProjectSync is the command volume and file sync operations

func (*ProjectSync) Commands

func (cmd *ProjectSync) Commands() []cli.Command

Commands returns the operations supported by this command

func (*ProjectSync) DeriveLocalSyncPath

func (cmd *ProjectSync) DeriveLocalSyncPath(config *ProjectConfig, override string) (string, error)

DeriveLocalSyncPath will derive the source path for the local host side of the file sync. If there is no override, use an empty string.

func (*ProjectSync) GetVolumeName

func (cmd *ProjectSync) GetVolumeName(config *ProjectConfig, workingDir string) string

GetVolumeName will find the volume name through a variety of fall backs

func (*ProjectSync) LoadComposeFile

func (cmd *ProjectSync) LoadComposeFile() (*ComposeFile, error)

LoadComposeFile will load the proper compose file

func (*ProjectSync) LogFileName

func (cmd *ProjectSync) LogFileName(name string) string

LogFileName gets the unison sync file name. Be sure to convert it to an absolute path if used with functions that cannot use the working directory context.

func (*ProjectSync) RunCheck

func (cmd *ProjectSync) RunCheck(ctx *cli.Context) error

RunCheck performs a doctor-like examination of the file sync health.

func (*ProjectSync) RunName

func (cmd *ProjectSync) RunName(ctx *cli.Context) error

RunName provides the name of the sync volume and container. This is made available to facilitate scripting.

func (*ProjectSync) RunPurge

func (cmd *ProjectSync) RunPurge(ctx *cli.Context) error

RunPurge cleans out the project sync state.

func (*ProjectSync) RunStart

func (cmd *ProjectSync) RunStart(ctx *cli.Context) error

RunStart executes the `rig project sync:start` command to start the Unison sync process.

func (*ProjectSync) RunStop

func (cmd *ProjectSync) RunStop(ctx *cli.Context) error

RunStop executes the `rig project sync:stop` command to shut down and unison containers

func (*ProjectSync) SetupBindVolume

func (cmd *ProjectSync) SetupBindVolume(volumeName string, workingDir string) error

SetupBindVolume will create minimal Docker Volumes for systems that have native container/volume support

func (*ProjectSync) StartUnisonSync

func (cmd *ProjectSync) StartUnisonSync(ctx *cli.Context, volumeName string, config *ProjectConfig, workingDir string) error

StartUnisonSync will create and launch the volumes and containers on systems that need/support Unison

func (*ProjectSync) WaitForSyncInit

func (cmd *ProjectSync) WaitForSyncInit(logFile string, workingDir string, timeoutSeconds int, syncWaitSeconds int) error

WaitForSyncInit will wait for the local unison process to finish initializing when the log file exists and has stopped growing in size

func (*ProjectSync) WaitForUnisonContainer

func (cmd *ProjectSync) WaitForUnisonContainer(containerName string, timeoutSeconds int) (string, error)

WaitForUnisonContainer will wait for the unison container port to allow connections Due to the fact that we don't compile with -cgo (so we can build using Docker), we need to discover the IP address of the container instead of using the DNS name when compiled without -cgo this executable will not use the native mac dns resolution which is how we have configured dnsdock to provide names for containers.

type Prune

type Prune struct {
	BaseCommand
}

Prune is the command for cleaning up Docker resources

func (*Prune) Commands

func (cmd *Prune) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Prune) Run

func (cmd *Prune) Run(c *cli.Context) error

Run executes the `rig prune` command

type Remove

type Remove struct {
	BaseCommand
}

Remove is the command for deleting a Docker Machine

func (*Remove) Commands

func (cmd *Remove) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Remove) Run

func (cmd *Remove) Run(c *cli.Context) error

Run executes the `rig remove` command

type RigCommand

type RigCommand interface {
	Commands() []cli.Command
}

RigCommand is the interface for all rig commands

type SSH

type SSH struct {
	BaseCommand
}

SSH is the command for staring an SSH session inside the docker machine vm

func (*SSH) Commands

func (cmd *SSH) Commands() []cli.Command

Commands returns the operations supported by this command

func (*SSH) Run

func (cmd *SSH) Run(c *cli.Context) error

Run executes the `rig ssh` command

type Script

type Script struct {
	ID          string
	Alias       string
	Description string
	Run         []string
}

Script is the struct for project-defined command configuration

type Start

type Start struct {
	BaseCommand
}

Start is the command for creating and starting a Docker Machine and other core Outrigger services

func (*Start) Commands

func (cmd *Start) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Start) Run

func (cmd *Start) Run(c *cli.Context) error

Run executes the `rig start` command

func (*Start) StartMinimal

func (cmd *Start) StartMinimal(nameservers string) error

StartMinimal will start "minimal" Outrigger operations, which refers to environments where a virtual machine and networking is not required or managed by Outrigger.

type Status

type Status struct {
	BaseCommand
}

Status is the command for reporting on the status of the Docker Machine

func (*Status) Commands

func (cmd *Status) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Status) Run

func (cmd *Status) Run(c *cli.Context) error

Run executes the `rig status` command

type Stop

type Stop struct {
	BaseCommand
}

Stop is the command for shutting down the Docker Machine and core Outrigger services

func (*Stop) Commands

func (cmd *Stop) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Stop) Run

func (cmd *Stop) Run(c *cli.Context) error

Run executes the `rig stop` command

func (*Stop) StopMinimal

func (cmd *Stop) StopMinimal() error

StopMinimal will stop "minimal" Outrigger operations, which refers to environments where a virtual machine and networking are not required or managed by Outrigger.

func (*Stop) StopOutrigger

func (cmd *Stop) StopOutrigger() error

StopOutrigger will halt all Outrigger and Docker-related operations.

type Sync

type Sync struct {
	Volume string
	Ignore []string
}

Sync is the struct for sync configuration

type Upgrade

type Upgrade struct {
	BaseCommand
}

Upgrade is the command for backing up Docker Machine /data, upgrading the Docker Machine to the most recent release and restoring the Docker Machine /data

func (*Upgrade) Commands

func (cmd *Upgrade) Commands() []cli.Command

Commands returns the operations supported by this command

func (*Upgrade) Run

func (cmd *Upgrade) Run(c *cli.Context) error

Run executes the `rig upgrade` command

type Volume

type Volume struct {
	External bool
}

Volume is a minimal volume spec to determine if a defined volume is declared external

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL