[#1436] node: Log service initialization/boot up
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d84d52924a
commit
da3ae202f0
5 changed files with 46 additions and 21 deletions
|
@ -66,32 +66,49 @@ func main() {
|
|||
shutdown(c)
|
||||
}
|
||||
|
||||
func initAndLog(c *cfg, name string, initializer func(*cfg)) {
|
||||
c.log.Info(fmt.Sprintf("initializing %s service...", name))
|
||||
initializer(c)
|
||||
c.log.Info(fmt.Sprintf("%s service has been successfully initialized", name))
|
||||
}
|
||||
|
||||
func initApp(c *cfg) {
|
||||
c.ctx, c.ctxCancel = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
|
||||
initGRPC(c)
|
||||
initAndLog(c, "gRPC", initGRPC)
|
||||
initAndLog(c, "netmap", initNetmapService)
|
||||
initAndLog(c, "accounting", initAccountingService)
|
||||
initAndLog(c, "container", initContainerService)
|
||||
initAndLog(c, "session", initSessionService)
|
||||
initAndLog(c, "reputation", initReputationService)
|
||||
initAndLog(c, "notification", initNotifications)
|
||||
initAndLog(c, "object", initObjectService)
|
||||
initAndLog(c, "profiler", initProfiler)
|
||||
initAndLog(c, "metrics", initMetrics)
|
||||
initAndLog(c, "control", initControlService)
|
||||
|
||||
initNetmapService(c)
|
||||
initAccountingService(c)
|
||||
initContainerService(c)
|
||||
initSessionService(c)
|
||||
initReputationService(c)
|
||||
initNotifications(c)
|
||||
initObjectService(c)
|
||||
initProfiler(c)
|
||||
initMetrics(c)
|
||||
initControlService(c)
|
||||
initAndLog(c, "storage engine", func(c *cfg) {
|
||||
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Open())
|
||||
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init())
|
||||
})
|
||||
|
||||
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Open())
|
||||
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init())
|
||||
initAndLog(c, "morph notifications", listenMorphNotifications)
|
||||
}
|
||||
|
||||
listenMorphNotifications(c)
|
||||
func runAndLog(c *cfg, name string, logSuccess bool, starter func(*cfg)) {
|
||||
c.log.Info(fmt.Sprintf("starting %s service...", name))
|
||||
starter(c)
|
||||
|
||||
if logSuccess {
|
||||
c.log.Info(fmt.Sprintf("%s service started successfully", name))
|
||||
}
|
||||
}
|
||||
|
||||
func bootUp(c *cfg) {
|
||||
connectNats(c)
|
||||
serveGRPC(c)
|
||||
makeAndWaitNotaryDeposit(c)
|
||||
runAndLog(c, "NATS", true, connectNats)
|
||||
runAndLog(c, "gRPC", false, serveGRPC)
|
||||
runAndLog(c, "notary", true, makeAndWaitNotaryDeposit)
|
||||
|
||||
bootstrapNode(c)
|
||||
startWorkers(c)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue