From 0695c25089e40adc9f658bf3b21c7e9f1acba231 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Thu, 12 Dec 2019 09:53:43 +0100 Subject: [PATCH 01/16] prevent from registering broken services --- pkg/command/konnectd.go | 9 ++++----- pkg/command/ocs.go | 9 ++++----- pkg/command/phoenix.go | 9 ++++----- pkg/command/webdav.go | 9 ++++----- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/pkg/command/konnectd.go b/pkg/command/konnectd.go index 6452219077..9d16d3cccf 100644 --- a/pkg/command/konnectd.go +++ b/pkg/command/konnectd.go @@ -11,7 +11,6 @@ import ( "github.com/owncloud/ocis-konnectd/pkg/metrics" "github.com/owncloud/ocis-konnectd/pkg/server/http" "github.com/owncloud/ocis/pkg/config" - "github.com/owncloud/ocis/pkg/register" ) // KonnectdCommand is the entrypoint for the konnectd command. @@ -78,7 +77,7 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config { return cfg.Konnectd } -func init() { - register.AddCommand(KonnectdCommand) - register.AddHandler(KonnectdHandler) -} +// func init() { +// register.AddCommand(KonnectdCommand) +// register.AddHandler(KonnectdHandler) +// } diff --git a/pkg/command/ocs.go b/pkg/command/ocs.go index 281e78a9cb..c240183106 100644 --- a/pkg/command/ocs.go +++ b/pkg/command/ocs.go @@ -11,7 +11,6 @@ import ( "github.com/owncloud/ocis-ocs/pkg/metrics" "github.com/owncloud/ocis-ocs/pkg/server/http" "github.com/owncloud/ocis/pkg/config" - "github.com/owncloud/ocis/pkg/register" ) // OCSCommand is the entrypoint for the ocs command. @@ -78,7 +77,7 @@ func configureOCS(cfg *config.Config) *svcconfig.Config { return cfg.OCS } -func init() { - register.AddCommand(OCSCommand) - register.AddHandler(OCSHandler) -} +// func init() { +// register.AddCommand(OCSCommand) +// register.AddHandler(OCSHandler) +// } diff --git a/pkg/command/phoenix.go b/pkg/command/phoenix.go index 2e210e48a3..8fad51110b 100644 --- a/pkg/command/phoenix.go +++ b/pkg/command/phoenix.go @@ -11,7 +11,6 @@ import ( "github.com/owncloud/ocis-phoenix/pkg/metrics" "github.com/owncloud/ocis-phoenix/pkg/server/http" "github.com/owncloud/ocis/pkg/config" - "github.com/owncloud/ocis/pkg/register" ) // PhoenixCommand is the entrypoint for the phoenix command. @@ -78,7 +77,7 @@ func configurePhoenix(cfg *config.Config) *svcconfig.Config { return cfg.Phoenix } -func init() { - register.AddCommand(PhoenixCommand) - register.AddHandler(PhoenixHandler) -} +// func init() { +// register.AddCommand(PhoenixCommand) +// register.AddHandler(PhoenixHandler) +// } diff --git a/pkg/command/webdav.go b/pkg/command/webdav.go index 219ab8b3fa..bf1283c0a9 100644 --- a/pkg/command/webdav.go +++ b/pkg/command/webdav.go @@ -11,7 +11,6 @@ import ( "github.com/owncloud/ocis-webdav/pkg/metrics" "github.com/owncloud/ocis-webdav/pkg/server/http" "github.com/owncloud/ocis/pkg/config" - "github.com/owncloud/ocis/pkg/register" ) // WebDAVCommand is the entrypoint for the webdav command. @@ -78,7 +77,7 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config { return cfg.WebDAV } -func init() { - register.AddCommand(WebDAVCommand) - register.AddHandler(WebDAVHandler) -} +// func init() { +// register.AddCommand(WebDAVCommand) +// register.AddHandler(WebDAVHandler) +// } From 36db3073339851f8ca7a729dd73e614ef5cf963e Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Thu, 12 Dec 2019 10:05:30 +0100 Subject: [PATCH 02/16] update modules --- go.mod | 4 ++-- go.sum | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 7a00a85edf..6076cec9d9 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/micro/cli v0.2.0 github.com/oklog/run v1.0.0 github.com/openzipkin/zipkin-go v0.2.2 - github.com/owncloud/ocis-graph v0.0.0-20191210114050-fc7e3d748b12 - github.com/owncloud/ocis-hello v0.0.0-20191209151829-dd129732c21d + github.com/owncloud/ocis-graph v0.0.0-20191211134602-307fdc810c1c + github.com/owncloud/ocis-hello v0.0.0-20191211135609-45fb78b1a73a github.com/owncloud/ocis-konnectd v0.0.0-20191210084549-0f2829ca1bff github.com/owncloud/ocis-ocs v0.0.0-20191210090203-3f4c51b962f3 github.com/owncloud/ocis-phoenix v0.0.0-20191209152623-c73b270f8783 diff --git a/go.sum b/go.sum index 3d16b091f7..b9977041ba 100644 --- a/go.sum +++ b/go.sum @@ -529,8 +529,12 @@ github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukw github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= github.com/owncloud/ocis-graph v0.0.0-20191210114050-fc7e3d748b12 h1:eQqowoCCgH9Hz/CkrCna6wWkcYrlPo1HvQlbTgIXp1c= github.com/owncloud/ocis-graph v0.0.0-20191210114050-fc7e3d748b12/go.mod h1:Rx5hfbm0QPs7NRrekAEZf20TH+gpGevJjWLgFn3/mdI= +github.com/owncloud/ocis-graph v0.0.0-20191211134602-307fdc810c1c h1:LylwP5oleN0PQhDMh478hZPtn3/O6RgDYOYyzVH+x88= +github.com/owncloud/ocis-graph v0.0.0-20191211134602-307fdc810c1c/go.mod h1:Rx5hfbm0QPs7NRrekAEZf20TH+gpGevJjWLgFn3/mdI= github.com/owncloud/ocis-hello v0.0.0-20191209151829-dd129732c21d h1:IXY08w2KX8Hw5wCtMg5PFqpjlChVtmjTfHq9mFJ4VQU= github.com/owncloud/ocis-hello v0.0.0-20191209151829-dd129732c21d/go.mod h1:D4ewxHUJyXj1NG8EuDSWW9XErLFQIsLBmzxnApBsJH4= +github.com/owncloud/ocis-hello v0.0.0-20191211135609-45fb78b1a73a h1:Ls96kUMuRaDYdVoxxhiPtTWHYRB2XZO07tEzzUOfOqs= +github.com/owncloud/ocis-hello v0.0.0-20191211135609-45fb78b1a73a/go.mod h1:D4ewxHUJyXj1NG8EuDSWW9XErLFQIsLBmzxnApBsJH4= github.com/owncloud/ocis-konnectd v0.0.0-20191210084549-0f2829ca1bff h1:obpwql1j0YhUeHI2Gs3sHYhfeADXNpBKtAu9pYp5lao= github.com/owncloud/ocis-konnectd v0.0.0-20191210084549-0f2829ca1bff/go.mod h1:b9DxRrJvAsmFzoB/ETqNPAaRIGlkUwXSCM0Z7rF84m4= github.com/owncloud/ocis-ocs v0.0.0-20191210090203-3f4c51b962f3 h1:jISHbca1VhWVGu3t2FrfI6g2PSFgcbGDdpeCflH16MQ= @@ -703,6 +707,7 @@ go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/ratelimit v0.0.0-20180316092928-c15da0234277/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y= go.uber.org/ratelimit v0.1.0/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.12.0 h1:dySoUQPFBGj6xwjmBzageVL8jGi8uxc6bEmJQjA06bw= From d4728c6d012be9b7d7bc488c00c918e4b89147cd Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Thu, 12 Dec 2019 10:06:26 +0100 Subject: [PATCH 03/16] provide configuration for the extension on runtime --- pkg/command/graph.go | 7 ++++--- pkg/command/hello.go | 14 +++++++------- pkg/command/server.go | 2 +- pkg/register/command.go | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pkg/command/graph.go b/pkg/command/graph.go index 1a42a1342c..63986c15ac 100644 --- a/pkg/command/graph.go +++ b/pkg/command/graph.go @@ -32,7 +32,7 @@ func GraphCommand(cfg *config.Config) cli.Command { } // GraphHandler defines the direct server handler. -func GraphHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, cfg *config.Config) error { +func GraphHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { scfg := configureGraph(cfg) logger := command.NewLogger(scfg) m := metrics.New() @@ -56,8 +56,8 @@ func GraphHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, gr.Add(func() error { return server.Run() - }, func(_ error) { - logger.Info(). + }, func(err error) { + logger.Err(err). Str("transport", "http"). Msg("Shutting down server") @@ -73,6 +73,7 @@ func configureGraph(cfg *config.Config) *svcconfig.Config { cfg.Graph.Log.Pretty = cfg.Log.Pretty cfg.Graph.Log.Color = cfg.Log.Color cfg.Graph.Tracing.Enabled = false + cfg.Graph.HTTP.Addr = "localhost:9107" cfg.Graph.HTTP.Root = "/" return cfg.Graph diff --git a/pkg/command/hello.go b/pkg/command/hello.go index ec3d5c8424..42d63c5730 100644 --- a/pkg/command/hello.go +++ b/pkg/command/hello.go @@ -33,7 +33,7 @@ func HelloCommand(cfg *config.Config) cli.Command { } // HelloHandler defines the direct server handler. -func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, cfg *config.Config) error { +func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { scfg := configureHello(cfg) logger := command.NewLogger(scfg) m := metrics.New() @@ -47,8 +47,7 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, ) if err != nil { - logger.Info(). - Err(err). + logger.Err(err). Str("transport", "http"). Msg("Failed to initialize server") @@ -57,8 +56,8 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, gr.Add(func() error { return server.Run() - }, func(_ error) { - logger.Info(). + }, func(err error) { + logger.Err(err). Str("transport", "http"). Msg("Shutting down server") @@ -75,8 +74,7 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, ) if err != nil { - logger.Info(). - Err(err). + logger.Err(err). Str("transport", "grpc"). Msg("Failed to initialize server") @@ -102,7 +100,9 @@ func configureHello(cfg *config.Config) *svcconfig.Config { cfg.Hello.Log.Pretty = cfg.Log.Pretty cfg.Hello.Log.Color = cfg.Log.Color cfg.Hello.Tracing.Enabled = false + cfg.Hello.HTTP.Addr = "localhost:9105" cfg.Hello.HTTP.Root = "/" + cfg.Hello.GRPC.Addr = "localhost:9106" return cfg.Hello } diff --git a/pkg/command/server.go b/pkg/command/server.go index f6f920a79a..de2fc15234 100644 --- a/pkg/command/server.go +++ b/pkg/command/server.go @@ -129,7 +129,7 @@ func Server(cfg *config.Config) cli.Command { defer cancel() for _, fn := range register.Handlers { - fn(ctx, cancel, gr, cfg) + fn(ctx, cancel, &gr, cfg) } { diff --git a/pkg/register/command.go b/pkg/register/command.go index a8da7ba440..a2d8cd63e4 100644 --- a/pkg/register/command.go +++ b/pkg/register/command.go @@ -20,7 +20,7 @@ var ( type Command func(*config.Config) cli.Command // Handler defines the register handler. -type Handler func(context.Context, context.CancelFunc, run.Group, *config.Config) error +type Handler func(context.Context, context.CancelFunc, *run.Group, *config.Config) error // AddCommand appends a command to Commands. func AddCommand(cmd Command) { From fd1eabf43bd8bcbf47bed5b28c39ee154b307e8f Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:15:03 +0100 Subject: [PATCH 04/16] adapt WebDavHandler to match its interface definition --- pkg/command/webdav.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/command/webdav.go b/pkg/command/webdav.go index bf1283c0a9..0ccbf7fd90 100644 --- a/pkg/command/webdav.go +++ b/pkg/command/webdav.go @@ -11,6 +11,7 @@ import ( "github.com/owncloud/ocis-webdav/pkg/metrics" "github.com/owncloud/ocis-webdav/pkg/server/http" "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" ) // WebDAVCommand is the entrypoint for the webdav command. @@ -31,7 +32,7 @@ func WebDAVCommand(cfg *config.Config) cli.Command { } // WebDAVHandler defines the direct server handler. -func WebDAVHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, cfg *config.Config) error { +func WebDAVHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { scfg := configureWebDAV(cfg) logger := command.NewLogger(scfg) m := metrics.New() @@ -72,12 +73,13 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config { cfg.WebDAV.Log.Pretty = cfg.Log.Pretty cfg.WebDAV.Log.Color = cfg.Log.Color cfg.WebDAV.Tracing.Enabled = false + cfg.WebDAV.HTTP.Addr = "localhost:9108" cfg.WebDAV.HTTP.Root = "/" return cfg.WebDAV } -// func init() { -// register.AddCommand(WebDAVCommand) -// register.AddHandler(WebDAVHandler) -// } +func init() { + register.AddCommand(WebDAVCommand) + register.AddHandler(WebDAVHandler) +} From d0d19d982b881e63e5d41af0ea2ddb2ff749fdb6 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:15:37 +0100 Subject: [PATCH 05/16] added a reference example of a gateway service --- pkg/micro/api/api.go | 91 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 pkg/micro/api/api.go diff --git a/pkg/micro/api/api.go b/pkg/micro/api/api.go new file mode 100644 index 0000000000..29b955a9db --- /dev/null +++ b/pkg/micro/api/api.go @@ -0,0 +1,91 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/gorilla/mux" + "github.com/micro/go-micro" + ahandler "github.com/micro/go-micro/api/handler" + aapi "github.com/micro/go-micro/api/handler/api" + "github.com/micro/go-micro/api/resolver" + rrmicro "github.com/micro/go-micro/api/resolver/micro" + "github.com/micro/go-micro/api/router" + regRouter "github.com/micro/go-micro/api/router/registry" + httpapi "github.com/micro/go-micro/api/server/http" + "github.com/oklog/run" + "github.com/owncloud/ocis/pkg/config" + "github.com/rs/zerolog/log" +) + +// MicroGateway implements the handler interface +func MicroGateway(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { + // create the gateway service + // var opts []server.Option + var h http.Handler + r := mux.NewRouter() + h = r + + // return version and list of services + r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + + if r.Method == "OPTIONS" { + return + } + + response := fmt.Sprintf(`{"version": "%s"}`, "[void]") + w.Write([]byte(response)) + }) + + // strip favicon.ico + r.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {}) + + var srvOpts []micro.Option + srvOpts = append(srvOpts, micro.Name("com.micro.api")) + + // initialise service + service := micro.NewService(srvOpts...) + + // resolver options + ropts := []resolver.Option{ + resolver.WithNamespace("com.micro"), + resolver.WithHandler("meta"), + } + + // default resolver + rr := rrmicro.NewResolver(ropts...) + + rt := regRouter.NewRouter( + router.WithNamespace("com.micro"), + router.WithHandler(aapi.Handler), + router.WithResolver(rr), + router.WithRegistry(service.Options().Registry), + ) + ap := aapi.NewHandler( + ahandler.WithNamespace("com.micro"), + ahandler.WithRouter(rt), + ahandler.WithService(service), + ) + r.PathPrefix("/").Handler(ap) + + api := httpapi.NewServer(":8111") + api.Init() + api.Handle("/", h) + + gr.Add(func() error { + return service.Run() + }, func(err error) { + log.Err(err) + + cancel() + }) + + // add it to the run group + return nil +} + +// func init() { +// fmt.Println("doing things") +// register.AddHandler(MicroGateway) +// } From e3ff508e022200cc0a5bd3c20d3a4134617701f5 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:15:46 +0100 Subject: [PATCH 06/16] updated dependencies --- go.mod | 11 +++++++---- go.sum | 11 +++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 6076cec9d9..76ede44993 100644 --- a/go.mod +++ b/go.mod @@ -6,16 +6,19 @@ require ( contrib.go.opencensus.io/exporter/jaeger v0.2.0 contrib.go.opencensus.io/exporter/ocagent v0.6.0 contrib.go.opencensus.io/exporter/zipkin v0.1.1 + github.com/gorilla/mux v1.7.3 github.com/micro/cli v0.2.0 + github.com/micro/go-micro v1.17.1 github.com/oklog/run v1.0.0 github.com/openzipkin/zipkin-go v0.2.2 github.com/owncloud/ocis-graph v0.0.0-20191211134602-307fdc810c1c github.com/owncloud/ocis-hello v0.0.0-20191211135609-45fb78b1a73a - github.com/owncloud/ocis-konnectd v0.0.0-20191210084549-0f2829ca1bff - github.com/owncloud/ocis-ocs v0.0.0-20191210090203-3f4c51b962f3 - github.com/owncloud/ocis-phoenix v0.0.0-20191209152623-c73b270f8783 + github.com/owncloud/ocis-konnectd v0.0.0-20191212131659-2221c66aba96 + github.com/owncloud/ocis-ocs v0.0.0-20191212131641-cb8571fc3356 + github.com/owncloud/ocis-phoenix v0.0.0-20191212131611-6e342276ddad github.com/owncloud/ocis-pkg v1.2.0 - github.com/owncloud/ocis-webdav v0.0.0-20191210090227-af2e98f1e6a9 + github.com/owncloud/ocis-webdav v0.0.0-20191212131547-1b9754978852 + github.com/rs/zerolog v1.17.2 github.com/spf13/viper v1.6.1 go.opencensus.io v0.22.2 ) diff --git a/go.sum b/go.sum index b9977041ba..faaebbd536 100644 --- a/go.sum +++ b/go.sum @@ -207,6 +207,7 @@ github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmy github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-acme/lego/v3 v3.1.0 h1:yanYFoYW8azFkCvJfIk7edWWfjkYkhDxe45ZsxoW4Xk= github.com/go-acme/lego/v3 v3.1.0/go.mod h1:074uqt+JS6plx+c9Xaiz6+L+GBb+7itGtzfcDM2AhEE= github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs= github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= @@ -296,8 +297,10 @@ github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEo github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -537,15 +540,23 @@ github.com/owncloud/ocis-hello v0.0.0-20191211135609-45fb78b1a73a h1:Ls96kUMuRaD github.com/owncloud/ocis-hello v0.0.0-20191211135609-45fb78b1a73a/go.mod h1:D4ewxHUJyXj1NG8EuDSWW9XErLFQIsLBmzxnApBsJH4= github.com/owncloud/ocis-konnectd v0.0.0-20191210084549-0f2829ca1bff h1:obpwql1j0YhUeHI2Gs3sHYhfeADXNpBKtAu9pYp5lao= github.com/owncloud/ocis-konnectd v0.0.0-20191210084549-0f2829ca1bff/go.mod h1:b9DxRrJvAsmFzoB/ETqNPAaRIGlkUwXSCM0Z7rF84m4= +github.com/owncloud/ocis-konnectd v0.0.0-20191212131659-2221c66aba96 h1:/GF+F+NCmrwimga+GG8dbK+K6H7nQzmlC+YfpNHeAeI= +github.com/owncloud/ocis-konnectd v0.0.0-20191212131659-2221c66aba96/go.mod h1:b9DxRrJvAsmFzoB/ETqNPAaRIGlkUwXSCM0Z7rF84m4= github.com/owncloud/ocis-ocs v0.0.0-20191210090203-3f4c51b962f3 h1:jISHbca1VhWVGu3t2FrfI6g2PSFgcbGDdpeCflH16MQ= github.com/owncloud/ocis-ocs v0.0.0-20191210090203-3f4c51b962f3/go.mod h1:uxMnXanRGabyExSbqGTkMTWVriv3HrdSivUfh2lxozE= +github.com/owncloud/ocis-ocs v0.0.0-20191212131641-cb8571fc3356 h1:afpOYPB43lMiFE0V24USMekJwZ8YCl/H+YrapVUarWM= +github.com/owncloud/ocis-ocs v0.0.0-20191212131641-cb8571fc3356/go.mod h1:uxMnXanRGabyExSbqGTkMTWVriv3HrdSivUfh2lxozE= github.com/owncloud/ocis-phoenix v0.0.0-20191209152623-c73b270f8783 h1:a09fQ21Qy+jvoMLuloRuekfivSpGC30G2msfQCzHARw= github.com/owncloud/ocis-phoenix v0.0.0-20191209152623-c73b270f8783/go.mod h1:xPa4BmtS+Hcsgx5veyfNxeLnjqitXJ7YRWLR2ZJg91A= +github.com/owncloud/ocis-phoenix v0.0.0-20191212131611-6e342276ddad h1:MoLJGCG5eZiXMftH9CtNJdJSPO0YGxE0I4K/Va31poo= +github.com/owncloud/ocis-phoenix v0.0.0-20191212131611-6e342276ddad/go.mod h1:xPa4BmtS+Hcsgx5veyfNxeLnjqitXJ7YRWLR2ZJg91A= github.com/owncloud/ocis-pkg v1.1.0/go.mod h1:EfbeXoe60Me2lB/AWjYl8UFNv4isqCPP6lokd5R7nyM= github.com/owncloud/ocis-pkg v1.2.0 h1:eP0AOSEXAgiblL2yOpNOmriKhDXN+mai+4belBJRkWU= github.com/owncloud/ocis-pkg v1.2.0/go.mod h1:EfbeXoe60Me2lB/AWjYl8UFNv4isqCPP6lokd5R7nyM= github.com/owncloud/ocis-webdav v0.0.0-20191210090227-af2e98f1e6a9 h1:uuDtkq3sQRhsHyi9y6TMfDzFrl2oJkhL8+CGLim+Uo4= github.com/owncloud/ocis-webdav v0.0.0-20191210090227-af2e98f1e6a9/go.mod h1:2lMqOO/rcHqn5V4/W8pOSemqwnogUnrfBR5m6a/VZJc= +github.com/owncloud/ocis-webdav v0.0.0-20191212131547-1b9754978852 h1:AK2T0mY7zz0IcxslOIytEz0+w2navEuKf0yKn4LR2+4= +github.com/owncloud/ocis-webdav v0.0.0-20191212131547-1b9754978852/go.mod h1:2lMqOO/rcHqn5V4/W8pOSemqwnogUnrfBR5m6a/VZJc= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= From 2903a9e3d45090f8134b26141e5b3d3b5a5ca8d0 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:16:04 +0100 Subject: [PATCH 07/16] comment out api initialization --- pkg/command/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/command/server.go b/pkg/command/server.go index de2fc15234..04fbb2a3e9 100644 --- a/pkg/command/server.go +++ b/pkg/command/server.go @@ -128,6 +128,9 @@ func Server(cfg *config.Config) cli.Command { defer cancel() + // register a micro gateway + // mapi.MicroGateway(ctx, cancel, &gr, cfg) + for _, fn := range register.Handlers { fn(ctx, cancel, &gr, cfg) } From 1ee963dcdd1bf199660d7b5898c0e7520140b579 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:17:22 +0100 Subject: [PATCH 08/16] remove dead code --- pkg/micro/api/api.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/micro/api/api.go b/pkg/micro/api/api.go index 29b955a9db..89a2d0baa6 100644 --- a/pkg/micro/api/api.go +++ b/pkg/micro/api/api.go @@ -84,8 +84,3 @@ func MicroGateway(ctx context.Context, cancel context.CancelFunc, gr *run.Group, // add it to the run group return nil } - -// func init() { -// fmt.Println("doing things") -// register.AddHandler(MicroGateway) -// } From f74995a6262b23923ba284c4cf61214f8e8c6d8b Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:31:15 +0100 Subject: [PATCH 09/16] enable konnectd + ocs --- pkg/command/konnectd.go | 12 +++++++----- pkg/command/ocs.go | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/command/konnectd.go b/pkg/command/konnectd.go index 9d16d3cccf..ba152da9f2 100644 --- a/pkg/command/konnectd.go +++ b/pkg/command/konnectd.go @@ -11,6 +11,7 @@ import ( "github.com/owncloud/ocis-konnectd/pkg/metrics" "github.com/owncloud/ocis-konnectd/pkg/server/http" "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" ) // KonnectdCommand is the entrypoint for the konnectd command. @@ -31,7 +32,7 @@ func KonnectdCommand(cfg *config.Config) cli.Command { } // KonnectdHandler defines the direct server handler. -func KonnectdHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, cfg *config.Config) error { +func KonnectdHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { scfg := configureKonnectd(cfg) logger := command.NewLogger(scfg) m := metrics.New() @@ -72,12 +73,13 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config { cfg.Konnectd.Log.Pretty = cfg.Log.Pretty cfg.Konnectd.Log.Color = cfg.Log.Color cfg.Konnectd.Tracing.Enabled = false + cfg.Konnectd.HTTP.Addr = "localhost:9011" cfg.Konnectd.HTTP.Root = "/" return cfg.Konnectd } -// func init() { -// register.AddCommand(KonnectdCommand) -// register.AddHandler(KonnectdHandler) -// } +func init() { + register.AddCommand(KonnectdCommand) + register.AddHandler(KonnectdHandler) +} diff --git a/pkg/command/ocs.go b/pkg/command/ocs.go index c240183106..b29336cb27 100644 --- a/pkg/command/ocs.go +++ b/pkg/command/ocs.go @@ -11,6 +11,7 @@ import ( "github.com/owncloud/ocis-ocs/pkg/metrics" "github.com/owncloud/ocis-ocs/pkg/server/http" "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" ) // OCSCommand is the entrypoint for the ocs command. @@ -31,7 +32,7 @@ func OCSCommand(cfg *config.Config) cli.Command { } // OCSHandler defines the direct server handler. -func OCSHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, cfg *config.Config) error { +func OCSHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { scfg := configureOCS(cfg) logger := command.NewLogger(scfg) m := metrics.New() @@ -72,12 +73,13 @@ func configureOCS(cfg *config.Config) *svcconfig.Config { cfg.OCS.Log.Pretty = cfg.Log.Pretty cfg.OCS.Log.Color = cfg.Log.Color cfg.OCS.Tracing.Enabled = false + cfg.OCS.HTTP.Addr = "localhost:9109" cfg.OCS.HTTP.Root = "/" return cfg.OCS } -// func init() { -// register.AddCommand(OCSCommand) -// register.AddHandler(OCSHandler) -// } +func init() { + register.AddCommand(OCSCommand) + register.AddHandler(OCSHandler) +} From ff60245e83885cba6b80469c534b3ddbead4a4df Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:35:23 +0100 Subject: [PATCH 10/16] enable phoenix on the reserved port --- pkg/command/phoenix.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/command/phoenix.go b/pkg/command/phoenix.go index 8fad51110b..6affd112fb 100644 --- a/pkg/command/phoenix.go +++ b/pkg/command/phoenix.go @@ -11,6 +11,7 @@ import ( "github.com/owncloud/ocis-phoenix/pkg/metrics" "github.com/owncloud/ocis-phoenix/pkg/server/http" "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" ) // PhoenixCommand is the entrypoint for the phoenix command. @@ -31,7 +32,7 @@ func PhoenixCommand(cfg *config.Config) cli.Command { } // PhoenixHandler defines the direct server handler. -func PhoenixHandler(ctx context.Context, cancel context.CancelFunc, gr run.Group, cfg *config.Config) error { +func PhoenixHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error { scfg := configurePhoenix(cfg) logger := command.NewLogger(scfg) m := metrics.New() @@ -72,12 +73,13 @@ func configurePhoenix(cfg *config.Config) *svcconfig.Config { cfg.Phoenix.Log.Pretty = cfg.Log.Pretty cfg.Phoenix.Log.Color = cfg.Log.Color cfg.Phoenix.Tracing.Enabled = false + cfg.Phoenix.HTTP.Addr = "localhost:9100" cfg.Phoenix.HTTP.Root = "/" return cfg.Phoenix } -// func init() { -// register.AddCommand(PhoenixCommand) -// register.AddHandler(PhoenixHandler) -// } +func init() { + register.AddCommand(PhoenixCommand) + register.AddHandler(PhoenixHandler) +} From fa77e943cdd7c1aa63e7da6e5356609ecd156f13 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:35:55 +0100 Subject: [PATCH 11/16] use the right port on graph service --- pkg/command/graph.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/command/graph.go b/pkg/command/graph.go index 63986c15ac..8e1e85b000 100644 --- a/pkg/command/graph.go +++ b/pkg/command/graph.go @@ -73,7 +73,7 @@ func configureGraph(cfg *config.Config) *svcconfig.Config { cfg.Graph.Log.Pretty = cfg.Log.Pretty cfg.Graph.Log.Color = cfg.Log.Color cfg.Graph.Tracing.Enabled = false - cfg.Graph.HTTP.Addr = "localhost:9107" + cfg.Graph.HTTP.Addr = "localhost:9120" cfg.Graph.HTTP.Root = "/" return cfg.Graph From 58eaf3750fed058f5984bbccd31dfea8c5cbaa18 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:36:13 +0100 Subject: [PATCH 12/16] use the right port on konnectd service --- pkg/command/konnectd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/command/konnectd.go b/pkg/command/konnectd.go index ba152da9f2..e3fd4d5021 100644 --- a/pkg/command/konnectd.go +++ b/pkg/command/konnectd.go @@ -73,7 +73,7 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config { cfg.Konnectd.Log.Pretty = cfg.Log.Pretty cfg.Konnectd.Log.Color = cfg.Log.Color cfg.Konnectd.Tracing.Enabled = false - cfg.Konnectd.HTTP.Addr = "localhost:9011" + cfg.Konnectd.HTTP.Addr = "localhost:9130" cfg.Konnectd.HTTP.Root = "/" return cfg.Konnectd From ded7b7249c849d4cddaec292fd7c3c41959f6a8d Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:36:28 +0100 Subject: [PATCH 13/16] use the right port on ocs service --- pkg/command/ocs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/command/ocs.go b/pkg/command/ocs.go index b29336cb27..770610c488 100644 --- a/pkg/command/ocs.go +++ b/pkg/command/ocs.go @@ -73,7 +73,7 @@ func configureOCS(cfg *config.Config) *svcconfig.Config { cfg.OCS.Log.Pretty = cfg.Log.Pretty cfg.OCS.Log.Color = cfg.Log.Color cfg.OCS.Tracing.Enabled = false - cfg.OCS.HTTP.Addr = "localhost:9109" + cfg.OCS.HTTP.Addr = "localhost:9110" cfg.OCS.HTTP.Root = "/" return cfg.OCS From f46a49826af2fbb529b6567b3b7538055138558a Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 10:37:06 +0100 Subject: [PATCH 14/16] use the right port on webdav service --- pkg/command/webdav.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/command/webdav.go b/pkg/command/webdav.go index 0ccbf7fd90..918c7e508e 100644 --- a/pkg/command/webdav.go +++ b/pkg/command/webdav.go @@ -73,7 +73,7 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config { cfg.WebDAV.Log.Pretty = cfg.Log.Pretty cfg.WebDAV.Log.Color = cfg.Log.Color cfg.WebDAV.Tracing.Enabled = false - cfg.WebDAV.HTTP.Addr = "localhost:9108" + cfg.WebDAV.HTTP.Addr = "localhost:9115" cfg.WebDAV.HTTP.Root = "/" return cfg.WebDAV From 88821244cb10e6dad8051e89b80724f8d5dcfe6c Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 13:09:49 +0100 Subject: [PATCH 15/16] added info flag --- pkg/command/graph.go | 3 ++- pkg/command/hello.go | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/command/graph.go b/pkg/command/graph.go index 8e1e85b000..2e930ae2fd 100644 --- a/pkg/command/graph.go +++ b/pkg/command/graph.go @@ -57,7 +57,8 @@ func GraphHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, gr.Add(func() error { return server.Run() }, func(err error) { - logger.Err(err). + logger.Info(). + Err(err). Str("transport", "http"). Msg("Shutting down server") diff --git a/pkg/command/hello.go b/pkg/command/hello.go index 42d63c5730..a48890a9b8 100644 --- a/pkg/command/hello.go +++ b/pkg/command/hello.go @@ -47,7 +47,8 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, ) if err != nil { - logger.Err(err). + logger.Info(). + Err(err). Str("transport", "http"). Msg("Failed to initialize server") @@ -57,7 +58,8 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, gr.Add(func() error { return server.Run() }, func(err error) { - logger.Err(err). + logger.Info(). + Err(err). Str("transport", "http"). Msg("Shutting down server") @@ -74,7 +76,8 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, ) if err != nil { - logger.Err(err). + logger.Info(). + Err(err). Str("transport", "grpc"). Msg("Failed to initialize server") From b1d041fcb165d4cf14b49aba23a2927da10188e7 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 13 Dec 2019 16:27:56 +0100 Subject: [PATCH 16/16] remove err printing --- pkg/command/hello.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/command/hello.go b/pkg/command/hello.go index a48890a9b8..c8d33a455f 100644 --- a/pkg/command/hello.go +++ b/pkg/command/hello.go @@ -57,9 +57,8 @@ func HelloHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, gr.Add(func() error { return server.Run() - }, func(err error) { + }, func(_ error) { logger.Info(). - Err(err). Str("transport", "http"). Msg("Shutting down server")