Esempio n. 1
0
// Stop deactivates the specified components.
func Stop(targets []string, b backend.Backend) error {

	// if target is platform, stop all services
	if len(targets) == 1 {
		if targets[0] == PlatformCommand {
			return StopPlatform(b, false)
		} else if targets[0] == StatelessPlatformCommand {
			return StopPlatform(b, true)
		} else if targets[0] == swarm {
			return StopSwarm(b)
		}
	}

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

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

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

	return nil
}
Esempio n. 2
0
File: cmd.go Progetto: uniite/deis
// Stop deactivates the specified components.
func Stop(targets []string, b backend.Backend) error {

	// if target is platform, stop all services
	if len(targets) == 1 {
		switch targets[0] {
		case PlatformCommand:
			return StopPlatform(b, false)
		case StatelessPlatformCommand:
			return StopPlatform(b, true)
		case mesos:
			return StopMesos(b)
		case swarm:
			return StopSwarm(b)
		case k8s:
			return StopK8s(b)
		}
	}

	var wg sync.WaitGroup

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

	return nil
}
Esempio n. 3
0
// Stop deactivates the specified components.
func Stop(argv []string, b backend.Backend) error {
	usage := `Deactivates the specified components.

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

	// if target is platform, stop all services
	if len(targets) == 1 && targets[0] == PlatformCommand {
		return StopPlatform(b)
	}

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

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

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

	return nil
}
Esempio n. 4
0
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
}
Esempio n. 5
0
// UpgradePrep stops and uninstalls all components except router and publisher
func UpgradePrep(stateless bool, b backend.Backend) error {
	var wg sync.WaitGroup

	b.Stop([]string{"database", "registry@*", "controller", "builder", "logger", "logspout"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Destroy([]string{"database", "registry@*", "controller", "builder", "logger", "logspout"}, &wg, Stdout, Stderr)
	wg.Wait()

	if !stateless {
		b.Stop([]string{"store-volume", "store-gateway@*"}, &wg, Stdout, Stderr)
		wg.Wait()
		b.Destroy([]string{"store-volume", "store-gateway@*"}, &wg, Stdout, Stderr)
		wg.Wait()

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

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

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

	fmt.Fprintln(Stdout, "The platform has been stopped, but applications are still serving traffic as normal.")
	fmt.Fprintln(Stdout, "Your cluster is now ready for upgrade. Install a new deisctl version and run `deisctl upgrade-takeover`.")
	fmt.Fprintln(Stdout, "For more details, see: http://docs.deis.io/en/latest/managing_deis/upgrading-deis/#graceful-upgrade")
	return nil
}
Esempio n. 6
0
File: swarm.go Progetto: Kazanz/deis
//StopSwarm stops swarm
func StopSwarm(b backend.Backend) error {

	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Stopping Swarm..."))
	fmt.Fprintln(Stdout, "swarm nodes and swarm manager")
	b.Stop([]string{"swarm-node", "swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()

	fmt.Fprintln(Stdout, "Done.\n ")
	return nil
}
Esempio n. 7
0
File: swarm.go Progetto: gpxl/deis
//StopSwarm stops swarm
func StopSwarm(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("Stopping Swarm...")
	outchan <- fmt.Sprintf("swarm nodes and swarm manager")
	b.Stop([]string{"swarm-node", "swarm-manager"}, &wg, outchan, errchan)
	wg.Wait()

	fmt.Println("Done.")
	fmt.Println()
	return nil
}
Esempio n. 8
0
func stopMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) {

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

	fmt.Fprintln(out, "Mesos/Marathon control plane...")
	b.Stop([]string{"mesos-marathon"}, wg, out, err)
	wg.Wait()
	b.Stop([]string{"mesos-master"}, wg, out, err)
	wg.Wait()
	b.Stop([]string{"zookeeper"}, wg, out, err)
	wg.Wait()
}
Esempio n. 9
0
//StopK8s stops K8s
func StopK8s(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Stopping K8s..."))
	fmt.Fprintln(Stdout, "K8s router mesh...")
	b.Stop([]string{"kube-proxy"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "K8s data plane...")
	b.Stop([]string{"kube-kubelet"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "K8s control plane...")
	b.Stop([]string{"kube-controller-manager", "kube-scheduler"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Stop([]string{"kube-apiserver"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	return nil
}
Esempio n. 10
0
File: mesos.go Progetto: uniite/deis
func stopMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) {

	fmt.Fprintln(out, "Marathon Framework...")
	b.Stop([]string{"mesos-marathon"}, wg, out, err)
	wg.Wait()

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

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

	fmt.Fprintln(out, "Zookeeper...")
	b.Stop([]string{"zookeeper"}, wg, out, err)
	wg.Wait()
}
Esempio n. 11
0
File: cmd.go Progetto: uniite/deis
func stopDefaultServices(b backend.Backend, stateless bool, wg *sync.WaitGroup, out, err io.Writer) {

	fmt.Fprintln(out, "Routing mesh...")
	b.Stop([]string{"router@*"}, wg, out, err)
	wg.Wait()

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

	fmt.Fprintln(out, "Control plane...")
	if stateless {
		b.Stop([]string{"controller", "builder", "registry@*"}, wg, out, err)
	} else {
		b.Stop([]string{"controller", "builder", "database", "registry@*"}, wg, out, err)
	}
	wg.Wait()

	fmt.Fprintln(out, "Logging subsystem...")
	if stateless {
		b.Stop([]string{"logspout"}, wg, out, err)
	} else {
		b.Stop([]string{"logger", "logspout"}, wg, out, err)
	}
	wg.Wait()

	if !stateless {
		fmt.Fprintln(out, "Storage subsystem...")
		b.Stop([]string{"store-volume", "store-gateway@*"}, wg, out, err)
		wg.Wait()
		b.Stop([]string{"store-metadata"}, wg, out, err)
		wg.Wait()
		b.Stop([]string{"store-daemon"}, wg, out, err)
		wg.Wait()
		b.Stop([]string{"store-monitor"}, wg, out, err)
		wg.Wait()
	}

}
Esempio n. 12
0
func stopDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan string, errchan chan error) {

	outchan <- fmt.Sprintf("Routing mesh...")
	b.Stop([]string{"router@1", "router@2", "router@3"}, wg, outchan, errchan)
	wg.Wait()

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

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

	outchan <- fmt.Sprintf("Logging subsystem...")
	b.Stop([]string{"logger", "logspout"}, wg, outchan, errchan)
	wg.Wait()

	outchan <- fmt.Sprintf("Storage subsystem...")
	b.Stop([]string{"store-volume", "store-gateway"}, wg, outchan, errchan)
	wg.Wait()
	b.Stop([]string{"store-metadata"}, wg, outchan, errchan)
	wg.Wait()
	b.Stop([]string{"store-daemon"}, wg, outchan, errchan)
	wg.Wait()
	b.Stop([]string{"store-monitor"}, wg, outchan, errchan)
	wg.Wait()
}