Skip to content

Commit e4492f1

Browse files
Gabriel Monroycarmstrong
authored andcommitted
fix(deisctl): adjust start order for logger/store
1 parent 0cfe49a commit e4492f1

1 file changed

Lines changed: 26 additions & 23 deletions

File tree

deisctl/cmd/cmd.go

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,6 @@ func startDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan st
122122
_errchan := make(chan error)
123123
var _wg sync.WaitGroup
124124

125-
outchan <- fmt.Sprintf("Logging subsystem...")
126-
b.Start([]string{"logger"}, wg, outchan, errchan)
127-
wg.Wait()
128-
b.Start([]string{"logspout"}, wg, outchan, errchan)
129-
wg.Wait()
130-
131-
// start all services in the background
132-
b.Start([]string{"cache", "database", "registry", "controller", "builder",
133-
"publisher", "router@1", "router@2", "router@3"}, &_wg, _outchan, _errchan)
134-
135125
// wait for groups to come up
136126
outchan <- fmt.Sprintf("Storage subsystem...")
137127
b.Start([]string{"store-monitor"}, wg, outchan, errchan)
@@ -144,15 +134,27 @@ func startDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan st
144134
b.Start([]string{"store-volume", "store-gateway"}, wg, outchan, errchan)
145135
wg.Wait()
146136

137+
// start logging subsystem first to collect logs from other components
138+
outchan <- fmt.Sprintf("Logging subsystem...")
139+
b.Start([]string{"logger"}, wg, outchan, errchan)
140+
wg.Wait()
141+
b.Start([]string{"logspout"}, wg, outchan, errchan)
142+
wg.Wait()
143+
144+
// optimization: start all remaining services in the background
145+
b.Start([]string{
146+
"cache", "database", "registry", "controller", "builder",
147+
"publisher", "router@1", "router@2", "router@3"},
148+
&_wg, _outchan, _errchan)
149+
147150
outchan <- fmt.Sprintf("Control plane...")
148151
b.Start([]string{"cache", "database", "registry", "controller"}, wg, outchan, errchan)
149152
wg.Wait()
150-
151153
b.Start([]string{"builder"}, wg, outchan, errchan)
152154
wg.Wait()
153155

154156
outchan <- fmt.Sprintf("Data plane...")
155-
b.Start([]string{"publisher"}, wg, outchan, errchan)
157+
b.Start([]string{"logspout", "publisher"}, wg, outchan, errchan)
156158
wg.Wait()
157159

158160
outchan <- fmt.Sprintf("Routing mesh...")
@@ -214,13 +216,14 @@ func stopDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan str
214216
b.Stop([]string{"controller", "builder", "cache", "database", "registry"}, wg, outchan, errchan)
215217
wg.Wait()
216218

219+
outchan <- fmt.Sprintf("Logging subsystem...")
220+
b.Stop([]string{"logger", "logspout"}, wg, outchan, errchan)
221+
wg.Wait()
222+
217223
outchan <- fmt.Sprintf("Storage subsystem...")
218224
b.Stop([]string{"store-gateway", "store-volume", "store-metadata", "store-monitor", "store-daemon"}, wg, outchan, errchan)
219225
wg.Wait()
220226

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

226229
func Restart(b backend.Backend, targets []string) error {
@@ -296,14 +299,14 @@ func InstallPlatform(b backend.Backend) error {
296299

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

299-
outchan <- fmt.Sprintf("Logging subsystem...")
300-
b.Create([]string{"logger", "logspout"}, wg, outchan, errchan)
301-
wg.Wait()
302-
303302
outchan <- fmt.Sprintf("Storage subsystem...")
304303
b.Create([]string{"store-daemon", "store-monitor", "store-metadata", "store-volume", "store-gateway"}, wg, outchan, errchan)
305304
wg.Wait()
306305

306+
outchan <- fmt.Sprintf("Logging subsystem...")
307+
b.Create([]string{"logger", "logspout"}, wg, outchan, errchan)
308+
wg.Wait()
309+
307310
outchan <- fmt.Sprintf("Control plane...")
308311
b.Create([]string{"cache", "database", "registry", "controller", "builder"}, wg, outchan, errchan)
309312
wg.Wait()
@@ -371,14 +374,14 @@ func uninstallAllServices(b backend.Backend, wg *sync.WaitGroup, outchan chan st
371374
b.Destroy([]string{"controller", "builder", "cache", "database", "registry"}, wg, outchan, errchan)
372375
wg.Wait()
373376

374-
outchan <- fmt.Sprintf("Storage subsystem...")
375-
b.Destroy([]string{"store-gateway", "store-volume", "store-metadata", "store-monitor", "store-daemon"}, wg, outchan, errchan)
376-
wg.Wait()
377-
378377
outchan <- fmt.Sprintf("Logging subsystem...")
379378
b.Destroy([]string{"logger", "logspout"}, wg, outchan, errchan)
380379
wg.Wait()
381380

381+
outchan <- fmt.Sprintf("Storage subsystem...")
382+
b.Destroy([]string{"store-gateway", "store-volume", "store-metadata", "store-monitor", "store-daemon"}, wg, outchan, errchan)
383+
wg.Wait()
384+
382385
return nil
383386
}
384387

0 commit comments

Comments
 (0)