diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e238b71..c7ddfc8d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ * Change - Properly style konnectd consent page: [#754](https://github.com/owncloud/ocis/pull/754) * Change - Move the indexer package from ocis/accounts to ocis/ocis-pkg: [#794](https://github.com/owncloud/ocis/pull/794) * Change - Switch over to a new custom-built runtime: [#287](https://github.com/owncloud/ocis/pull/287) +* Change - Move ocis default config to root level: [#842](https://github.com/owncloud/ocis/pull/842) * Change - Remove username field in OCS: [#709](https://github.com/owncloud/ocis/pull/709) * Change - Account management permissions for Admin role: [#124](https://github.com/owncloud/product/issues/124) * Change - Update phoenix to v0.18.0: [#651](https://github.com/owncloud/ocis/pull/651) @@ -61,6 +62,7 @@ * Enhancement - Add the thumbnails service: [#244](https://github.com/owncloud/product/issues/244) * Enhancement - Add a command to list the versions of running instances: [#226](https://github.com/owncloud/product/issues/226) * Enhancement - Add the webdav service: [#244](https://github.com/owncloud/product/issues/244) +* Enhancement - Better adopt Go-Micro: [#840](https://github.com/owncloud/ocis/pull/840) * Enhancement - Add glauth fallback backend: [#649](https://github.com/owncloud/ocis/pull/649) * Enhancement - Launch a storage to store ocis-metadata: [#602](https://github.com/owncloud/ocis/pull/602) * Enhancement - Simplify tracing config: [#92](https://github.com/owncloud/product/issues/92) @@ -332,6 +334,17 @@ https://github.com/owncloud/ocis/pull/287 +* Change - Move ocis default config to root level: [#842](https://github.com/owncloud/ocis/pull/842) + + Tags: ocis + + We moved the tracing config to the `root` flagset so that they are parsed on all commands. We also + introduced a `JWTSecret` flag in the root flagset, in order to apply a common default JWTSecret + to all services that have one. + + https://github.com/owncloud/ocis/pull/842 + https://github.com/owncloud/ocis/pull/843 + * Change - Remove username field in OCS: [#709](https://github.com/owncloud/ocis/pull/709) Tags: ocs @@ -1479,6 +1492,26 @@ https://github.com/owncloud/product/issues/244 +* Enhancement - Better adopt Go-Micro: [#840](https://github.com/owncloud/ocis/pull/840) + + Tags: ocis + + There are a few building blocks that we were relying on default behavior, such as + `micro.Registry` and the go-micro client. In order for oCIS to work in any environment and not + relying in black magic configuration or running daemons we need to be able to: + + - Provide with a configurable go-micro registry. - Use our own go-micro client adjusted to our + own needs (i.e: custom timeout, custom dial timeout, custom transport...) + + This PR is relying on 2 env variables from Micro: `MICRO_REGISTRY` and + `MICRO_REGISTRY_ADDRESS`. The latter does not make sense to provide if the registry is not + `etcd`. + + The current implementation only accounts for `mdns` and `etcd` registries, defaulting to + `mdns` when not explicitly defined to use `etcd`. + + https://github.com/owncloud/ocis/pull/840 + * Enhancement - Add glauth fallback backend: [#649](https://github.com/owncloud/ocis/pull/649) We introduced the `fallback-datastore` config option and the corresponding options to allow diff --git a/accounts/pkg/command/version.go b/accounts/pkg/command/version.go index 0705b40a6..f5d222840 100644 --- a/accounts/pkg/command/version.go +++ b/accounts/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/accounts/pkg/config" "github.com/owncloud/ocis/accounts/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListAccountsWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Server.Name) if err != nil { fmt.Println(fmt.Errorf("could not get accounts services from the registry: %v", err)) diff --git a/accounts/pkg/service/v0/permissions.go b/accounts/pkg/service/v0/permissions.go index 62c5668d6..177bb5faa 100644 --- a/accounts/pkg/service/v0/permissions.go +++ b/accounts/pkg/service/v0/permissions.go @@ -3,7 +3,8 @@ package service import ( "context" - mclient "github.com/micro/go-micro/v2/client" + "github.com/owncloud/ocis/ocis-pkg/service/grpc" + olog "github.com/owncloud/ocis/ocis-pkg/log" settings "github.com/owncloud/ocis/settings/pkg/proto/v0" ssvc "github.com/owncloud/ocis/settings/pkg/service/v0" @@ -26,9 +27,7 @@ const ( // RegisterPermissions registers permissions for account management and group management with the settings service. func RegisterPermissions(l *olog.Logger) { - // TODO this won't work with a registry other than mdns. Look into Micro's client initialization. - // https://github.com/owncloud/ocis-proxy/issues/38 - service := settings.NewBundleService("com.owncloud.api.settings", mclient.DefaultClient) + service := settings.NewBundleService("com.owncloud.api.settings", grpc.DefaultClient) permissionRequests := generateAccountManagementPermissionsRequests() for i := range permissionRequests { diff --git a/accounts/pkg/service/v0/service.go b/accounts/pkg/service/v0/service.go index 889be2536..5896f50c1 100644 --- a/accounts/pkg/service/v0/service.go +++ b/accounts/pkg/service/v0/service.go @@ -9,12 +9,13 @@ import ( "strings" "time" + "github.com/owncloud/ocis/ocis-pkg/service/grpc" + "github.com/owncloud/ocis/accounts/pkg/storage" "github.com/owncloud/ocis/ocis-pkg/indexer" idxcfg "github.com/owncloud/ocis/ocis-pkg/indexer/config" idxerrs "github.com/owncloud/ocis/ocis-pkg/indexer/errors" - mclient "github.com/micro/go-micro/v2/client" "github.com/owncloud/ocis/accounts/pkg/config" "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/owncloud/ocis/ocis-pkg/log" @@ -34,9 +35,7 @@ func New(opts ...Option) (s *Service, err error) { roleService := options.RoleService if roleService == nil { - // https://github.com/owncloud/ocis-proxy/issues/38 - // TODO this won't work with a registry other than mdns. Look into Micro's client initialization. - roleService = settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient) + roleService = settings.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient) } roleManager := options.RoleManager if roleManager == nil { diff --git a/accounts/pkg/service/v0/settings.go b/accounts/pkg/service/v0/settings.go index c2c2990c5..339a7f725 100644 --- a/accounts/pkg/service/v0/settings.go +++ b/accounts/pkg/service/v0/settings.go @@ -3,8 +3,8 @@ package service import ( "context" - mclient "github.com/micro/go-micro/v2/client" olog "github.com/owncloud/ocis/ocis-pkg/log" + "github.com/owncloud/ocis/ocis-pkg/service/grpc" settings "github.com/owncloud/ocis/settings/pkg/proto/v0" ssvc "github.com/owncloud/ocis/settings/pkg/service/v0" ) @@ -15,9 +15,7 @@ const ( // RegisterSettingsBundles pushes the settings bundle definitions for this extension to the ocis-settings service. func RegisterSettingsBundles(l *olog.Logger) { - // TODO this won't work with a registry other than mdns. Look into Micro's client initialization. - // https://github.com/owncloud/ocis-proxy/issues/38 - service := settings.NewBundleService("com.owncloud.api.settings", mclient.DefaultClient) + service := settings.NewBundleService("com.owncloud.api.settings", grpc.DefaultClient) bundleRequests := []settings.SaveBundleRequest{ generateBundleProfileRequest(), diff --git a/changelog/unreleased/better-go-micro-adoption.md b/changelog/unreleased/better-go-micro-adoption.md new file mode 100644 index 000000000..733d602cd --- /dev/null +++ b/changelog/unreleased/better-go-micro-adoption.md @@ -0,0 +1,14 @@ +Enhancement: Better adopt Go-Micro + +Tags: ocis + +There are a few building blocks that we were relying on default behavior, such as `micro.Registry` and the go-micro client. In order for oCIS to work in any environment and not relying in black magic configuration or running daemons we need to be able to: + +- Provide with a configurable go-micro registry. +- Use our own go-micro client adjusted to our own needs (i.e: custom timeout, custom dial timeout, custom transport...) + +This PR is relying on 2 env variables from Micro: `MICRO_REGISTRY` and `MICRO_REGISTRY_ADDRESS`. The latter does not make sense to provide if the registry is not `etcd`. + +The current implementation only accounts for `mdns` and `etcd` registries, defaulting to `mdns` when not explicitly defined to use `etcd`. + +https://github.com/owncloud/ocis/pull/840 diff --git a/changelog/unreleased/ocis-root-config.md b/changelog/unreleased/ocis-root-config.md index 4261d2bd7..edc3032e0 100644 --- a/changelog/unreleased/ocis-root-config.md +++ b/changelog/unreleased/ocis-root-config.md @@ -5,3 +5,4 @@ Tags: ocis We moved the tracing config to the `root` flagset so that they are parsed on all commands. We also introduced a `JWTSecret` flag in the root flagset, in order to apply a common default JWTSecret to all services that have one. https://github.com/owncloud/ocis/pull/842 +https://github.com/owncloud/ocis/pull/843 diff --git a/glauth/pkg/command/server.go b/glauth/pkg/command/server.go index 674b4c8fd..38efbcc6f 100644 --- a/glauth/pkg/command/server.go +++ b/glauth/pkg/command/server.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "github.com/owncloud/ocis/ocis-pkg/service/grpc" + "github.com/owncloud/ocis/glauth/pkg/metrics" "github.com/owncloud/ocis/glauth/pkg/crypto" @@ -17,7 +19,6 @@ import ( glauthcfg "github.com/glauth/glauth/pkg/config" "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/client" "github.com/oklog/run" openzipkin "github.com/openzipkin/zipkin-go" zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http" @@ -76,7 +77,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) @@ -309,6 +312,6 @@ func Server(cfg *config.Config) *cli.Command { // getAccountsServices returns an ocis-accounts service func getAccountsServices() (accounts.AccountsService, accounts.GroupsService) { - return accounts.NewAccountsService("com.owncloud.api.accounts", client.DefaultClient), - accounts.NewGroupsService("com.owncloud.api.accounts", client.DefaultClient) + return accounts.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient), + accounts.NewGroupsService("com.owncloud.api.accounts", grpc.DefaultClient) } diff --git a/konnectd/pkg/command/server.go b/konnectd/pkg/command/server.go index d928ef3ff..a414f16df 100644 --- a/konnectd/pkg/command/server.go +++ b/konnectd/pkg/command/server.go @@ -81,7 +81,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/konnectd/pkg/command/version.go b/konnectd/pkg/command/version.go index 377b61120..72f6d4227 100644 --- a/konnectd/pkg/command/version.go +++ b/konnectd/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/konnectd/pkg/config" "github.com/owncloud/ocis/konnectd/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListKonnectdWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name) if err != nil { fmt.Println(fmt.Errorf("could not get konnectd services from the registry: %v", err)) diff --git a/ocis-phoenix/pkg/command/server.go b/ocis-phoenix/pkg/command/server.go index 56c9d706d..e08896d6c 100644 --- a/ocis-phoenix/pkg/command/server.go +++ b/ocis-phoenix/pkg/command/server.go @@ -70,7 +70,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/ocis-pkg/go.sum b/ocis-pkg/go.sum index 1dfcce536..5394dcde6 100644 --- a/ocis-pkg/go.sum +++ b/ocis-pkg/go.sum @@ -780,6 +780,8 @@ github.com/micro/cli/v2 v2.1.2 h1:43J1lChg/rZCC1rvdqZNFSQDrGT7qfMrtp6/ztpIkEM= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= +github.com/micro/go-plugins v1.5.1 h1:swcFD7ynCTUo98APqIEIbPu2XMd6yVGTnI8PqdnCwOQ= +github.com/micro/go-plugins/v2 v2.0.0 h1:QbzQBaOVNtAIhjTgtLoOHtlhcwNFbcJenEsT66IwpkQ= github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1 h1:IaZUsLp0Omb/ozDnRKEvVY56C0UocBdPxxg2S2Pk2j0= github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1/go.mod h1:26UmOLM/I487NqTg3n6zJiBrYmIb684M2Zp4WH98XzU= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= diff --git a/ocis-pkg/registry/registry.go b/ocis-pkg/registry/registry.go new file mode 100644 index 000000000..01d5ca15d --- /dev/null +++ b/ocis-pkg/registry/registry.go @@ -0,0 +1,35 @@ +package registry + +import ( + "os" + "strings" + + etcdr "github.com/micro/go-micro/v2/registry/etcd" + mdnsr "github.com/micro/go-micro/v2/registry/mdns" + + "github.com/micro/go-micro/v2/registry" +) + +var ( + registryEnv = "MICRO_REGISTRY" + registryAddressEnv = "MICRO_REGISTRY_ADDRESS" +) + +// GetRegistry returns a configured micro registry based on Micro env vars. +// It defaults to mDNS, so mind that systems with mDNS disabled by default (i.e SUSE) will have a hard time +// and it needs to explicitly use etcd. Os awareness for providing a working registry out of the box should be done. +func GetRegistry() *registry.Registry { + addresses := strings.Split(os.Getenv(registryAddressEnv), ",") + + var r registry.Registry + switch os.Getenv(registryEnv) { + case "etcd": + r = etcdr.NewRegistry( + registry.Addrs(addresses...), + ) + default: + r = mdnsr.NewRegistry() + } + + return &r +} diff --git a/ocis-pkg/service/grpc/service.go b/ocis-pkg/service/grpc/service.go index c50039fcc..522c91399 100644 --- a/ocis-pkg/service/grpc/service.go +++ b/ocis-pkg/service/grpc/service.go @@ -1,14 +1,42 @@ package grpc import ( + "os" "strings" "time" "github.com/micro/go-micro/v2" + mclient "github.com/micro/go-micro/v2/client" + "github.com/micro/go-micro/v2/client/grpc" + + etcdr "github.com/micro/go-micro/v2/registry/etcd" + mdnsr "github.com/micro/go-micro/v2/registry/mdns" + + "github.com/micro/go-micro/v2/registry" + "github.com/micro/go-plugins/wrapper/trace/opencensus/v2" "github.com/owncloud/ocis/ocis-pkg/wrapper/prometheus" ) +// DefaultClient is a custom ocis grpc configured client. +var DefaultClient = newGrpcClient() + +func newGrpcClient() mclient.Client { + var r registry.Registry + switch os.Getenv("MICRO_REGISTRY") { + case "etcd": + r = etcdr.NewRegistry() + default: + r = mdnsr.NewRegistry() + } + + c := grpc.NewClient( + mclient.RequestTimeout(10*time.Second), + mclient.Registry(r), + ) + return c +} + // Service simply wraps the go-micro grpc service. type Service struct { micro.Service @@ -33,6 +61,7 @@ func NewService(opts ...Option) Service { ".", ), ), + micro.Client(DefaultClient), micro.Version(sopts.Version), micro.Address(sopts.Address), micro.WrapHandler(prometheus.NewHandlerWrapper()), diff --git a/ocis/go.mod b/ocis/go.mod index 468bb869b..1078b7c9c 100644 --- a/ocis/go.mod +++ b/ocis/go.mod @@ -10,6 +10,7 @@ require ( github.com/go-test/deep v1.0.6 // indirect github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect github.com/micro/cli/v2 v2.1.2 + github.com/micro/go-micro/v2 v2.9.1 github.com/micro/micro/v2 v2.8.0 github.com/openzipkin/zipkin-go v0.2.5 github.com/owncloud/flaex v0.2.0 diff --git a/ocis/go.sum b/ocis/go.sum index 6601e2e48..30139355e 100644 --- a/ocis/go.sum +++ b/ocis/go.sum @@ -189,6 +189,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/cheggaaa/pb v1.0.28/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= @@ -381,6 +382,7 @@ github.com/go-ldap/ldap/v3 v3.1.7/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd github.com/go-ldap/ldap/v3 v3.2.3/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg= github.com/go-ldap/ldap/v3 v3.2.4 h1:PFavAq2xTgzo/loE8qNXcQaofAaqIpI4WgaLdv+1l3E= github.com/go-ldap/ldap/v3 v3.2.4/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg= +github.com/go-log/log v0.1.0 h1:wudGTNsiGzrD5ZjgIkVZ517ugi2XRe9Q/xRCzwEO4/U= github.com/go-log/log v0.1.0/go.mod h1:4mBwpdRMFLiuXZDCwU2lKQFsoSCo72j3HqBK9d81N2M= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= @@ -830,6 +832,7 @@ github.com/longsleep/go-metrics v0.0.0-20191013204616-cddea569b0ea h1:Q5nKuCPF/m github.com/longsleep/go-metrics v0.0.0-20191013204616-cddea569b0ea/go.mod h1:w6QO1LBkVla70FZrrF6XcB0YN+jTEYugjkn3+6RYTSM= github.com/lucas-clemente/quic-go v0.12.1/go.mod h1:UXJJPE4RfFef/xPO5wQm0tITK8gNfqwTxjbE7s3Vb8s= github.com/lucas-clemente/quic-go v0.13.1/go.mod h1:Vn3/Fb0/77b02SGhQk36KzOUmXgVpFfizUfW5WMaqyU= +github.com/lucas-clemente/quic-go v0.14.1 h1:c1aKoBZKOPA+49q96B1wGkibyPP0AxYh45WuAoq+87E= github.com/lucas-clemente/quic-go v0.14.1/go.mod h1:Vn3/Fb0/77b02SGhQk36KzOUmXgVpFfizUfW5WMaqyU= github.com/luna-duclos/instrumentedsql v1.1.2/go.mod h1:4LGbEqDnopzNAiyxPPDXhLspyunZxgPTMJBKtC6U0BQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -853,9 +856,11 @@ github.com/markbates/safe v1.0.0/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kN github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/markbates/sigtx v1.0.0/go.mod h1:QF1Hv6Ic6Ca6W+T+DL0Y/ypborFKyvUY9HmuCD4VeTc= github.com/markbates/willie v1.0.9/go.mod h1:fsrFVWl91+gXpx/6dv715j7i11fYPfZ9ZGfH0DQzY7w= +github.com/marten-seemann/chacha20 v0.2.0 h1:f40vqzzx+3GdOmzQoItkLX5WLvHgPgyYqFFIO5Gh4hQ= github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= github.com/marten-seemann/qtls v0.3.2/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= +github.com/marten-seemann/qtls v0.4.1 h1:YlT8QP3WCCvvok7MGEZkMldXbyqgr8oFg5/n8Gtbkks= github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -912,6 +917,7 @@ github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUM github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.0.1/go.mod h1:QrkcwcDtIs2hIJpIEhozekyf6Rfz5C36kFI8+zzCpX0= github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1 h1:IaZUsLp0Omb/ozDnRKEvVY56C0UocBdPxxg2S2Pk2j0= github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1/go.mod h1:26UmOLM/I487NqTg3n6zJiBrYmIb684M2Zp4WH98XzU= +github.com/micro/mdns v0.3.0 h1:bYycYe+98AXR3s8Nq5qvt6C573uFTDPIYzJemWON0QE= github.com/micro/mdns v0.3.0/go.mod h1:KJ0dW7KmicXU2BV++qkLlmHYcVv7/hHnbtguSWt9Aoc= github.com/micro/micro/v2 v2.8.0 h1:AMqpnKsOBnuGHjU0jVmTL17BRdsOx0FbvI/Gkl2uLrA= github.com/micro/micro/v2 v2.8.0/go.mod h1:VTIGqEBLAMh22q72DnGd95iJSQY/3yvXd9GIIooQ69c= @@ -1045,6 +1051,7 @@ github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnh github.com/ory/fosite v0.29.0/go.mod h1:0atSZmXO7CAcs6NPMI/Qtot8tmZYj04Nddoold4S2h0= github.com/ory/fosite v0.30.2/go.mod h1:Lq9qQ9Sl6mcea2Tt8J7PU+wUeFYPZ+vg7N3zPVKGbN8= github.com/ory/fosite v0.32.2/go.mod h1:UeBhRgW6nAjTcd8S7kAo0IFsY/rTPyOXPq/t8N20Q8I= +github.com/ory/fosite v0.35.0/go.mod h1:h+ize9gk0GvRyGjabriqSEmTkMhny+O95cijb8DVqPE= github.com/ory/fosite v0.35.1 h1:mGPcwVGwHA7Yy9wr/7LDps6BEXyavL32NxizL9eH53Q= github.com/ory/fosite v0.35.1/go.mod h1:h+ize9gk0GvRyGjabriqSEmTkMhny+O95cijb8DVqPE= github.com/ory/go-acc v0.0.0-20181118080137-ddc355013f90/go.mod h1:sxnvPCxChFuSmTJGj8FdMupeq1BezCiEpDjTUXQ4hf4= diff --git a/ocis/pkg/command/glauth.go b/ocis/pkg/command/glauth.go index 9e1167f78..e891ff3cb 100644 --- a/ocis/pkg/command/glauth.go +++ b/ocis/pkg/command/glauth.go @@ -43,7 +43,6 @@ func configureGLAuth(cfg *config.Config) *svcconfig.Config { cfg.GLAuth.Tracing.Type = cfg.Tracing.Type cfg.GLAuth.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.GLAuth.Tracing.Collector = cfg.Tracing.Collector - cfg.GLAuth.Tracing.Service = cfg.Tracing.Service } return cfg.GLAuth diff --git a/ocis/pkg/command/konnectd.go b/ocis/pkg/command/konnectd.go index 83cc60155..0cec0a7dd 100644 --- a/ocis/pkg/command/konnectd.go +++ b/ocis/pkg/command/konnectd.go @@ -44,7 +44,6 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config { cfg.Konnectd.Tracing.Type = cfg.Tracing.Type cfg.Konnectd.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Konnectd.Tracing.Collector = cfg.Tracing.Collector - cfg.Konnectd.Tracing.Service = cfg.Tracing.Service } return cfg.Konnectd diff --git a/ocis/pkg/command/ocs.go b/ocis/pkg/command/ocs.go index 8209162ec..fdf7510a9 100644 --- a/ocis/pkg/command/ocs.go +++ b/ocis/pkg/command/ocs.go @@ -45,7 +45,6 @@ func configureOCS(cfg *config.Config) *svcconfig.Config { cfg.OCS.Tracing.Type = cfg.Tracing.Type cfg.OCS.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.OCS.Tracing.Collector = cfg.Tracing.Collector - cfg.OCS.Tracing.Service = cfg.Tracing.Service } if cfg.TokenManager.JWTSecret != "" { diff --git a/ocis/pkg/command/phoenix.go b/ocis/pkg/command/phoenix.go index 07936df4f..faac073ff 100644 --- a/ocis/pkg/command/phoenix.go +++ b/ocis/pkg/command/phoenix.go @@ -47,7 +47,6 @@ func configurePhoenix(cfg *config.Config) *config.Config { cfg.Phoenix.Tracing.Type = cfg.Tracing.Type cfg.Phoenix.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Phoenix.Tracing.Collector = cfg.Tracing.Collector - cfg.Phoenix.Tracing.Service = cfg.Tracing.Service } return cfg diff --git a/ocis/pkg/command/proxy.go b/ocis/pkg/command/proxy.go index 4c19599b4..4957bc88b 100644 --- a/ocis/pkg/command/proxy.go +++ b/ocis/pkg/command/proxy.go @@ -45,7 +45,6 @@ func configureProxy(cfg *config.Config) *svcconfig.Config { cfg.Proxy.Tracing.Type = cfg.Tracing.Type cfg.Proxy.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Proxy.Tracing.Collector = cfg.Tracing.Collector - cfg.Proxy.Tracing.Service = cfg.Tracing.Service } if cfg.TokenManager.JWTSecret != "" { diff --git a/ocis/pkg/command/root.go b/ocis/pkg/command/root.go index 480748015..f2a109fe5 100644 --- a/ocis/pkg/command/root.go +++ b/ocis/pkg/command/root.go @@ -4,8 +4,13 @@ import ( "os" "strings" + "github.com/owncloud/ocis/ocis-pkg/registry" + + "github.com/micro/go-micro/v2" + "github.com/micro/cli/v2" "github.com/owncloud/ocis/ocis-pkg/log" + "github.com/owncloud/ocis/ocis/pkg/config" "github.com/owncloud/ocis/ocis/pkg/flagset" "github.com/owncloud/ocis/ocis/pkg/register" @@ -14,7 +19,7 @@ import ( "github.com/spf13/viper" ) -// Execute is the entry point for the ocis-ocis command. +// Execute is the entry point for the ocis command. func Execute() error { cfg := config.New() @@ -44,7 +49,13 @@ func Execute() error { ) } - runtime.AddMicroPlatform(app) + r := *registry.GetRegistry() + + opts := micro.Options{ + Registry: r, + } + + runtime.AddMicroPlatform(app, opts) cli.HelpFlag = &cli.BoolFlag{ Name: "help,h", diff --git a/ocis/pkg/command/server.go b/ocis/pkg/command/server.go index 20927e3f9..1c23680b8 100644 --- a/ocis/pkg/command/server.go +++ b/ocis/pkg/command/server.go @@ -32,7 +32,7 @@ func Server(cfg *config.Config) *cli.Command { return err } - r := runtime.New() + r := runtime.New(cfg) return r.Start() }, } diff --git a/ocis/pkg/command/settings.go b/ocis/pkg/command/settings.go index dd16225e6..6183a9cd3 100644 --- a/ocis/pkg/command/settings.go +++ b/ocis/pkg/command/settings.go @@ -45,7 +45,6 @@ func configureSettings(cfg *config.Config) *svcconfig.Config { cfg.Settings.Tracing.Type = cfg.Tracing.Type cfg.Settings.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Settings.Tracing.Collector = cfg.Tracing.Collector - cfg.Settings.Tracing.Service = cfg.Tracing.Service } if cfg.TokenManager.JWTSecret != "" { diff --git a/ocis/pkg/command/storageauthbasic.go b/ocis/pkg/command/storageauthbasic.go index a2f7fb590..29e7473bd 100644 --- a/ocis/pkg/command/storageauthbasic.go +++ b/ocis/pkg/command/storageauthbasic.go @@ -39,7 +39,6 @@ func configureStorageAuthBasic(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storageauthbearer.go b/ocis/pkg/command/storageauthbearer.go index a1c2cfd96..7d1c9a719 100644 --- a/ocis/pkg/command/storageauthbearer.go +++ b/ocis/pkg/command/storageauthbearer.go @@ -4,11 +4,11 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/storage/pkg/command" svcconfig "github.com/owncloud/ocis/storage/pkg/config" "github.com/owncloud/ocis/storage/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" ) // StorageAuthBearerCommand is the entrypoint for the reva-auth-bearer command. @@ -39,7 +39,6 @@ func configureStorageAuthBearer(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storagefrontend.go b/ocis/pkg/command/storagefrontend.go index 699abb4d0..5b7296d27 100644 --- a/ocis/pkg/command/storagefrontend.go +++ b/ocis/pkg/command/storagefrontend.go @@ -4,11 +4,11 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/storage/pkg/command" svcconfig "github.com/owncloud/ocis/storage/pkg/config" "github.com/owncloud/ocis/storage/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" ) // StorageFrontendCommand is the entrypoint for the reva-frontend command. @@ -39,7 +39,6 @@ func configureStorageFrontend(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storagegateway.go b/ocis/pkg/command/storagegateway.go index ad120a62e..e07c5da03 100644 --- a/ocis/pkg/command/storagegateway.go +++ b/ocis/pkg/command/storagegateway.go @@ -4,11 +4,11 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/storage/pkg/command" svcconfig "github.com/owncloud/ocis/storage/pkg/config" "github.com/owncloud/ocis/storage/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" ) // StorageGatewayCommand is the entrypoint for the reva-gateway command. @@ -39,7 +39,6 @@ func configureStorageGateway(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storagehome.go b/ocis/pkg/command/storagehome.go index a8552ea45..819416bfa 100644 --- a/ocis/pkg/command/storagehome.go +++ b/ocis/pkg/command/storagehome.go @@ -39,7 +39,6 @@ func configureStorageHome(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storagemetadata.go b/ocis/pkg/command/storagemetadata.go index 3bda90839..3f8df079e 100644 --- a/ocis/pkg/command/storagemetadata.go +++ b/ocis/pkg/command/storagemetadata.go @@ -38,7 +38,6 @@ func configureStorageMetadata(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storagepubliclink.go b/ocis/pkg/command/storagepubliclink.go index b535f6dc1..dddf2cbe6 100644 --- a/ocis/pkg/command/storagepubliclink.go +++ b/ocis/pkg/command/storagepubliclink.go @@ -39,7 +39,6 @@ func configureStoragePublicLink(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storagesharing.go b/ocis/pkg/command/storagesharing.go index 1b3dd60c3..8fbb7db11 100644 --- a/ocis/pkg/command/storagesharing.go +++ b/ocis/pkg/command/storagesharing.go @@ -4,11 +4,11 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/storage/pkg/command" svcconfig "github.com/owncloud/ocis/storage/pkg/config" "github.com/owncloud/ocis/storage/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" ) // StorageSharingCommand is the entrypoint for the reva-sharing command. @@ -39,7 +39,6 @@ func configureStorageSharing(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storageuserprovider.go b/ocis/pkg/command/storageuserprovider.go index c631a5cec..74062bd21 100644 --- a/ocis/pkg/command/storageuserprovider.go +++ b/ocis/pkg/command/storageuserprovider.go @@ -39,7 +39,6 @@ func configureStorageUserProvider(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/storageusers.go b/ocis/pkg/command/storageusers.go index ca7458f5a..1427fcefd 100644 --- a/ocis/pkg/command/storageusers.go +++ b/ocis/pkg/command/storageusers.go @@ -39,7 +39,6 @@ func configureStorageUsers(cfg *config.Config) *svcconfig.Config { cfg.Storage.Tracing.Type = cfg.Tracing.Type cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Storage.Tracing.Collector = cfg.Tracing.Collector - cfg.Storage.Tracing.Service = cfg.Tracing.Service } return cfg.Storage diff --git a/ocis/pkg/command/store.go b/ocis/pkg/command/store.go index 0e22742ed..eda6edd4f 100644 --- a/ocis/pkg/command/store.go +++ b/ocis/pkg/command/store.go @@ -4,12 +4,12 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/version" "github.com/owncloud/ocis/store/pkg/command" svcconfig "github.com/owncloud/ocis/store/pkg/config" "github.com/owncloud/ocis/store/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" ) // StoreCommand is the entrypoint for the ocs command. @@ -45,7 +45,6 @@ func configureStore(cfg *config.Config) *svcconfig.Config { cfg.Store.Tracing.Type = cfg.Tracing.Type cfg.Store.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Store.Tracing.Collector = cfg.Tracing.Collector - cfg.Store.Tracing.Service = cfg.Tracing.Service } return cfg.Store diff --git a/ocis/pkg/command/thumbnails.go b/ocis/pkg/command/thumbnails.go index b3788952d..097189d3b 100644 --- a/ocis/pkg/command/thumbnails.go +++ b/ocis/pkg/command/thumbnails.go @@ -4,11 +4,11 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/version" "github.com/owncloud/ocis/thumbnails/pkg/command" "github.com/owncloud/ocis/thumbnails/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" svcconfig "github.com/owncloud/ocis/thumbnails/pkg/config" ) @@ -46,7 +46,6 @@ func configureThumbnails(cfg *config.Config) *svcconfig.Config { cfg.Thumbnails.Tracing.Type = cfg.Tracing.Type cfg.Thumbnails.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.Thumbnails.Tracing.Collector = cfg.Tracing.Collector - cfg.Thumbnails.Tracing.Service = cfg.Tracing.Service } return cfg.Thumbnails diff --git a/ocis/pkg/command/webdav.go b/ocis/pkg/command/webdav.go index 91f309475..2595318a2 100644 --- a/ocis/pkg/command/webdav.go +++ b/ocis/pkg/command/webdav.go @@ -4,12 +4,12 @@ package command import ( "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + "github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/version" "github.com/owncloud/ocis/webdav/pkg/command" svcconfig "github.com/owncloud/ocis/webdav/pkg/config" "github.com/owncloud/ocis/webdav/pkg/flagset" - "github.com/owncloud/ocis/ocis/pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" ) // WebDAVCommand is the entrypoint for the webdav command. @@ -19,7 +19,7 @@ func WebDAVCommand(cfg *config.Config) *cli.Command { Usage: "Start webdav server", Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.WebDAV), - Subcommands: []*cli.Command { + Subcommands: []*cli.Command{ command.PrintVersion(cfg.WebDAV), }, Action: func(c *cli.Context) error { @@ -45,7 +45,6 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config { cfg.WebDAV.Tracing.Type = cfg.Tracing.Type cfg.WebDAV.Tracing.Endpoint = cfg.Tracing.Endpoint cfg.WebDAV.Tracing.Collector = cfg.Tracing.Collector - cfg.WebDAV.Tracing.Service = cfg.Tracing.Service } return cfg.WebDAV diff --git a/ocis/pkg/config/config.go b/ocis/pkg/config/config.go index fa32ad29f..bf8f96c42 100644 --- a/ocis/pkg/config/config.go +++ b/ocis/pkg/config/config.go @@ -61,6 +61,7 @@ type TokenManager struct { // Config combines all available configuration parts. type Config struct { File string + Registry string Log Log Debug Debug HTTP HTTP diff --git a/ocis/pkg/runtime/runtime.go b/ocis/pkg/runtime/runtime.go index 390250031..0db846874 100644 --- a/ocis/pkg/runtime/runtime.go +++ b/ocis/pkg/runtime/runtime.go @@ -7,6 +7,9 @@ import ( "os" "time" + "github.com/micro/go-micro/v2" + "github.com/owncloud/ocis/ocis/pkg/config" + cli "github.com/micro/cli/v2" "github.com/micro/micro/v2/client/api" @@ -63,11 +66,15 @@ var ( ) // Runtime represents an oCIS runtime environment. -type Runtime struct{} +type Runtime struct { + c *config.Config +} // New creates a new ocis + micro runtime -func New() Runtime { - return Runtime{} +func New(cfg *config.Config) Runtime { + return Runtime{ + c: cfg, + } } // Start rpc runtime @@ -129,12 +136,12 @@ func RunService(client *rpc.Client, service string) int { } // AddMicroPlatform adds the micro subcommands to the cli app -func AddMicroPlatform(app *cli.App) { +func AddMicroPlatform(app *cli.App, opts micro.Options) { setDefaults() - app.Commands = append(app.Commands, api.Commands()...) - app.Commands = append(app.Commands, web.Commands()...) - app.Commands = append(app.Commands, registry.Commands()...) + app.Commands = append(app.Commands, api.Commands(micro.Registry(opts.Registry))...) + app.Commands = append(app.Commands, web.Commands(micro.Registry(opts.Registry))...) + app.Commands = append(app.Commands, registry.Commands(micro.Registry(opts.Registry))...) } // provide a config.Config with default values? diff --git a/ocis/pkg/tracing/tracing.go b/ocis/pkg/tracing/tracing.go index ed0c63192..78f48aebd 100644 --- a/ocis/pkg/tracing/tracing.go +++ b/ocis/pkg/tracing/tracing.go @@ -45,7 +45,9 @@ func Start(cfg *config.Config) error { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/ocs/pkg/command/server.go b/ocs/pkg/command/server.go index 76e6b66ba..c2b01fcf6 100644 --- a/ocs/pkg/command/server.go +++ b/ocs/pkg/command/server.go @@ -66,7 +66,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/ocs/pkg/command/version.go b/ocs/pkg/command/version.go index 6f4eae487..b61419f92 100644 --- a/ocs/pkg/command/version.go +++ b/ocs/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/ocs/pkg/config" "github.com/owncloud/ocis/ocs/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListOcsWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name) if err != nil { fmt.Println(fmt.Errorf("could not get ocs services from the registry: %v", err)) diff --git a/ocs/pkg/service/v0/service.go b/ocs/pkg/service/v0/service.go index d1817b41d..3d9d0a1d7 100644 --- a/ocs/pkg/service/v0/service.go +++ b/ocs/pkg/service/v0/service.go @@ -8,8 +8,8 @@ import ( "github.com/go-chi/chi/middleware" "github.com/go-chi/render" "github.com/micro/go-micro/v2/client/grpc" + ogrpc "github.com/owncloud/ocis/ocis-pkg/service/grpc" - mclient "github.com/micro/go-micro/v2/client" accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/owncloud/ocis/ocis-pkg/account" "github.com/owncloud/ocis/ocis-pkg/log" @@ -39,9 +39,7 @@ func NewService(opts ...Option) Service { roleService := options.RoleService if roleService == nil { - // https://github.com/owncloud/ocis-proxy/issues/38 - // TODO this won't work with a registry other than mdns. Look into Micro's client initialization. - roleService = settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient) + roleService = settings.NewRoleService("com.owncloud.api.settings", ogrpc.DefaultClient) } roleManager := options.RoleManager if roleManager == nil { diff --git a/proxy/pkg/command/server.go b/proxy/pkg/command/server.go index 2d3e2c7d6..ddd24972a 100644 --- a/proxy/pkg/command/server.go +++ b/proxy/pkg/command/server.go @@ -15,13 +15,13 @@ import ( "github.com/coreos/go-oidc" "github.com/justinas/alice" "github.com/micro/cli/v2" - mclient "github.com/micro/go-micro/v2/client" "github.com/micro/go-micro/v2/client/grpc" "github.com/oklog/run" openzipkin "github.com/openzipkin/zipkin-go" zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http" acc "github.com/owncloud/ocis/accounts/pkg/proto/v0" "github.com/owncloud/ocis/ocis-pkg/log" + ogrpc "github.com/owncloud/ocis/ocis-pkg/service/grpc" "github.com/owncloud/ocis/proxy/pkg/config" "github.com/owncloud/ocis/proxy/pkg/cs3" "github.com/owncloud/ocis/proxy/pkg/flagset" @@ -83,7 +83,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) @@ -252,10 +254,8 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic middleware.PreSignedURLConfig(cfg.PreSignedURL), ) - // TODO this won't work with a registry other than mdns. Look into Micro's client initialization. - // https://github.com/owncloud/ocis/proxy/issues/38 - accounts := acc.NewAccountsService("com.owncloud.api.accounts", mclient.DefaultClient) - roles := settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient) + accounts := acc.NewAccountsService("com.owncloud.api.accounts", ogrpc.DefaultClient) + roles := settings.NewRoleService("com.owncloud.api.settings", ogrpc.DefaultClient) uuidMW := middleware.AccountUUID( middleware.Logger(l), diff --git a/proxy/pkg/command/version.go b/proxy/pkg/command/version.go index 58b9eecc4..f655589f2 100644 --- a/proxy/pkg/command/version.go +++ b/proxy/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/proxy/pkg/config" "github.com/owncloud/ocis/proxy/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListProxyWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name) if err != nil { fmt.Println(fmt.Errorf("could not get proxy services from the registry: %v", err)) diff --git a/settings/pkg/command/server.go b/settings/pkg/command/server.go index 8f7774e92..bba330480 100644 --- a/settings/pkg/command/server.go +++ b/settings/pkg/command/server.go @@ -70,7 +70,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/settings/pkg/command/version.go b/settings/pkg/command/version.go index f5a992669..3d3f15e72 100644 --- a/settings/pkg/command/version.go +++ b/settings/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/settings/pkg/config" "github.com/owncloud/ocis/settings/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListSettingsWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Service.Name) if err != nil { fmt.Println(fmt.Errorf("could not get settings services from the registry: %v", err)) diff --git a/storage/go.mod b/storage/go.mod index bf0fe4bdc..6a7f9ff16 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -14,4 +14,7 @@ require ( github.com/spf13/viper v1.7.0 ) -replace github.com/owncloud/ocis/ocis-pkg => ../ocis-pkg +replace ( + github.com/owncloud/ocis/ocis-pkg => ../ocis-pkg + google.golang.org/grpc => google.golang.org/grpc v1.26.0 +) diff --git a/storage/go.sum b/storage/go.sum index c4105a05a..04a788299 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -168,6 +168,7 @@ github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkE github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.18+incompatible h1:Zz1aXgDrFFi1nadh58tA9ktt06cmPTwNNP3dXwIq1lE= github.com/coreos/etcd v3.3.18+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-oidc v2.2.1+incompatible h1:mh48q/BqXqgjVHpy2ZY7WnWAbenxRjsz9N1i1YxjHAk= @@ -175,7 +176,9 @@ github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHo github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= @@ -460,6 +463,7 @@ github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang/gddo v0.0.0-20180828051604-96d2a289f41e/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4= @@ -506,6 +510,7 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -531,6 +536,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1 github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw= github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= 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= @@ -742,6 +748,7 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= +github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y= github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -1074,12 +1081,16 @@ go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +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/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.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180830192347-182538f80094/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1448,6 +1459,7 @@ google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= diff --git a/storage/pkg/service/external/external.go b/storage/pkg/service/external/external.go index 9238d3b1b..8990b4de6 100644 --- a/storage/pkg/service/external/external.go +++ b/storage/pkg/service/external/external.go @@ -7,6 +7,7 @@ import ( "github.com/micro/go-micro/v2/broker" "github.com/micro/go-micro/v2/registry" "github.com/owncloud/ocis/ocis-pkg/log" + oregistry "github.com/owncloud/ocis/ocis-pkg/registry" ) // RegisterGRPCEndpoint publishes an arbitrary endpoint to the service-registry. This allows to query nodes of @@ -24,6 +25,8 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log node.Metadata["transport"] = "grpc" node.Metadata["protocol"] = "grpc" + r := *oregistry.GetRegistry() + service := ®istry.Service{ Name: serviceID, Version: "", @@ -31,11 +34,10 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log Endpoints: make([]*registry.Endpoint, 0), } - rOpts := []registry.RegisterOption{registry.RegisterTTL(time.Minute)} - logger.Info().Msgf("registering external service %v@%v", node.Id, node.Address) - if err := registry.Register(service, rOpts...); err != nil { + rOpts := []registry.RegisterOption{registry.RegisterTTL(time.Minute)} + if err := r.Register(service, rOpts...); err != nil { logger.Fatal().Err(err).Msgf("Registration error for external service %v", serviceID) } diff --git a/store/pkg/command/server.go b/store/pkg/command/server.go index 261c6dc06..c693d47fa 100644 --- a/store/pkg/command/server.go +++ b/store/pkg/command/server.go @@ -64,7 +64,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/store/pkg/command/version.go b/store/pkg/command/version.go index 0e90015aa..ff2334265 100644 --- a/store/pkg/command/version.go +++ b/store/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/store/pkg/config" "github.com/owncloud/ocis/store/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListStoreWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name) if err != nil { fmt.Println(fmt.Errorf("could not get store services from the registry: %v", err)) diff --git a/thumbnails/pkg/command/server.go b/thumbnails/pkg/command/server.go index b5fc0f7af..801a7c219 100644 --- a/thumbnails/pkg/command/server.go +++ b/thumbnails/pkg/command/server.go @@ -63,7 +63,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/thumbnails/pkg/command/version.go b/thumbnails/pkg/command/version.go index 511e52d26..3a17e44b7 100644 --- a/thumbnails/pkg/command/version.go +++ b/thumbnails/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/thumbnails/pkg/config" "github.com/owncloud/ocis/thumbnails/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListThumbnailsWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.Server.Namespace + "." + cfg.Server.Name) if err != nil { fmt.Println(fmt.Errorf("could not get thumbnails services from the registry: %v", err)) diff --git a/webdav/pkg/command/server.go b/webdav/pkg/command/server.go index 7218a98f9..cd3177abf 100644 --- a/webdav/pkg/command/server.go +++ b/webdav/pkg/command/server.go @@ -66,7 +66,9 @@ func Server(cfg *config.Config) *cli.Command { jaeger.Options{ AgentEndpoint: cfg.Tracing.Endpoint, CollectorEndpoint: cfg.Tracing.Collector, - ServiceName: cfg.Tracing.Service, + Process: jaeger.Process{ + ServiceName: cfg.Tracing.Service, + }, }, ) diff --git a/webdav/pkg/command/version.go b/webdav/pkg/command/version.go index 11e694d9e..a77dbe3fb 100644 --- a/webdav/pkg/command/version.go +++ b/webdav/pkg/command/version.go @@ -4,8 +4,9 @@ import ( "fmt" "os" + "github.com/owncloud/ocis/ocis-pkg/registry" + "github.com/micro/cli/v2" - "github.com/micro/go-micro/v2/registry/mdns" tw "github.com/olekukonko/tablewriter" "github.com/owncloud/ocis/webdav/pkg/config" "github.com/owncloud/ocis/webdav/pkg/flagset" @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command { Usage: "Print the versions of the running instances", Flags: flagset.ListWebdavWithConfig(cfg), Action: func(c *cli.Context) error { - reg := mdns.NewRegistry() + reg := *registry.GetRegistry() services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name) if err != nil { fmt.Println(fmt.Errorf("could not get webdav services from the registry: %v", err))