mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
server: We should fail properly during server startup. (#2689)
Fixes #2688
This commit is contained in:
parent
16e4a7c200
commit
da9ae574df
@ -388,28 +388,30 @@ func serverMain(c *cli.Context) {
|
|||||||
return exitSuccess
|
return exitSuccess
|
||||||
})
|
})
|
||||||
|
|
||||||
// Prints the formatted startup message.
|
|
||||||
printStartupMessage(endPoints)
|
|
||||||
|
|
||||||
// Start server.
|
// Start server.
|
||||||
// Configure TLS if certs are available.
|
// Configure TLS if certs are available.
|
||||||
wait := make(chan struct{}, 1)
|
wait := make(chan struct{}, 1)
|
||||||
go func(tls bool, wait chan<- struct{}) {
|
go func(tls bool, wait chan<- struct{}) {
|
||||||
if tls {
|
fatalIf(func() error {
|
||||||
err = apiServer.ListenAndServeTLS(mustGetCertFile(), mustGetKeyFile())
|
defer func() {
|
||||||
} else {
|
wait <- struct{}{}
|
||||||
// Fallback to http.
|
}()
|
||||||
err = apiServer.ListenAndServe()
|
if tls {
|
||||||
}
|
return apiServer.ListenAndServeTLS(mustGetCertFile(), mustGetKeyFile())
|
||||||
wait <- struct{}{}
|
} // Fallback to http.
|
||||||
|
return apiServer.ListenAndServe()
|
||||||
|
}(), "Failed to start minio server.")
|
||||||
}(tls, wait)
|
}(tls, wait)
|
||||||
|
|
||||||
|
// Wait for formatting of disks.
|
||||||
err = formatDisks(disks, ignoredDisks)
|
err = formatDisks(disks, ignoredDisks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// FIXME: call graceful exit
|
// FIXME: call graceful exit
|
||||||
errorIf(err, "formatting storage disks failed")
|
errorIf(err, "formatting storage disks failed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Once formatted, initialize object layer.
|
||||||
newObject, err := newObjectLayer(disks, ignoredDisks)
|
newObject, err := newObjectLayer(disks, ignoredDisks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// FIXME: call graceful exit
|
// FIXME: call graceful exit
|
||||||
@ -417,12 +419,13 @@ func serverMain(c *cli.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
printEventNotifiers()
|
// Prints the formatted startup message.
|
||||||
|
printStartupMessage(endPoints)
|
||||||
|
|
||||||
objLayerMutex.Lock()
|
objLayerMutex.Lock()
|
||||||
globalObjectAPI = newObject
|
globalObjectAPI = newObject
|
||||||
objLayerMutex.Unlock()
|
objLayerMutex.Unlock()
|
||||||
<-wait
|
|
||||||
|
|
||||||
fatalIf(err, "Failed to start minio server.")
|
// Waits on the server.
|
||||||
|
<-wait
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ func printServerCommonMsg(endPoints []string) {
|
|||||||
console.Println(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKeyID)))
|
console.Println(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKeyID)))
|
||||||
console.Println(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretAccessKey)))
|
console.Println(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretAccessKey)))
|
||||||
console.Println(colorBlue("Region: ") + colorBold(fmt.Sprintf(getFormatStr(len(region), 3), region)))
|
console.Println(colorBlue("Region: ") + colorBold(fmt.Sprintf(getFormatStr(len(region), 3), region)))
|
||||||
|
printEventNotifiers()
|
||||||
|
|
||||||
console.Println(colorBlue("\nBrowser Access:"))
|
console.Println(colorBlue("\nBrowser Access:"))
|
||||||
console.Println(fmt.Sprintf(getFormatStr(len(endPointStr), 3), endPointStr))
|
console.Println(fmt.Sprintf(getFormatStr(len(endPointStr), 3), endPointStr))
|
||||||
@ -71,12 +72,12 @@ func printEventNotifiers() {
|
|||||||
// In case initEventNotifier() was not done or failed.
|
// In case initEventNotifier() was not done or failed.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
arnMsg := colorBlue("\nSQS ARNs: ")
|
arnMsg := colorBlue("SQS ARNs: ")
|
||||||
if len(globalEventNotifier.queueTargets) == 0 {
|
if len(globalEventNotifier.queueTargets) == 0 {
|
||||||
arnMsg += colorBold(fmt.Sprintf(getFormatStr(len("<none>"), 2), "<none>"))
|
arnMsg += colorBold(fmt.Sprintf(getFormatStr(len("<none>"), 1), "<none>"))
|
||||||
}
|
}
|
||||||
for queueArn := range globalEventNotifier.queueTargets {
|
for queueArn := range globalEventNotifier.queueTargets {
|
||||||
arnMsg += colorBold(fmt.Sprintf(getFormatStr(len(queueArn), 2), queueArn))
|
arnMsg += colorBold(fmt.Sprintf(getFormatStr(len(queueArn), 1), queueArn))
|
||||||
}
|
}
|
||||||
console.Println(arnMsg)
|
console.Println(arnMsg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user