-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplatform.go
More file actions
95 lines (67 loc) · 2.5 KB
/
platform.go
File metadata and controls
95 lines (67 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package cmd
import (
"fmt"
"io"
"sync"
"github.com/deis/deis/deisctl/backend"
"github.com/deis/deis/deisctl/config"
"github.com/deis/deis/pkg/prettyprint"
)
// 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
}
// 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
}
// 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
}
// 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
}