From 6587e595b74a407e791a945e6bd4853f3ea5cb94 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Tue, 19 Sep 2023 14:25:22 +0200 Subject: [PATCH] hard exit when services fail Signed-off-by: jkoberg --- services/app-provider/pkg/command/server.go | 1 + services/app-registry/pkg/command/server.go | 1 + services/audit/pkg/command/server.go | 2 ++ services/auth-basic/pkg/command/server.go | 1 + services/auth-bearer/pkg/command/server.go | 1 + services/auth-machine/pkg/command/server.go | 1 + services/auth-service/pkg/command/server.go | 1 + services/clientlog/pkg/command/server.go | 2 ++ services/frontend/pkg/command/server.go | 11 +++++++++++ services/gateway/pkg/command/server.go | 1 + services/graph/pkg/command/server.go | 2 ++ services/groups/pkg/command/server.go | 1 + services/idm/pkg/command/server.go | 1 + services/idp/pkg/command/server.go | 1 + services/invitations/pkg/command/server.go | 2 ++ services/nats/pkg/command/server.go | 2 ++ services/ocdav/pkg/command/server.go | 2 ++ services/ocs/pkg/command/server.go | 2 ++ services/postprocessing/pkg/command/server.go | 1 + services/proxy/pkg/command/server.go | 2 ++ services/settings/pkg/command/server.go | 3 +++ services/sharing/pkg/command/server.go | 1 + services/storage-publiclink/pkg/command/server.go | 1 + services/storage-shares/pkg/command/server.go | 1 + services/storage-system/pkg/command/server.go | 1 + services/storage-users/pkg/command/server.go | 1 + services/store/pkg/command/server.go | 2 ++ services/thumbnails/pkg/command/server.go | 2 ++ services/userlog/pkg/command/server.go | 2 ++ services/users/pkg/command/server.go | 1 + services/web/pkg/command/server.go | 1 + services/webdav/pkg/command/server.go | 2 ++ services/webfinger/pkg/command/server.go | 2 ++ 33 files changed, 58 insertions(+) diff --git a/services/app-provider/pkg/command/server.go b/services/app-provider/pkg/command/server.go index a6b26479c1d..8234b4391d6 100644 --- a/services/app-provider/pkg/command/server.go +++ b/services/app-provider/pkg/command/server.go @@ -61,6 +61,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/app-registry/pkg/command/server.go b/services/app-registry/pkg/command/server.go index aaab502d649..543eb3f833d 100644 --- a/services/app-registry/pkg/command/server.go +++ b/services/app-registry/pkg/command/server.go @@ -60,6 +60,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/audit/pkg/command/server.go b/services/audit/pkg/command/server.go index fe8f270cfca..c945ceea786 100644 --- a/services/audit/pkg/command/server.go +++ b/services/audit/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/events/stream" @@ -59,6 +60,7 @@ func Server(cfg *config.Config) *cli.Command { Err(err). Msg("Shutting down server") cancel() + os.Exit(1) }) { diff --git a/services/auth-basic/pkg/command/server.go b/services/auth-basic/pkg/command/server.go index 2d185a1f072..d7e9f8dffbc 100644 --- a/services/auth-basic/pkg/command/server.go +++ b/services/auth-basic/pkg/command/server.go @@ -74,6 +74,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/auth-bearer/pkg/command/server.go b/services/auth-bearer/pkg/command/server.go index 354f12899f7..5646f639914 100644 --- a/services/auth-bearer/pkg/command/server.go +++ b/services/auth-bearer/pkg/command/server.go @@ -61,6 +61,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/auth-machine/pkg/command/server.go b/services/auth-machine/pkg/command/server.go index f3d0a2957d0..e19fb45f69b 100644 --- a/services/auth-machine/pkg/command/server.go +++ b/services/auth-machine/pkg/command/server.go @@ -61,6 +61,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/auth-service/pkg/command/server.go b/services/auth-service/pkg/command/server.go index 21bdeee3b4a..d656ef42a9d 100644 --- a/services/auth-service/pkg/command/server.go +++ b/services/auth-service/pkg/command/server.go @@ -56,6 +56,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/clientlog/pkg/command/server.go b/services/clientlog/pkg/command/server.go index 050849c0b80..d8399f8ac7a 100644 --- a/services/clientlog/pkg/command/server.go +++ b/services/clientlog/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/events/stream" @@ -100,6 +101,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/frontend/pkg/command/server.go b/services/frontend/pkg/command/server.go index 1aa8a72ac83..556d0e82d69 100644 --- a/services/frontend/pkg/command/server.go +++ b/services/frontend/pkg/command/server.go @@ -65,6 +65,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( @@ -97,6 +98,16 @@ func Server(cfg *config.Config) *cli.Command { cancel() }) + if true { + logger.Error(). + Err(err). + Str("server", cfg.Service.Name). + Msg("Shutting down server") + + cancel() + os.Exit(1) + } + return gr.Run() }, } diff --git a/services/gateway/pkg/command/server.go b/services/gateway/pkg/command/server.go index 3d7229acb03..ebbc7f7eb4a 100644 --- a/services/gateway/pkg/command/server.go +++ b/services/gateway/pkg/command/server.go @@ -60,6 +60,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/graph/pkg/command/server.go b/services/graph/pkg/command/server.go index 386916072a9..2c547aefeb7 100644 --- a/services/graph/pkg/command/server.go +++ b/services/graph/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" @@ -68,6 +69,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/groups/pkg/command/server.go b/services/groups/pkg/command/server.go index 6226b9a2beb..c1b43bc9459 100644 --- a/services/groups/pkg/command/server.go +++ b/services/groups/pkg/command/server.go @@ -74,6 +74,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/idm/pkg/command/server.go b/services/idm/pkg/command/server.go index 4ba21b2a8ed..048ef8d3b68 100644 --- a/services/idm/pkg/command/server.go +++ b/services/idm/pkg/command/server.go @@ -95,6 +95,7 @@ func Server(cfg *config.Config) *cli.Command { Err(err). Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/idp/pkg/command/server.go b/services/idp/pkg/command/server.go index b21f2616851..48f431f5921 100644 --- a/services/idp/pkg/command/server.go +++ b/services/idp/pkg/command/server.go @@ -95,6 +95,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/invitations/pkg/command/server.go b/services/invitations/pkg/command/server.go index b1589876991..01000c7d727 100644 --- a/services/invitations/pkg/command/server.go +++ b/services/invitations/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" @@ -88,6 +89,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/nats/pkg/command/server.go b/services/nats/pkg/command/server.go index 09dc6cb54c5..e118d43312b 100644 --- a/services/nats/pkg/command/server.go +++ b/services/nats/pkg/command/server.go @@ -4,6 +4,7 @@ import ( "context" "crypto/tls" "fmt" + "os" "github.com/oklog/run" @@ -113,6 +114,7 @@ func Server(cfg *config.Config) *cli.Command { natsServer.Shutdown() cancel() + os.Exit(1) }) return gr.Run() diff --git a/services/ocdav/pkg/command/server.go b/services/ocdav/pkg/command/server.go index a5a8d178c41..881aabf03a4 100644 --- a/services/ocdav/pkg/command/server.go +++ b/services/ocdav/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/cs3org/reva/v2/pkg/micro/ocdav" "github.com/cs3org/reva/v2/pkg/sharedconf" @@ -99,6 +100,7 @@ func Server(cfg *config.Config) *cli.Command { Str("server", c.Command.Name). Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/ocs/pkg/command/server.go b/services/ocs/pkg/command/server.go index fb37a21f3bb..c252872eca3 100644 --- a/services/ocs/pkg/command/server.go +++ b/services/ocs/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" "github.com/owncloud/ocis/v2/ocis-pkg/version" @@ -81,6 +82,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/postprocessing/pkg/command/server.go b/services/postprocessing/pkg/command/server.go index a32716f405b..c71b278da08 100644 --- a/services/postprocessing/pkg/command/server.go +++ b/services/postprocessing/pkg/command/server.go @@ -86,6 +86,7 @@ func Server(cfg *config.Config) *cli.Command { Err(err). Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index 2421e91a8ca..be527383710 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "net/http" + "os" "time" "github.com/go-chi/chi/v5" @@ -154,6 +155,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/settings/pkg/command/server.go b/services/settings/pkg/command/server.go index d252f822ccb..7975ea41cee 100644 --- a/services/settings/pkg/command/server.go +++ b/services/settings/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" @@ -75,6 +76,7 @@ func Server(cfg *config.Config) *cli.Command { servers.Add(httpServer.Run, func(_ error) { logger.Info().Str("server", "http").Msg("Shutting down server") cancel() + os.Exit(1) }) // prepare a gRPC server and add it to the group run. @@ -90,6 +92,7 @@ func Server(cfg *config.Config) *cli.Command { servers.Add(grpcServer.Run, func(_ error) { logger.Info().Str("server", "grpc").Msg("Shutting down server") cancel() + os.Exit(1) }) // prepare a debug server and add it to the group run. diff --git a/services/sharing/pkg/command/server.go b/services/sharing/pkg/command/server.go index 37c01972f4b..027c1698372 100644 --- a/services/sharing/pkg/command/server.go +++ b/services/sharing/pkg/command/server.go @@ -74,6 +74,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/storage-publiclink/pkg/command/server.go b/services/storage-publiclink/pkg/command/server.go index 42a8cbf81da..6512252b758 100644 --- a/services/storage-publiclink/pkg/command/server.go +++ b/services/storage-publiclink/pkg/command/server.go @@ -61,6 +61,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/storage-shares/pkg/command/server.go b/services/storage-shares/pkg/command/server.go index 2c3746f0618..8af5b1fa383 100644 --- a/services/storage-shares/pkg/command/server.go +++ b/services/storage-shares/pkg/command/server.go @@ -61,6 +61,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/storage-system/pkg/command/server.go b/services/storage-system/pkg/command/server.go index 34577bf0874..00618bb9a88 100644 --- a/services/storage-system/pkg/command/server.go +++ b/services/storage-system/pkg/command/server.go @@ -61,6 +61,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/storage-users/pkg/command/server.go b/services/storage-users/pkg/command/server.go index e6acbd6f47f..cff2261c002 100644 --- a/services/storage-users/pkg/command/server.go +++ b/services/storage-users/pkg/command/server.go @@ -63,6 +63,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/store/pkg/command/server.go b/services/store/pkg/command/server.go index 3d766034799..854bf0e7bb2 100644 --- a/services/store/pkg/command/server.go +++ b/services/store/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" @@ -75,6 +76,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/thumbnails/pkg/command/server.go b/services/thumbnails/pkg/command/server.go index a18b49e3b2c..8482fa9e49e 100644 --- a/services/thumbnails/pkg/command/server.go +++ b/services/thumbnails/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" @@ -73,6 +74,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) server, err := debug.Server( diff --git a/services/userlog/pkg/command/server.go b/services/userlog/pkg/command/server.go index 3ec49220cdb..0498cac5fb5 100644 --- a/services/userlog/pkg/command/server.go +++ b/services/userlog/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/events/stream" @@ -144,6 +145,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/users/pkg/command/server.go b/services/users/pkg/command/server.go index 1fa6de1f5df..d5894fbb5a2 100644 --- a/services/users/pkg/command/server.go +++ b/services/users/pkg/command/server.go @@ -74,6 +74,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) debugServer, err := debug.Server( diff --git a/services/web/pkg/command/server.go b/services/web/pkg/command/server.go index 2ec46c31ca6..c967ece8476 100644 --- a/services/web/pkg/command/server.go +++ b/services/web/pkg/command/server.go @@ -93,6 +93,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/webdav/pkg/command/server.go b/services/webdav/pkg/command/server.go index f065fd515a0..a189dd36e75 100644 --- a/services/webdav/pkg/command/server.go +++ b/services/webdav/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" @@ -83,6 +84,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) } diff --git a/services/webfinger/pkg/command/server.go b/services/webfinger/pkg/command/server.go index 7874e8ff082..cfba7bf6834 100644 --- a/services/webfinger/pkg/command/server.go +++ b/services/webfinger/pkg/command/server.go @@ -3,6 +3,7 @@ package command import ( "context" "fmt" + "os" "github.com/oklog/run" "github.com/owncloud/ocis/v2/ocis-pkg/config/configlog" @@ -96,6 +97,7 @@ func Server(cfg *config.Config) *cli.Command { Msg("Shutting down server") cancel() + os.Exit(1) }) }