當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Backend.Start方法代碼示例

本文整理匯總了Golang中github.com/deis/deis/deisctl/backend.Backend.Start方法的典型用法代碼示例。如果您正苦於以下問題:Golang Backend.Start方法的具體用法?Golang Backend.Start怎麽用?Golang Backend.Start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/deis/deis/deisctl/backend.Backend的用法示例。


在下文中一共展示了Backend.Start方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Start

// Start activates the specified components.
func Start(argv []string, b backend.Backend) error {
	usage := `Activates the specified components.

Usage:
  deisctl start [<target>...] [options]
`
	// parse command-line arguments
	args, err := docopt.Parse(usage, argv, true, "", false)
	if err != nil {
		return err
	}

	// if target is platform, install all services
	targets := args["<target>"].([]string)

	if len(targets) == 1 && targets[0] == PlatformCommand {
		return StartPlatform(b)
	}

	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	b.Start(targets, &wg, outchan, errchan)
	wg.Wait()
	close(outchan)

	return nil
}
開發者ID:pombredanne,項目名稱:deo,代碼行數:32,代碼來源:cmd.go

示例2: Start

// Start activates the specified components.
func Start(targets []string, b backend.Backend) error {

	// if target is platform, install all services
	if len(targets) == 1 {
		if targets[0] == PlatformCommand {
			return StartPlatform(b, false)
		} else if targets[0] == StatelessPlatformCommand {
			return StartPlatform(b, true)
		} else if targets[0] == swarm {
			return StartSwarm(b)
		}
	}
	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	b.Start(targets, &wg, outchan, errchan)
	wg.Wait()
	close(outchan)
	close(errchan)

	return nil
}
開發者ID:bladealslayer,項目名稱:deis,代碼行數:26,代碼來源:cmd.go

示例3: doUpgradeTakeOver

func doUpgradeTakeOver(stateless bool, b backend.Backend, cb config.Backend) error {
	var wg sync.WaitGroup

	nodes, err := listPublishedServices(cb)
	if err != nil {
		return err
	}

	b.Stop([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Destroy([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()

	if err := republishServices(1800, nodes, cb); err != nil {
		return err
	}

	b.RollingRestart("router", &wg, Stdout, Stderr)
	wg.Wait()
	b.Create([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Start([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()

	installUpgradeServices(b, stateless, &wg, Stdout, Stderr)
	wg.Wait()

	startUpgradeServices(b, stateless, &wg, Stdout, Stderr)
	wg.Wait()
	return nil
}
開發者ID:CodeJuan,項目名稱:deis,代碼行數:31,代碼來源:upgrade.go

示例4: StartSwarm

//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
}
開發者ID:ngpestelos,項目名稱:deis,代碼行數:14,代碼來源:swarm.go

示例5: StartSwarm

//StartSwarm starts Swarm Schduler
func StartSwarm(b backend.Backend) error {
	outchan := make(chan string)
	errchan := make(chan error)
	defer close(outchan)
	defer close(errchan)
	var wg sync.WaitGroup
	go printState(outchan, errchan, 500*time.Millisecond)
	outchan <- utils.DeisIfy("Starting Swarm...")
	outchan <- fmt.Sprintf("swarm nodes...")
	b.Start([]string{"swarm-node"}, &wg, outchan, errchan)
	wg.Wait()
	outchan <- fmt.Sprintf("swarm manager...")
	b.Start([]string{"swarm-manager"}, &wg, outchan, errchan)
	wg.Wait()
	fmt.Println("Done.")
	fmt.Println("Please run `deisctl config controller set schedulerModule=swarm` to use the swarm scheduler.")
	return nil
}
開發者ID:gpxl,項目名稱:deis,代碼行數:19,代碼來源:swarm.go

示例6: Start

// Start activates the specified components.
func Start(targets []string, b backend.Backend) error {

	// if target is platform, install all services
	if len(targets) == 1 {
		switch targets[0] {
		case PlatformCommand:
			return StartPlatform(b, false)
		case StatelessPlatformCommand:
			return StartPlatform(b, true)
		}
	}
	var wg sync.WaitGroup

	b.Start(targets, &wg, Stdout, Stderr)
	wg.Wait()

	return nil
}
開發者ID:CloudSide,項目名稱:deis,代碼行數:19,代碼來源:cmd.go

示例7: startMesosServices

func startMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) {

	fmt.Fprintln(out, "Mesos/Marathon control plane...")
	b.Start([]string{"zookeeper"}, wg, out, err)
	wg.Wait()
	b.Start([]string{"mesos-master"}, wg, out, err)
	wg.Wait()
	b.Start([]string{"mesos-marathon"}, wg, out, err)
	wg.Wait()

	fmt.Fprintln(out, "Mesos/Marathon data plane...")
	b.Start([]string{"mesos-slave"}, wg, out, err)
	wg.Wait()

	wg.Wait()
}
開發者ID:ngpestelos,項目名稱:deis,代碼行數:16,代碼來源:mesos.go

示例8: startMesosServices

func startMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) {

	fmt.Fprintln(out, "Zookeeper...")
	b.Start([]string{"zookeeper"}, wg, out, err)
	wg.Wait()

	fmt.Fprintln(out, "Mesos Master...")
	b.Start([]string{"mesos-master"}, wg, out, err)
	wg.Wait()

	fmt.Fprintln(out, "Mesos Slave...")
	b.Start([]string{"mesos-slave"}, wg, out, err)
	wg.Wait()

	fmt.Fprintln(out, "Marathon Framework...")
	b.Start([]string{"mesos-marathon"}, wg, out, err)
	wg.Wait()
}
開發者ID:uniite,項目名稱:deis,代碼行數:18,代碼來源:mesos.go

示例9: StartK8s

//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
}
開發者ID:ngpestelos,項目名稱:deis,代碼行數:19,代碼來源:k8s.go

示例10: startDefaultServices

func startDefaultServices(b backend.Backend, stateless bool, wg *sync.WaitGroup, out, err io.Writer) {

	// Wait for groups to come up.
	// If we're running in stateless mode, we start only a subset of services.
	if !stateless {
		fmt.Fprintln(out, "Storage subsystem...")
		b.Start([]string{"store-monitor"}, wg, out, err)
		wg.Wait()
		b.Start([]string{"store-daemon"}, wg, out, err)
		wg.Wait()
		b.Start([]string{"store-metadata"}, wg, out, err)
		wg.Wait()

		// we start gateway first to give metadata time to come up for volume
		b.Start([]string{"[email protected]*"}, wg, out, err)
		wg.Wait()
		b.Start([]string{"store-volume"}, wg, out, err)
		wg.Wait()
	}

	// start logging subsystem first to collect logs from other components
	fmt.Fprintln(out, "Logging subsystem...")
	if !stateless {
		b.Start([]string{"logger"}, wg, out, err)
		wg.Wait()
	}
	b.Start([]string{"logspout"}, wg, out, err)
	wg.Wait()

	// Start these in parallel. This section can probably be removed now.
	var bgwg sync.WaitGroup
	var trash bytes.Buffer
	batch := []string{
		"database", "[email protected]*", "controller", "builder",
		"publisher", "[email protected]*",
	}
	if stateless {
		batch = []string{"[email protected]*", "controller", "builder", "publisher", "[email protected]*"}
	}
	b.Start(batch, &bgwg, &trash, &trash)
	// End background stuff.

	fmt.Fprintln(Stdout, "Control plane...")
	batch = []string{"database", "[email protected]*", "controller"}
	if stateless {
		batch = []string{"[email protected]*", "controller"}
	}
	b.Start(batch, wg, out, err)
	wg.Wait()

	b.Start([]string{"builder"}, wg, out, err)
	wg.Wait()

	fmt.Fprintln(out, "Data plane...")
	b.Start([]string{"publisher"}, wg, out, err)
	wg.Wait()

	fmt.Fprintln(out, "Routing mesh...")
	b.Start([]string{"[email protected]*"}, wg, out, err)
	wg.Wait()
}
開發者ID:uniite,項目名稱:deis,代碼行數:61,代碼來源:cmd.go

示例11: startDefaultServices

func startDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan string, errchan chan error) {

	// create separate channels for background tasks
	_outchan := make(chan string)
	_errchan := make(chan error)
	var _wg sync.WaitGroup

	// wait for groups to come up
	outchan <- fmt.Sprintf("Storage subsystem...")
	b.Start([]string{"store-monitor"}, wg, outchan, errchan)
	wg.Wait()
	b.Start([]string{"store-daemon"}, wg, outchan, errchan)
	wg.Wait()
	b.Start([]string{"store-metadata"}, wg, outchan, errchan)
	wg.Wait()

	// we start gateway first to give metadata time to come up for volume
	b.Start([]string{"store-gateway"}, wg, outchan, errchan)
	wg.Wait()
	b.Start([]string{"store-volume"}, wg, outchan, errchan)
	wg.Wait()

	// start logging subsystem first to collect logs from other components
	outchan <- fmt.Sprintf("Logging subsystem...")
	b.Start([]string{"logger"}, wg, outchan, errchan)
	wg.Wait()
	b.Start([]string{"logspout"}, wg, outchan, errchan)
	wg.Wait()

	// optimization: start all remaining services in the background
	b.Start([]string{
		"cache", "database", "registry", "controller", "builder",
		"publisher", "[email protected]", "[email protected]", "[email protected]"},
		&_wg, _outchan, _errchan)

	outchan <- fmt.Sprintf("Control plane...")
	b.Start([]string{"cache", "database", "registry", "controller"}, wg, outchan, errchan)
	wg.Wait()
	b.Start([]string{"builder"}, wg, outchan, errchan)
	wg.Wait()

	outchan <- fmt.Sprintf("Data plane...")
	b.Start([]string{"publisher"}, wg, outchan, errchan)
	wg.Wait()

	outchan <- fmt.Sprintf("Routing mesh...")
	b.Start([]string{"[email protected]", "[email protected]", "[email protected]"}, wg, outchan, errchan)
	wg.Wait()
}
開發者ID:pombredanne,項目名稱:deo,代碼行數:49,代碼來源:cmd.go


注:本文中的github.com/deis/deis/deisctl/backend.Backend.Start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。