diff --git a/ocis-pkg/runner/factory.go b/ocis-pkg/runner/factory.go index 2024c40ea1b..ccdebfd0691 100644 --- a/ocis-pkg/runner/factory.go +++ b/ocis-pkg/runner/factory.go @@ -101,7 +101,7 @@ func NewGolangHttpServerRunner(name string, server *http.Server, opts ...Option) }, func() { // Since Shutdown might take some time, don't block go func() { - // TODO: Provide the adjustable TimeoutDuration + // Use the DefaultInterruptDuration or InterruptDuration as the shutdown timeout. shutdownCtx, cancel := context.WithTimeout(context.Background(), DefaultInterruptDuration) defer cancel() diff --git a/ocis-pkg/runner/grouprunner.go b/ocis-pkg/runner/grouprunner.go index e44f72d4c7b..4c4574b9315 100644 --- a/ocis-pkg/runner/grouprunner.go +++ b/ocis-pkg/runner/grouprunner.go @@ -21,7 +21,7 @@ import ( // // The interrupt duration for the group can be set through the // `WithInterruptDuration` option. If the option isn't supplied, the default -// value (15 secs) will be used. +// value `DefaultGroupInterruptDuration` will be used. // // It's recommended that the timeouts are handled by each runner individually, // meaning that each runner's timeout should be less than the group runner's diff --git a/ocis-pkg/runner/runner.go b/ocis-pkg/runner/runner.go index 6733a745f11..7e169d8e39e 100644 --- a/ocis-pkg/runner/runner.go +++ b/ocis-pkg/runner/runner.go @@ -32,7 +32,7 @@ type Runner struct { // // The interrupt duration, which can be set through the `WithInterruptDuration` // option, will be used to ensure the runner doesn't block forever. If the -// option isn't supplied, the default value (10 secs) will be used. +// option isn't supplied, the default value `DefaultInterruptDuration` will be used. // The interrupt duration will be used to start a timeout when the // runner gets interrupted (either the context of the `Run` method is done // or this runner's `Interrupt` method is called). If the timeout is reached, diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index 7ef9c3a1e46..6f1784eb4b9 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -75,6 +75,11 @@ var ( // wait funcs run after the service group has been started. _waitFuncs = []func(*ociscfg.Config) error{pingNats, pingGateway, nil, wait(time.Second), nil} + + // Use the runner.DefaultInterruptDuration as defaults for the individual service shutdown timeouts. + _defaultShutdownTimeoutDuration = runner.DefaultInterruptDuration + // Use the runner.DefaultGroupInterruptDuration as defaults for the server interruption timeout. + _defaultInterruptTimeoutDuration = runner.DefaultGroupInterruptDuration ) type serviceFuncMap map[string]func(*ociscfg.Config) suture.Service @@ -515,7 +520,7 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) { wg.Add(1) go func() { defer wg.Done() - ctx, cancel := context.WithTimeout(context.Background(), runner.DefaultInterruptDuration) + ctx, cancel := context.WithTimeout(context.Background(), _defaultShutdownTimeoutDuration) defer cancel() if err := srv.Shutdown(ctx); err != nil { s.Log.Error().Err(err).Msg("could not shutdown tcp listener") @@ -530,7 +535,7 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) { go func() { s.Log.Warn().Msgf("call supervisor RemoveAndWait for %s", sName) defer wg.Done() - if err := s.Supervisor.RemoveAndWait(s.serviceToken[sName][i], runner.DefaultInterruptDuration); err != nil && !errors.Is(err, suture.ErrSupervisorNotRunning) { + if err := s.Supervisor.RemoveAndWait(s.serviceToken[sName][i], _defaultShutdownTimeoutDuration); err != nil && !errors.Is(err, suture.ErrSupervisorNotRunning) { s.Log.Error().Err(err).Str("service", sName).Msgf("terminating with signal: %+v", s) } s.Log.Warn().Msgf("done supervisor RemoveAndWait for %s", sName) @@ -545,7 +550,7 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) { }() select { - case <-time.After(runner.DefaultGroupInterruptDuration): + case <-time.After(_defaultInterruptTimeoutDuration): s.Log.Fatal().Msg("ocis graceful shutdown timeout reached, terminating") case <-done: s.Log.Info().Msg("all ocis services gracefully stopped") diff --git a/services/antivirus/pkg/command/server.go b/services/antivirus/pkg/command/server.go index 762d82d4d8c..9d59d400526 100644 --- a/services/antivirus/pkg/command/server.go +++ b/services/antivirus/pkg/command/server.go @@ -47,14 +47,14 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr := runner.NewGroup() + gr := runner.NewGroup(runner.Option()) { svc, err := service.NewAntivirus(cfg, logger, traceProvider) if err != nil { return err } - gr.Add(runner.New("antivirus_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return svc.Run() }, func() { svc.Close() @@ -72,7 +72,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("antivirus_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/app-provider/pkg/command/server.go b/services/app-provider/pkg/command/server.go index 7ddb9bde8ca..56bfd37ba51 100644 --- a/services/app-provider/pkg/command/server.go +++ b/services/app-provider/pkg/command/server.go @@ -75,7 +75,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("app-provider_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/app-registry/pkg/command/server.go b/services/app-registry/pkg/command/server.go index 9aa3b8e0a81..f50567f5780 100644 --- a/services/app-registry/pkg/command/server.go +++ b/services/app-registry/pkg/command/server.go @@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("app-registry_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/audit/pkg/command/server.go b/services/audit/pkg/command/server.go index 0765e78d4b2..1694d23cc62 100644 --- a/services/audit/pkg/command/server.go +++ b/services/audit/pkg/command/server.go @@ -55,7 +55,7 @@ func Server(cfg *config.Config) *cli.Command { svcCtx, svcCancel := context.WithCancel(ctx) defer svcCancel() - gr.Add(runner.New("audit_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { svc.AuditLoggerFromConfig(svcCtx, cfg.Auditlog, evts, logger) return nil }, func() { @@ -73,7 +73,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("audit_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/auth-basic/pkg/command/server.go b/services/auth-basic/pkg/command/server.go index 3955613381a..16c2a075a28 100644 --- a/services/auth-basic/pkg/command/server.go +++ b/services/auth-basic/pkg/command/server.go @@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("auth-basic_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/auth-bearer/pkg/command/server.go b/services/auth-bearer/pkg/command/server.go index 8fa9a8258df..d7952744766 100644 --- a/services/auth-bearer/pkg/command/server.go +++ b/services/auth-bearer/pkg/command/server.go @@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("auth-bearer_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/auth-machine/pkg/command/server.go b/services/auth-machine/pkg/command/server.go index 6f642522d5b..85566507ea1 100644 --- a/services/auth-machine/pkg/command/server.go +++ b/services/auth-machine/pkg/command/server.go @@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("auth-machine_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/auth-service/pkg/command/server.go b/services/auth-service/pkg/command/server.go index 3465f4b108b..a98875dd69e 100644 --- a/services/auth-service/pkg/command/server.go +++ b/services/auth-service/pkg/command/server.go @@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("auth-service_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/clientlog/pkg/command/server.go b/services/clientlog/pkg/command/server.go index ede4ca621fb..e99f670dfed 100644 --- a/services/clientlog/pkg/command/server.go +++ b/services/clientlog/pkg/command/server.go @@ -109,7 +109,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.New("clientlog_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return svc.Run() }, func() { svc.Close() @@ -127,7 +127,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("clientlog_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/collaboration/pkg/command/server.go b/services/collaboration/pkg/command/server.go index 0da3f1075ee..9fad2e19319 100644 --- a/services/collaboration/pkg/command/server.go +++ b/services/collaboration/pkg/command/server.go @@ -105,7 +105,7 @@ func Server(cfg *config.Config) *cli.Command { if err != nil { return err } - gr.Add(runner.NewGolangGrpcServerRunner("collaboration_grpc", grpcServer, l)) + gr.Add(runner.NewGolangGrpcServerRunner(cfg.Service.Name+".grpc", grpcServer, l)) // start debug server debugServer, err := debug.Server( @@ -117,7 +117,7 @@ func Server(cfg *config.Config) *cli.Command { logger.Error().Err(err).Str("transport", "debug").Msg("Failed to initialize server") return err } - gr.Add(runner.NewGolangHttpServerRunner("collaboration_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) // start HTTP server httpServer, err := http.Server( diff --git a/services/eventhistory/pkg/command/server.go b/services/eventhistory/pkg/command/server.go index f419da15503..9ee0c172f04 100644 --- a/services/eventhistory/pkg/command/server.go +++ b/services/eventhistory/pkg/command/server.go @@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command { grpc.TraceProvider(traceProvider), ) - gr.Add(runner.NewGoMicroGrpcServerRunner("eventhistory_grpc", service)) + gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", service)) { debugServer, err := debug.Server( @@ -100,7 +100,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("eventhistory_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/frontend/pkg/command/server.go b/services/frontend/pkg/command/server.go index 51a88c70394..fca2db4934a 100644 --- a/services/frontend/pkg/command/server.go +++ b/services/frontend/pkg/command/server.go @@ -79,7 +79,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("frontend_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } httpSvc := registry.BuildHTTPService(cfg.HTTP.Namespace+"."+cfg.Service.Name, cfg.HTTP.Addr, version.GetString()) @@ -88,7 +88,7 @@ func Server(cfg *config.Config) *cli.Command { } // add event handler - gr.Add(runner.New("frontend_event", + gr.Add(runner.New(cfg.Service.Name+".event", func() error { return ListenForEvents(ctx, cfg, logger) }, func() { diff --git a/services/gateway/pkg/command/server.go b/services/gateway/pkg/command/server.go index ee171900def..8fcca646aa5 100644 --- a/services/gateway/pkg/command/server.go +++ b/services/gateway/pkg/command/server.go @@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("gateway_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/graph/pkg/command/server.go b/services/graph/pkg/command/server.go index 3d51fd7686f..25c19888c67 100644 --- a/services/graph/pkg/command/server.go +++ b/services/graph/pkg/command/server.go @@ -58,7 +58,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("graph_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -72,7 +72,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("graph_debug", server)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", server)) } grResults := gr.Run(ctx) diff --git a/services/groups/pkg/command/server.go b/services/groups/pkg/command/server.go index 824dc0407b5..ffc3950758b 100644 --- a/services/groups/pkg/command/server.go +++ b/services/groups/pkg/command/server.go @@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("groups_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/idm/pkg/command/server.go b/services/idm/pkg/command/server.go index 6f4a4b9116a..8909f08e91f 100644 --- a/services/idm/pkg/command/server.go +++ b/services/idm/pkg/command/server.go @@ -83,7 +83,7 @@ func Server(cfg *config.Config) *cli.Command { svcCtx, svcCancel := context.WithCancel(ctx) defer svcCancel() - gr.Add(runner.New("idm_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return svc.Serve(svcCtx) }, func() { svcCancel() @@ -101,7 +101,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("idm_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/idp/pkg/command/server.go b/services/idp/pkg/command/server.go index 40eef62c0dc..743441b1880 100644 --- a/services/idp/pkg/command/server.go +++ b/services/idp/pkg/command/server.go @@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("idp_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -101,7 +101,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("idp_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/invitations/pkg/command/server.go b/services/invitations/pkg/command/server.go index ae9cc9fc503..45d2207d9fd 100644 --- a/services/invitations/pkg/command/server.go +++ b/services/invitations/pkg/command/server.go @@ -76,7 +76,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("invitations_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -90,7 +90,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("invitations_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/nats/pkg/command/server.go b/services/nats/pkg/command/server.go index ea8bb5407d0..5d24f5c15bf 100644 --- a/services/nats/pkg/command/server.go +++ b/services/nats/pkg/command/server.go @@ -49,7 +49,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("nats_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } var tlsConf *tls.Config @@ -88,7 +88,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.New("nats_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return natsServer.ListenAndServe() }, func() { natsServer.Shutdown() diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index 70fe7cbcf79..a681ffbf0cf 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -77,7 +77,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("notifications_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } // evs defines a list of events to subscribe to @@ -141,7 +141,7 @@ func Server(cfg *config.Config) *cli.Command { cfg.Notifications.EmailTemplatePath, cfg.Notifications.DefaultLanguage, cfg.WebUIURL, cfg.Notifications.TranslationPath, cfg.Notifications.SMTP.Sender, notificationStore, historyClient, registeredEvents) - gr.Add(runner.New("notifications_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return svc.Run() }, func() { svc.Close() diff --git a/services/ocdav/pkg/command/server.go b/services/ocdav/pkg/command/server.go index c773c8b8a27..3004f10f6ac 100644 --- a/services/ocdav/pkg/command/server.go +++ b/services/ocdav/pkg/command/server.go @@ -105,7 +105,7 @@ func Server(cfg *config.Config) *cli.Command { // creating a runner for a go-micro service is a bit complex, so we'll // wrap the go-micro service with an ocis service the same way as // ocis-pkg/service/http is doing in order to reuse the factory. - gr.Add(runner.NewGoMicroHttpServerRunner("ocdav_http", ohttp.Service{Service: s})) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", ohttp.Service{Service: s})) debugServer, err := debug.Server( debug.Logger(logger), @@ -118,7 +118,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("ocdav_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) grResults := gr.Run(ctx) diff --git a/services/ocm/pkg/command/server.go b/services/ocm/pkg/command/server.go index 1ea44da30d8..0bf069efb61 100644 --- a/services/ocm/pkg/command/server.go +++ b/services/ocm/pkg/command/server.go @@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("ocm_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/ocs/pkg/command/server.go b/services/ocs/pkg/command/server.go index 946c388bf99..88641c2d059 100644 --- a/services/ocs/pkg/command/server.go +++ b/services/ocs/pkg/command/server.go @@ -69,7 +69,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("ocs_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -84,7 +84,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("ocs_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/policies/pkg/command/server.go b/services/policies/pkg/command/server.go index e328d6b9991..7fbe09463ca 100644 --- a/services/policies/pkg/command/server.go +++ b/services/policies/pkg/command/server.go @@ -102,7 +102,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroGrpcServerRunner("policies_grpc", svc)) + gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", svc)) } { @@ -118,7 +118,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.New("policies_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return eventSvc.Run() }, func() { eventSvc.Close() @@ -136,7 +136,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("policies_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/postprocessing/pkg/command/server.go b/services/postprocessing/pkg/command/server.go index 01ade38366a..66226c95f45 100644 --- a/services/postprocessing/pkg/command/server.go +++ b/services/postprocessing/pkg/command/server.go @@ -72,7 +72,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.New("postprocessing_svc", func() error { + gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return svc.Run() }, func() { svc.Close() diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index 3b65e45b1ec..f25be442bf1 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -205,7 +205,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("proxy_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -219,7 +219,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("proxy_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(cfg.Context) diff --git a/services/search/pkg/command/server.go b/services/search/pkg/command/server.go index 89d19e40c3d..047c0640691 100644 --- a/services/search/pkg/command/server.go +++ b/services/search/pkg/command/server.go @@ -69,7 +69,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroGrpcServerRunner("search_grpc", grpcServer)) + gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", grpcServer)) debugServer, err := debug.Server( debug.Logger(logger), @@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("search_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) grResults := gr.Run(ctx) diff --git a/services/settings/pkg/command/server.go b/services/settings/pkg/command/server.go index 689175e2126..87f45a7c3d2 100644 --- a/services/settings/pkg/command/server.go +++ b/services/settings/pkg/command/server.go @@ -73,7 +73,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Error initializing http service") return fmt.Errorf("could not initialize http service: %w", err) } - gr.Add(runner.NewGoMicroHttpServerRunner("settings_http", httpServer)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", httpServer)) // prepare a gRPC server and add it to the group run. grpcServer := grpc.Server( @@ -85,7 +85,7 @@ func Server(cfg *config.Config) *cli.Command { grpc.ServiceHandler(handle), grpc.TraceProvider(traceProvider), ) - gr.Add(runner.NewGoMicroGrpcServerRunner("settings_grpc", grpcServer)) + gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", grpcServer)) // prepare a debug server and add it to the group run. debugServer, err := debug.Server( @@ -98,7 +98,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("settings_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) grResults := gr.Run(ctx) diff --git a/services/sharing/pkg/command/server.go b/services/sharing/pkg/command/server.go index b2f969365bd..d8826d9f5ec 100644 --- a/services/sharing/pkg/command/server.go +++ b/services/sharing/pkg/command/server.go @@ -92,7 +92,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("sharing_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) diff --git a/services/sse/pkg/command/server.go b/services/sse/pkg/command/server.go index 86451eeb570..13818d1c284 100644 --- a/services/sse/pkg/command/server.go +++ b/services/sse/pkg/command/server.go @@ -75,7 +75,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("sse_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -89,7 +89,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("sse_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/thumbnails/pkg/command/server.go b/services/thumbnails/pkg/command/server.go index dfb64aa6e4c..501344b716a 100644 --- a/services/thumbnails/pkg/command/server.go +++ b/services/thumbnails/pkg/command/server.go @@ -64,7 +64,7 @@ func Server(cfg *config.Config) *cli.Command { grpc.TraceProvider(traceProvider), grpc.MaxConcurrentRequests(cfg.GRPC.MaxConcurrentRequests), ) - gr.Add(runner.NewGoMicroGrpcServerRunner("thumbnails_grpc", service)) + gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", service)) server, err := debug.Server( debug.Logger(logger), @@ -75,7 +75,7 @@ func Server(cfg *config.Config) *cli.Command { logger.Info().Err(err).Str("transport", "debug").Msg("Failed to initialize server") return err } - gr.Add(runner.NewGolangHttpServerRunner("thumbnails_debug", server)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", server)) httpServer, err := http.Server( http.Logger(logger), @@ -93,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("thumbnails_http", httpServer)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", httpServer)) grResults := gr.Run(ctx) diff --git a/services/userlog/pkg/command/server.go b/services/userlog/pkg/command/server.go index f17779c048f..beb6f69a1aa 100644 --- a/services/userlog/pkg/command/server.go +++ b/services/userlog/pkg/command/server.go @@ -138,7 +138,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("userlog_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -152,7 +152,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("userlog_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/users/pkg/command/server.go b/services/users/pkg/command/server.go index 31ceeaa2883..4b32e94eb62 100644 --- a/services/users/pkg/command/server.go +++ b/services/users/pkg/command/server.go @@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("users_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } // FIXME we should defer registering the service until we are sure that reva is running diff --git a/services/web/pkg/command/server.go b/services/web/pkg/command/server.go index 3c987750c48..e594c19481f 100644 --- a/services/web/pkg/command/server.go +++ b/services/web/pkg/command/server.go @@ -76,7 +76,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("web_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -90,7 +90,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("web_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/webdav/pkg/command/server.go b/services/webdav/pkg/command/server.go index 36ae0a1aa0a..3647e679038 100644 --- a/services/webdav/pkg/command/server.go +++ b/services/webdav/pkg/command/server.go @@ -71,7 +71,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("webdav_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -86,7 +86,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("webdav_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx) diff --git a/services/webfinger/pkg/command/server.go b/services/webfinger/pkg/command/server.go index b6a98ab486a..4eb820cab4f 100644 --- a/services/webfinger/pkg/command/server.go +++ b/services/webfinger/pkg/command/server.go @@ -84,7 +84,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGoMicroHttpServerRunner("webfinger_http", server)) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server)) } { @@ -99,7 +99,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - gr.Add(runner.NewGolangHttpServerRunner("webfinger_debug", debugServer)) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } grResults := gr.Run(ctx)