// Install loads the definitions of components from local unit files. // After Install, the components will be available to Start. func Install(targets []string, b backend.Backend, cb config.Backend, checkKeys func(config.Backend) error) error { // if target is platform, install all services if len(targets) == 1 { switch targets[0] { case PlatformCommand: return InstallPlatform(b, cb, checkKeys, false) case StatelessPlatformCommand: return InstallPlatform(b, cb, checkKeys, true) case mesos: return InstallMesos(b) case swarm: return InstallSwarm(b) case k8s: return InstallK8s(b) } } var wg sync.WaitGroup // otherwise create the specific targets b.Create(targets, &wg, Stdout, Stderr) wg.Wait() return nil }
// Install loads the definitions of components from local unit files. // After Install, the components will be available to Start. func Install(targets []string, b backend.Backend, checkKeys func() error) error { // if target is platform, install all services if len(targets) == 1 { if targets[0] == PlatformCommand { return InstallPlatform(b, checkKeys, false) } else if targets[0] == StatelessPlatformCommand { return InstallPlatform(b, checkKeys, true) } else if targets[0] == swarm { return InstallSwarm(b) } } outchan := make(chan string) errchan := make(chan error) var wg sync.WaitGroup go printState(outchan, errchan, 500*time.Millisecond) // otherwise create the specific targets b.Create(targets, &wg, outchan, errchan) wg.Wait() close(outchan) close(errchan) return nil }
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 }
//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 }
//InstallSwarm Installs swarm func InstallSwarm(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("Installing Swarm...") outchan <- fmt.Sprintf("Swarm node and Swarm Manager...") b.Create([]string{"swarm-node", "swarm-manager"}, &wg, outchan, errchan) wg.Wait() fmt.Println("Done.") fmt.Println() fmt.Println("Please run `deisctl start swarm` to start swarm.") return nil }
func installDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan string, errchan chan error) { outchan <- fmt.Sprintf("Storage subsystem...") b.Create([]string{"store-daemon", "store-monitor", "store-metadata", "store-volume", "store-gateway"}, wg, outchan, errchan) wg.Wait() outchan <- fmt.Sprintf("Logging subsystem...") b.Create([]string{"logger", "logspout"}, wg, outchan, errchan) wg.Wait() outchan <- fmt.Sprintf("Control plane...") b.Create([]string{"cache", "database", "registry", "controller", "builder"}, wg, outchan, errchan) wg.Wait() outchan <- fmt.Sprintf("Data plane...") b.Create([]string{"publisher"}, wg, outchan, errchan) wg.Wait() outchan <- fmt.Sprintf("Routing mesh...") b.Create([]string{"router@1", "router@2", "router@3"}, wg, outchan, errchan) wg.Wait() }
// Install loads the definitions of components from local unit files. // After Install, the components will be available to Start. func Install(argv []string, b backend.Backend) error { usage := `Loads the definitions of components from local unit files. After install, the components will be available to start. "deisctl install" looks for unit files in these directories, in this order: - the $DEISCTL_UNITS environment variable, if set - $HOME/.deis/units - /var/lib/deis/units Usage: deisctl install [<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 InstallPlatform(b) } outchan := make(chan string) errchan := make(chan error) var wg sync.WaitGroup go printState(outchan, errchan, 500*time.Millisecond) // otherwise create the specific targets b.Create(targets, &wg, outchan, errchan) wg.Wait() close(outchan) return nil }
func installMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) { fmt.Fprintln(out, "Zookeeper...") b.Create([]string{"zookeeper"}, wg, out, err) wg.Wait() fmt.Fprintln(out, "Mesos Master...") b.Create([]string{"mesos-master"}, wg, out, err) wg.Wait() fmt.Fprintln(out, "Mesos Slave...") b.Create([]string{"mesos-slave"}, wg, out, err) wg.Wait() fmt.Fprintln(out, "Marathon Framework...") b.Create([]string{"mesos-marathon"}, wg, out, err) wg.Wait() }
//InstallK8s Installs K8s func InstallK8s(b backend.Backend) error { var wg sync.WaitGroup io.WriteString(Stdout, prettyprint.DeisIfy("Installing K8s...")) fmt.Fprintln(Stdout, "K8s control plane...") b.Create([]string{"kube-apiserver"}, &wg, Stdout, Stderr) wg.Wait() b.Create([]string{"kube-controller-manager", "kube-scheduler"}, &wg, Stdout, Stderr) wg.Wait() fmt.Fprintln(Stdout, "K8s data plane...") b.Create([]string{"kube-kubelet"}, &wg, Stdout, Stderr) wg.Wait() fmt.Fprintln(Stdout, "K8s router mesh...") b.Create([]string{"kube-proxy"}, &wg, Stdout, Stderr) wg.Wait() fmt.Fprintln(Stdout, "Done.\n ") fmt.Fprintln(Stdout, "Please run `deisctl start k8s` to start K8s.") return nil }
func installMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) { fmt.Fprintln(out, "Mesos/Marathon control plane...") b.Create([]string{"zookeeper", "mesos-master"}, wg, out, err) wg.Wait() b.Create([]string{"mesos-marathon"}, wg, out, err) wg.Wait() fmt.Fprintln(out, "Mesos/Marathon data plane...") b.Create([]string{"mesos-slave"}, wg, out, err) wg.Wait() }
func installDefaultServices(b backend.Backend, stateless bool, wg *sync.WaitGroup, out, err io.Writer) { if !stateless { fmt.Fprintln(out, "Storage subsystem...") b.Create([]string{"store-daemon", "store-monitor", "store-metadata", "store-volume", "store-gateway@1"}, wg, out, err) wg.Wait() } fmt.Fprintln(out, "Logging subsystem...") if stateless { b.Create([]string{"logspout"}, wg, out, err) } else { b.Create([]string{"logger", "logspout"}, wg, out, err) } wg.Wait() fmt.Fprintln(out, "Control plane...") if stateless { b.Create([]string{"registry@1", "controller", "builder"}, wg, out, err) } else { b.Create([]string{"database", "registry@1", "controller", "builder"}, wg, out, err) } wg.Wait() fmt.Fprintln(out, "Data plane...") b.Create([]string{"publisher"}, wg, out, err) wg.Wait() fmt.Fprintln(out, "Routing mesh...") b.Create(getRouters(), wg, out, err) wg.Wait() }