From c597dfb917c1bfe3e5a2c60a8f12e8eae1d95ec4 Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Tue, 27 May 2025 13:02:34 +0200 Subject: [PATCH] set default timeouts and clean up --- opencloud/pkg/runtime/service/service.go | 11 ++++++++--- pkg/runner/factory.go | 2 +- pkg/runner/grouprunner.go | 2 +- pkg/runner/runner.go | 2 +- services/antivirus/pkg/command/server.go | 6 +++--- services/app-provider/pkg/command/server.go | 2 +- services/app-registry/pkg/command/server.go | 2 +- services/audit/pkg/command/server.go | 4 ++-- services/auth-basic/pkg/command/server.go | 2 +- services/auth-bearer/pkg/command/server.go | 2 +- services/auth-machine/pkg/command/server.go | 2 +- services/auth-service/pkg/command/server.go | 2 +- services/clientlog/pkg/command/server.go | 4 ++-- services/collaboration/pkg/command/server.go | 4 ++-- services/eventhistory/pkg/command/server.go | 4 ++-- services/frontend/pkg/command/server.go | 4 ++-- services/gateway/pkg/command/server.go | 2 +- services/graph/pkg/command/server.go | 4 ++-- services/groups/pkg/command/server.go | 2 +- services/idm/pkg/command/server.go | 4 ++-- services/idp/pkg/command/server.go | 4 ++-- services/invitations/pkg/command/server.go | 4 ++-- services/nats/pkg/command/server.go | 4 ++-- services/notifications/pkg/command/server.go | 4 ++-- services/ocdav/pkg/command/server.go | 4 ++-- services/ocm/pkg/command/server.go | 2 +- services/ocs/pkg/command/server.go | 4 ++-- services/policies/pkg/command/server.go | 6 +++--- services/postprocessing/pkg/command/server.go | 2 +- services/proxy/pkg/command/server.go | 4 ++-- services/search/pkg/command/server.go | 4 ++-- services/settings/pkg/command/server.go | 6 +++--- services/sharing/pkg/command/server.go | 2 +- services/sse/pkg/command/server.go | 4 ++-- services/thumbnails/pkg/command/server.go | 6 +++--- services/userlog/pkg/command/server.go | 4 ++-- services/users/pkg/command/server.go | 2 +- services/web/pkg/command/server.go | 4 ++-- services/webdav/pkg/command/server.go | 4 ++-- services/webfinger/pkg/command/server.go | 4 ++-- 40 files changed, 75 insertions(+), 70 deletions(-) diff --git a/opencloud/pkg/runtime/service/service.go b/opencloud/pkg/runtime/service/service.go index 50d4fd905..80b05c266 100644 --- a/opencloud/pkg/runtime/service/service.go +++ b/opencloud/pkg/runtime/service/service.go @@ -73,6 +73,11 @@ var ( // wait funcs run after the service group has been started. _waitFuncs = []func(*occfg.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(*occfg.Config) suture.Service @@ -513,7 +518,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") @@ -528,7 +533,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) @@ -543,7 +548,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/pkg/runner/factory.go b/pkg/runner/factory.go index 3931c39c1..9ad599a87 100644 --- a/pkg/runner/factory.go +++ b/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/pkg/runner/grouprunner.go b/pkg/runner/grouprunner.go index e44f72d4c..4c4574b93 100644 --- a/pkg/runner/grouprunner.go +++ b/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/pkg/runner/runner.go b/pkg/runner/runner.go index 6733a745f..7e169d8e3 100644 --- a/pkg/runner/runner.go +++ b/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/services/antivirus/pkg/command/server.go b/services/antivirus/pkg/command/server.go index 9d22a5de6..e6f48ee4d 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 cli.Exit(err.Error(), 1) } - 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 66d1a8fea..88e8ef073 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 5642063e9..bd9540acf 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 4dbced80a..1a8bce1a5 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 eba9374de..0d6576dd7 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 f0ed47783..d78b93bbb 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 6dd71e887..d3d78682a 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 d097a4c6f..03b4181f6 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 fbf1ab461..a82fadd6a 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 79efd6ae2..f5ebcce29 100644 --- a/services/collaboration/pkg/command/server.go +++ b/services/collaboration/pkg/command/server.go @@ -113,7 +113,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( @@ -125,7 +125,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 c6cf336fc..245b77bb0 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 0d04efb54..909475f36 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 f07cba2dc..b0dca37d1 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 77247a8a2..7a10c42cf 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 b5ef09d2c..270400fc1 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 e87affc73..3d860381a 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 fc47ee893..5240e488d 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 be1d58934..066080ebb 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 8ab770975..b47a93e5b 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 2a7e70edf..6297a8fac 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 @@ -140,7 +140,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 db3f76af6..368b21f43 100644 --- a/services/ocdav/pkg/command/server.go +++ b/services/ocdav/pkg/command/server.go @@ -106,7 +106,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), @@ -119,7 +119,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 05f42e12b..6b2cd8406 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 01abae2ac..c0df57508 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 0871ffa55..de1e8fec1 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 af881d8fe..b48e022fb 100644 --- a/services/postprocessing/pkg/command/server.go +++ b/services/postprocessing/pkg/command/server.go @@ -64,7 +64,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 e6f9e7231..c129fe027 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 cef5f3c2f..490e2d672 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 14634f2b1..b44dec389 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 edc28a01b..9f7394d60 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 1b40de0af..e916204b4 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 d9112d666..491428a24 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 ff37ac228..056540ee3 100644 --- a/services/userlog/pkg/command/server.go +++ b/services/userlog/pkg/command/server.go @@ -136,7 +136,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)) } { @@ -150,7 +150,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 7c35c1f5b..939b27c9d 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 9c7f26619..6b0c4a624 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 fd304398f..2ed4233b5 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 e5d17e6fc..5a9504e79 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)