swarm

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "swarm",
	Short: "Hatchery Swarm commands: hatchery swarm --help",
	Long: `Hatchery Swarm commands: hatchery swarm <command>
Start worker on a docker swarm cluster.

You have to export DOCKER_HOST
You should export DOCKER_TLS_VERIFY and DOCKER_CERT_PATH

$ cds generate token --group shared.infra --expiration persistent
2706bda13748877c57029598b915d46236988c7c57ea0d3808524a1e1a3adef4

$ DOCKER_HOST="tcp://localhost:2375" hatchery swarm --api=https://<api.domain> --token=<token> 

	`,
	Run: func(cmd *cobra.Command, args []string) {
		hatchery.Born(hatcherySwarm, viper.GetString("api"), viper.GetString("token"), viper.GetInt("provision"), viper.GetInt("request-api-timeout"), viper.GetBool("insecure"))
	},
	PreRun: func(cmd *cobra.Command, args []string) {
		hatcherySwarm.onlyWithServiceReq = viper.GetBool("only-with-service-req")
		hatcherySwarm.maxContainers = viper.GetInt("max-containers")
		hatcherySwarm.defaultMemory = viper.GetInt("worker-memory")
		hatcherySwarm.workerTTL = viper.GetInt("worker-ttl")

		if os.Getenv("DOCKER_HOST") == "" {
			sdk.Exit("Please export docker client env variables DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH")
		}
	},
}

Cmd configures comamnd for HatcherySwarm

Functions

This section is empty.

Types

type HatcherySwarm

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

HatcherySwarm is a hatchery which can be connected to a remote to a docker remote api

func (*HatcherySwarm) CanSpawn

func (h *HatcherySwarm) CanSpawn(model *sdk.Model, req []sdk.Requirement) bool

CanSpawn checks if the model can be spawned by this hatchery

func (*HatcherySwarm) Hatchery

func (h *HatcherySwarm) Hatchery() *sdk.Hatchery

Hatchery returns Hatchery instances

func (*HatcherySwarm) ID

func (h *HatcherySwarm) ID() int64

ID returns ID of the Hatchery

func (*HatcherySwarm) Init

func (h *HatcherySwarm) Init() error

Init connect the hatchery to the docker api

func (*HatcherySwarm) KillWorker

func (h *HatcherySwarm) KillWorker(worker sdk.Worker) error

KillWorker kill the worker

func (*HatcherySwarm) SpawnWorker

func (h *HatcherySwarm) SpawnWorker(model *sdk.Model, req []sdk.Requirement) error

SpawnWorker start a new docker container

func (*HatcherySwarm) WorkerStarted

func (h *HatcherySwarm) WorkerStarted(model *sdk.Model) int

WorkerStarted returns the number of started workers

Jump to

Keyboard shortcuts

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