コード例 #1
0
ファイル: platform.go プロジェクト: kuvi-innovations/deis
// InstallPlatform loads all components' definitions from local unit files.
// After InstallPlatform, all components will be available for StartPlatform.
func InstallPlatform(b backend.Backend, cb config.Backend, checkKeys func(config.Backend) error, stateless bool) error {

	if err := checkKeys(cb); err != nil {
		return err
	}

	if stateless {
		fmt.Println("Warning: With a stateless control plane, `deis logs` will be unavailable.")
		fmt.Println("Additionally, components will need to be configured to use external persistent stores.")
		fmt.Println("See the official Deis documentation for details on running a stateless control plane.")
	}

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Installing Deis..."))

	installDefaultServices(b, stateless, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.")
	fmt.Fprintln(Stdout, "")
	if stateless {
		fmt.Fprintln(Stdout, "Please run `deisctl start stateless-platform` to boot up Deis.")
	} else {
		fmt.Fprintln(Stdout, "Please run `deisctl start platform` to boot up Deis.")
	}
	return nil
}
コード例 #2
0
ファイル: platform.go プロジェクト: CodeJuan/deis
// InstallPlatform loads all components' definitions from local unit files.
// After InstallPlatform, all components will be available for StartPlatform.
func InstallPlatform(b backend.Backend, cb config.Backend, checkKeys func(config.Backend) error, stateless bool) error {

	if err := checkKeys(cb); err != nil {
		return err
	}

	if stateless {
		fmt.Println("Warning: With a stateless control plane, some components require manual configuration.")
		fmt.Println("See the official Deis documentation for details on running a stateless control plane.")
		fmt.Println("http://docs.deis.io/en/latest/managing_deis/running-deis-without-ceph/")
	}

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Installing Deis..."))

	installDefaultServices(b, stateless, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.")
	fmt.Fprintln(Stdout, "")
	if stateless {
		fmt.Fprintln(Stdout, "Please run `deisctl start stateless-platform` to boot up Deis.")
	} else {
		fmt.Fprintln(Stdout, "Please run `deisctl start platform` to boot up Deis.")
	}
	return nil
}
コード例 #3
0
ファイル: swarm.go プロジェクト: Kazanz/deis
//UnInstallSwarm uninstall Swarm
func UnInstallSwarm(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Destroying Swarm..."))
	fmt.Fprintln(Stdout, "swarm nodes and swarm manager...")
	b.Destroy([]string{"swarm-node", "swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	return nil
}
コード例 #4
0
ファイル: swarm.go プロジェクト: Kazanz/deis
//InstallSwarm Installs swarm
func InstallSwarm(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Installing Swarm..."))
	fmt.Fprintln(Stdout, "Swarm node and Swarm Manager...")
	b.Create([]string{"swarm-node", "swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please run `deisctl start swarm` to start swarm.")
	return nil
}
コード例 #5
0
ファイル: swarm.go プロジェクト: ngpestelos/deis
//UnInstallSwarm uninstall Swarm
func UnInstallSwarm(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Uninstalling Swarm..."))
	fmt.Fprintln(Stdout, "Swarm data plane...")
	b.Destroy([]string{"swarm-node"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Swarm control plane...")
	b.Destroy([]string{"swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	return nil
}
コード例 #6
0
ファイル: swarm.go プロジェクト: ngpestelos/deis
//StartSwarm starts Swarm Schduler
func StartSwarm(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Starting Swarm..."))
	fmt.Fprintln(Stdout, "Swarm control plane...")
	b.Start([]string{"swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Swarm data plane...")
	b.Start([]string{"swarm-node"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please run `deisctl config controller set schedulerModule=swarm` to use the swarm scheduler.")
	return nil
}
コード例 #7
0
ファイル: platform.go プロジェクト: kuvi-innovations/deis
// UninstallPlatform unloads all components' definitions.
// After UninstallPlatform, all components will be unavailable.
func UninstallPlatform(b backend.Backend, stateless bool) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Uninstalling Deis..."))

	uninstallAllServices(b, stateless, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.")
	return nil
}
コード例 #8
0
ファイル: mesos.go プロジェクト: uniite/deis
// UninstallMesos unloads and uninstalls all Mesos component definitions
func UninstallMesos(b backend.Backend) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Uninstalling Mesos..."))

	uninstallMesosServices(b, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.")
	return nil
}
コード例 #9
0
ファイル: platform.go プロジェクト: kuvi-innovations/deis
// StartPlatform activates all components.
func StartPlatform(b backend.Backend, stateless bool) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Starting Deis..."))

	startDefaultServices(b, stateless, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please use `deis register` to setup an administrator account.")
	return nil
}
コード例 #10
0
ファイル: mesos.go プロジェクト: ngpestelos/deis
// StartMesos activates all Mesos components.
func StartMesos(b backend.Backend) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Starting Mesos/Marathon..."))

	startMesosServices(b, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please use `deisctl config controller set schedulerModule=mesos_marathon`")
	return nil
}
コード例 #11
0
ファイル: mesos.go プロジェクト: ngpestelos/deis
// InstallMesos loads all Mesos units for StartMesos
func InstallMesos(b backend.Backend) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Installing Mesos/Marathon..."))

	installMesosServices(b, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please run `deisctl start mesos` to boot up Mesos.")
	return nil
}
コード例 #12
0
ファイル: mesos.go プロジェクト: uniite/deis
// StopMesos deactivates all Mesos components.
func StopMesos(b backend.Backend) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Stopping Mesos..."))

	stopMesosServices(b, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.")
	fmt.Fprintln(Stdout, "")
	fmt.Fprintln(Stdout, "Please run `deisctl start mesos` to restart Mesos.")
	return nil
}
コード例 #13
0
ファイル: k8s.go プロジェクト: ngpestelos/deis
//UnInstallK8s uninstall K8s
func UnInstallK8s(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Uninstalling K8s..."))
	fmt.Fprintln(Stdout, "K8s router mesh...")
	b.Destroy([]string{"kube-proxy"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "K8s data plane...")
	b.Destroy([]string{"kube-kubelet"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "K8s control plane...")
	b.Destroy([]string{"kube-controller-manager", "kube-scheduler"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Destroy([]string{"kube-apiserver"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	return nil
}
コード例 #14
0
ファイル: platform.go プロジェクト: kuvi-innovations/deis
// StopPlatform deactivates all components.
func StopPlatform(b backend.Backend, stateless bool) error {

	var wg sync.WaitGroup

	io.WriteString(Stdout, prettyprint.DeisIfy("Stopping Deis..."))

	stopDefaultServices(b, stateless, &wg, Stdout, Stderr)

	wg.Wait()

	fmt.Fprintln(Stdout, "Done.\n ")
	if stateless {
		fmt.Fprintln(Stdout, "Please run `deisctl start stateless-platform` to restart Deis.")
	} else {
		fmt.Fprintln(Stdout, "Please run `deisctl start platform` to restart Deis.")
	}
	return nil
}
コード例 #15
0
ファイル: k8s.go プロジェクト: ngpestelos/deis
//StartK8s starts K8s Schduler
func StartK8s(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Starting K8s..."))
	fmt.Fprintln(Stdout, "K8s control plane...")
	b.Start([]string{"kube-apiserver"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Start([]string{"kube-controller-manager", "kube-scheduler"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "K8s data plane...")
	b.Start([]string{"kube-kubelet"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "K8s router mesh...")
	b.Start([]string{"kube-proxy"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please run `deisctl config controller set schedulerModule=k8s` to use the K8s scheduler.")
	return nil
}
コード例 #16
0
ファイル: deisctl.go プロジェクト: laurrentt/deis
// Command executes the given deisctl command line.
func Command(argv []string) int {
	deisctlMotd := prettyprint.DeisIfy("Deis Control Utility")
	usage := deisctlMotd + `
Usage: deisctl [options] <command> [<args>...]

Commands, use "deisctl help <command>" to learn more:
  install           install components, or the entire platform
  uninstall         uninstall components
  list              list installed components
  start             start components
  stop              stop components
  restart           stop, then start components
  scale             grow or shrink the number of routers, registries or store gateways
  journal           print the log output of a component
  config            set platform or component values
  refresh-units     refresh unit files from GitHub
  ssh               open an interactive shell on a machine in the cluster
  dock              open an interactive shell on a container in the cluster
  help              show the help screen for a command
  upgrade-prep      prepare a running cluster for upgrade
  upgrade-takeover  allow an upgrade to gracefully takeover a running cluster
  rolling-restart   perform a rolling restart of a Deis component (currently only router is supported)

Options:
  -h --help                   show this help screen
  --endpoint=<url>            etcd endpoint for fleet [default: http://127.0.0.1:4001]
  --etcd-cafile=<path>        etcd CA file authentication [default: ]
  --etcd-certfile=<path>      etcd cert file authentication [default: ]
  --etcd-key-prefix=<path>    keyspace for fleet data in etcd [default: /_coreos.com/fleet/]
  --etcd-keyfile=<path>       etcd key file authentication [default: ]
  --known-hosts-file=<path>   where to store remote fingerprints [default: ~/.ssh/known_hosts]
  --request-timeout=<secs>    seconds before a request is considered failed [default: 10.0]
  --ssh-timeout=<secs>        seconds before SSH connection is considered failed [default: 10.0]
  --strict-host-key-checking  verify SSH host keys [default: true]
  --tunnel=<host>             SSH tunnel for communication with fleet and etcd [default: ]
  --version                   print the version of deisctl
`
	// pre-parse command-line arguments
	argv, helpFlag := parseArgs(argv)
	// give docopt an optional final false arg so it doesn't call os.Exit()
	args, err := docopt.Parse(usage, argv, false, version.Version, true, false)

	if err != nil && err.Error() != "" {
		fmt.Println(err)
		return 1
	}

	if len(args) == 0 {
		return 0
	}

	command := args["<command>"]
	setTunnel := true
	// "--help" and "refresh-units" doesn't need SSH tunneling
	if helpFlag || command == "refresh-units" {
		setTunnel = false
	}
	setGlobalFlags(args, setTunnel)
	// clean up the args so subcommands don't need to reparse them
	argv = removeGlobalArgs(argv)
	// construct a client
	c, err := client.NewClient("fleet")
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return 1
	}
	// Dispatch the command, passing the argv through so subcommands can
	// re-parse it according to their usage strings.
	switch command {
	case "list":
		err = c.List(argv)
	case "scale":
		err = c.Scale(argv)
	case "start":
		err = c.Start(argv)
	case "restart":
		err = c.Restart(argv)
	case "stop":
		err = c.Stop(argv)
	case "status":
		err = c.Status(argv)
	case "journal":
		err = c.Journal(argv)
	case "install":
		err = c.Install(argv)
	case "uninstall":
		err = c.Uninstall(argv)
	case "config":
		err = c.Config(argv)
	case "refresh-units":
		err = c.RefreshUnits(argv)
	case "ssh":
		err = c.SSH(argv)
	case "dock":
		err = c.Dock(argv)
	case "upgrade-prep":
		err = c.UpgradePrep(argv)
	case "upgrade-takeover":
		err = c.UpgradeTakeover(argv)
	case "rolling-restart":
		err = c.RollingRestart(argv)
	case "help":
		fmt.Print(usage)
		return 0
	default:
		fmt.Println(`Found no matching command, try "deisctl help"
Usage: deisctl <command> [<args>...] [options]`)
		return 1
	}
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return 1
	}
	return 0
}