lctrld

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DockerHome = ".docker"

DockerHome pretends that /tmp/workspace/evts/<EVTDIR> is the $HOME, so under that would be .docker

Variables

This section is empty.

Functions

func AddGenesisAccounts

func AddGenesisAccounts(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (err error)

AddGenesisAccounts runs gaiad add-genesis-account with the created addresses and default initial balances

func CollectGenesisTxs

func CollectGenesisTxs(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (err error)

CollectGenesisTxs is run on every node's config directory from the single directory where the genesis transactions were placed before. In the end, only the first node's genesis.json will be used.

func ConfigurePayload

func ConfigurePayload(settings *config.Schema, evt *model.Event, cmdRunner cmdrunner.CommandRunner) (err error)

ConfigurePayload is a wrapper function that runs all the needed steps to generate a payload's configuration and fills out the evt object with said information.

func CreateEvent

func CreateEvent(settings *config.Schema, evt *model.Event) (err error)

CreateEvent creates the event home and the event descriptor

func DeployPayload

func DeployPayload(settings *config.Schema, evt *model.Event, cmdRunner cmdrunner.CommandRunner) (err error)

DeployPayload tells the provisioned machines to run the configured docker image

func DestroyEvent

func DestroyEvent(settings *config.Schema, evt *model.Event, cmdRunner cmdrunner.CommandRunner) (err error)

DestroyEvent destroy an existing event

func DownloadPayloadBinary

func DownloadPayloadBinary(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (err error)

DownloadPayloadBinary downloads a copy of the payload binaries to the host running lctrld to generate the config files for the provisioned machines

func EditConfigs

func EditConfigs(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (err error)

EditConfigs edits the config.toml of every node to have the same persistent_peers.

func GenerateFaucetConfig

func GenerateFaucetConfig(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (err error)

GenerateFaucetConfig generates a configuration for the faucet given what it knows about the event

func GenerateKeys

func GenerateKeys(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (*model.Event, error)

GenerateKeys generates keys for each genesis account (this includes validator accounts). The specific command is gaiacli keys add validatoremail/some other name -o json --keyring-backend test --home.... for each node.

func GenesisTxs

func GenesisTxs(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (err error)

GenesisTxs runs gentx to turn accounts into validator accounts and outputs the genesis transactions into a single folder.

func GetEventByID

func GetEventByID(settings *config.Schema, ID string) (event model.Event, err error)

GetEventByID retrieve an event by name

func InitDaemon

func InitDaemon(settings *config.Schema, evt *model.Event, runCommand cmdrunner.CommandRunner) (*model.Event, error)

InitDaemon runs gaiad init burnerchain --home state.DaemonConfigDir and gaiad tendermint show-node-id

func InspectEvent

func InspectEvent(settings *config.Schema, evt *model.Event, cmdRunner cmdrunner.CommandRunner) (err error)

InspectEvent inspect status of the infrastructure for an event

func InstallDockerMachine

func InstallDockerMachine(settings *config.Schema) (err error)

InstallDockerMachine setup docker machine environment

func ListEvents

func ListEvents(settings *config.Schema) (events []model.Event, err error)

ListEvents list available events

func LoadEvent

func LoadEvent(settings *config.Schema, evtID string) (evt *model.Event, err error)

LoadEvent returns the Event model of the specified event ID

func ProvisionEvent added in v1.0.1

func ProvisionEvent(settings *config.Schema, evt *model.Event, cmdRunner cmdrunner.CommandRunner) (err error)

ProvisionEvent provision the infrastructure for the event

func RereadDockerMachineInfo

func RereadDockerMachineInfo(settings *config.Schema, evt *model.Event) (event *model.Event, err error)

RereadDockerMachineInfo is useful when docker-machine failed during 'create', and a human fixed the problem, and wants to continue

func SetupWorkspace

func SetupWorkspace(settings *config.Schema) (err error)

SetupWorkspace setup the workspace for the service

func StoreEvent

func StoreEvent(settings *config.Schema, evt *model.Event) (err error)

StoreEvent saves the Event model to a file

Types

type DockerMachine added in v1.0.1

type DockerMachine struct {
	EventID  string
	EnvVars  []string
	Settings *config.Schema
}

DockerMachine implements docker-machine functionality for lctrld

func NewDockerMachine added in v1.0.1

func NewDockerMachine(settings *config.Schema, eventID string) *DockerMachine

NewDockerMachine ensures that all fields of a DockerMachineConfig are filled out

func (*DockerMachine) Copy added in v1.0.1

func (dm *DockerMachine) Copy(machineName, sourcePath, destPath string, cmdRunner cmdrunner.CommandRunner) (err error)

Copy recursively copies a path from the local machine to the provisioned Machine

func (*DockerMachine) HomeDir added in v1.0.1

func (dm *DockerMachine) HomeDir(machineName string) string

HomeDir returns the path of a docker-machine instance home, e.g. /tmp/workspace/evts/drop-xxx/.docker/machine/machines/drop-xxx-0/

func (*DockerMachine) ProvisionMachine added in v1.0.1

func (dm *DockerMachine) ProvisionMachine(machineName, provider string, cmdRunner cmdrunner.CommandRunner) (mc *model.Machine, err error)

ProvisionMachine runs docker-machine create MACHINE_NAME

func (*DockerMachine) ReadConfig added in v1.0.1

func (dm *DockerMachine) ReadConfig(machineName string) (mc *model.Machine, err error)

ReadConfig return configuration of a docker machine

func (*DockerMachine) Run added in v1.0.1

func (dm *DockerMachine) Run(machineName string, cmd []string, cmdRunner cmdrunner.CommandRunner) (out string, err error)

Run uses docker-machine ssh to run a command on the remote machine.

func (*DockerMachine) RunDocker added in v1.0.1

func (dm *DockerMachine) RunDocker(machineName string, cmd []string, cmdRunner cmdrunner.CommandRunner) (out string, err error)

RunDocker tells this computer's docker binary to talk with the remote machine's docker installation and run a commnad for safety, this command prepends "docker" to any command you send it. Therefore, to run "docker pull <IMAGE>" on the remote machine, pass in []string{"pull", IMAGENAME}

func (*DockerMachine) Status added in v1.0.1

func (dm *DockerMachine) Status(machineName string, cmdRunner cmdrunner.CommandRunner) (out string, err error)

Status runs docker-machine ip MACHINE_NAME and docker-machine status machine_NAME

func (*DockerMachine) StopMachine added in v1.0.1

func (dm *DockerMachine) StopMachine(machineName string, cmdRunner cmdrunner.CommandRunner) (err error)

StopMachine runs docker-machine stop MACHINE_NAME && docker-machine rm -y MACHINE_NAME

type DockerMachineConfigFormat

type DockerMachineConfigFormat struct {
	ConfigVersion int `json:"ConfigVersion"`
	Driver        struct {
		IPAddress      string `json:"IPAddress"`
		MachineName    string `json:"MachineName"`
		SSHUser        string `json:"SSHUser"`
		SSHPort        int    `json:"SSHPort"`
		SSHKeyPath     string `json:"SSHKeyPath"`
		StorePath      string `json:"StorePath"`
		SwarmMaster    bool   `json:"SwarmMaster"`
		SwarmHost      string `json:"SwarmHost"`
		SwarmDiscovery string `json:"SwarmDiscovery"`
		VBoxManager    struct {
		} `json:"VBoxManager"`
		HostInterfaces struct {
		} `json:"HostInterfaces"`
		CPU                 int    `json:"CPU"`
		Memory              int    `json:"Memory"`
		DiskSize            int    `json:"DiskSize"`
		NatNicType          string `json:"NatNicType"`
		Boot2DockerURL      string `json:"Boot2DockerURL"`
		Boot2DockerImportVM string `json:"Boot2DockerImportVM"`
		HostDNSResolver     bool   `json:"HostDNSResolver"`
		HostOnlyCIDR        string `json:"HostOnlyCIDR"`
		HostOnlyNicType     string `json:"HostOnlyNicType"`
		HostOnlyPromiscMode string `json:"HostOnlyPromiscMode"`
		UIType              string `json:"UIType"`
		HostOnlyNoDHCP      bool   `json:"HostOnlyNoDHCP"`
		NoShare             bool   `json:"NoShare"`
		DNSProxy            bool   `json:"DNSProxy"`
		NoVTXCheck          bool   `json:"NoVTXCheck"`
		ShareFolder         string `json:"ShareFolder"`
	} `json:"Driver"`
	DriverName  string `json:"DriverName"`
	HostOptions struct {
		Driver        string `json:"Driver"`
		Memory        int    `json:"Memory"`
		Disk          int    `json:"Disk"`
		EngineOptions struct {
			ArbitraryFlags   []interface{} `json:"ArbitraryFlags"`
			DNS              interface{}   `json:"Dns"`
			GraphDir         string        `json:"GraphDir"`
			Env              []interface{} `json:"Env"`
			Ipv6             bool          `json:"Ipv6"`
			InsecureRegistry []interface{} `json:"InsecureRegistry"`
			Labels           []interface{} `json:"Labels"`
			LogLevel         string        `json:"LogLevel"`
			StorageDriver    string        `json:"StorageDriver"`
			SelinuxEnabled   bool          `json:"SelinuxEnabled"`
			TLSVerify        bool          `json:"TlsVerify"`
			RegistryMirror   []interface{} `json:"RegistryMirror"`
			InstallURL       string        `json:"InstallURL"`
		} `json:"EngineOptions"`
		SwarmOptions struct {
			IsSwarm            bool          `json:"IsSwarm"`
			Address            string        `json:"Address"`
			Discovery          string        `json:"Discovery"`
			Agent              bool          `json:"Agent"`
			Master             bool          `json:"Master"`
			Host               string        `json:"Host"`
			Image              string        `json:"Image"`
			Strategy           string        `json:"Strategy"`
			Heartbeat          int           `json:"Heartbeat"`
			Overcommit         int           `json:"Overcommit"`
			ArbitraryFlags     []interface{} `json:"ArbitraryFlags"`
			ArbitraryJoinFlags []interface{} `json:"ArbitraryJoinFlags"`
			Env                interface{}   `json:"Env"`
			IsExperimental     bool          `json:"IsExperimental"`
		} `json:"SwarmOptions"`
		AuthOptions struct {
			CertDir              string        `json:"CertDir"`
			CaCertPath           string        `json:"CaCertPath"`
			CaPrivateKeyPath     string        `json:"CaPrivateKeyPath"`
			CaCertRemotePath     string        `json:"CaCertRemotePath"`
			ServerCertPath       string        `json:"ServerCertPath"`
			ServerKeyPath        string        `json:"ServerKeyPath"`
			ClientKeyPath        string        `json:"ClientKeyPath"`
			ServerCertRemotePath string        `json:"ServerCertRemotePath"`
			ServerKeyRemotePath  string        `json:"ServerKeyRemotePath"`
			ClientCertPath       string        `json:"ClientCertPath"`
			ServerCertSANs       []interface{} `json:"ServerCertSANs"`
			StorePath            string        `json:"StorePath"`
		} `json:"AuthOptions"`
	} `json:"HostOptions"`
	Name string `json:"Name"`
}

DockerMachineConfigFormat is the structure of .docker/machine/machines/<MACHINE NAME>/config.json, which describes a deployed VM's configuration

Jump to

Keyboard shortcuts

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