Merge pull request #9490 from owncloud/set-service-transport

set the configured protocol transport for service metadata
This commit is contained in:
Jörn Friedrich Dreyer
2024-08-26 12:06:08 +02:00
committed by GitHub
47 changed files with 158 additions and 68 deletions
@@ -0,0 +1,6 @@
Enhancement: We now set the configured protocol transport for service metadata
This allows configuring services to listan on `tcp` or `unix` sockets and clients to use the `dns`, `kubernetes` or `unix` protocol URIs instead of service names.
https://github.com/owncloud/ocis/pull/9490
https://github.com/cs3org/reva/pull/4744
+1
View File
@@ -67,6 +67,7 @@ type Config struct {
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
GRPCServiceTLS *shared.GRPCServiceTLS `yaml:"grpc_service_tls"` GRPCServiceTLS *shared.GRPCServiceTLS `yaml:"grpc_service_tls"`
HTTPServiceTLS shared.HTTPServiceTLS `yaml:"http_service_tls"` HTTPServiceTLS shared.HTTPServiceTLS `yaml:"http_service_tls"`
Reva *shared.Reva `yaml:"reva"`
Mode Mode // DEPRECATED Mode Mode // DEPRECATED
File string File string
+4
View File
@@ -1,6 +1,7 @@
package config package config
import ( import (
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
activitylog "github.com/owncloud/ocis/v2/services/activitylog/pkg/config/defaults" activitylog "github.com/owncloud/ocis/v2/services/activitylog/pkg/config/defaults"
antivirus "github.com/owncloud/ocis/v2/services/antivirus/pkg/config/defaults" antivirus "github.com/owncloud/ocis/v2/services/antivirus/pkg/config/defaults"
appProvider "github.com/owncloud/ocis/v2/services/app-provider/pkg/config/defaults" appProvider "github.com/owncloud/ocis/v2/services/app-provider/pkg/config/defaults"
@@ -52,6 +53,9 @@ func DefaultConfig() *Config {
Port: "9250", Port: "9250",
Host: "localhost", Host: "localhost",
}, },
Reva: &shared.Reva{
Address: "com.owncloud.api.gateway",
},
Activitylog: activitylog.DefaultConfig(), Activitylog: activitylog.DefaultConfig(),
Antivirus: antivirus.DefaultConfig(), Antivirus: antivirus.DefaultConfig(),
+5 -1
View File
@@ -58,7 +58,9 @@ func EnsureDefaults(cfg *config.Config) {
if cfg.GRPCServiceTLS == nil { if cfg.GRPCServiceTLS == nil {
cfg.GRPCServiceTLS = &shared.GRPCServiceTLS{} cfg.GRPCServiceTLS = &shared.GRPCServiceTLS{}
} }
if cfg.Reva == nil {
cfg.Reva = &shared.Reva{}
}
} }
// EnsureCommons copies applicable parts of the oCIS config into the commons part // EnsureCommons copies applicable parts of the oCIS config into the commons part
@@ -111,6 +113,8 @@ func EnsureCommons(cfg *config.Config) {
if cfg.OcisURL != "" { if cfg.OcisURL != "" {
cfg.Commons.OcisURL = cfg.OcisURL cfg.Commons.OcisURL = cfg.OcisURL
} }
cfg.Commons.Reva = structs.CopyOrZeroValue(cfg.Reva)
} }
// Validate checks that all required configs are set. If a required config value // Validate checks that all required configs are set. If a required config value
+13 -8
View File
@@ -8,10 +8,10 @@ import (
mRegistry "go-micro.dev/v4/registry" mRegistry "go-micro.dev/v4/registry"
"go-micro.dev/v4/server" "go-micro.dev/v4/server"
"go-micro.dev/v4/util/addr" mAddr "go-micro.dev/v4/util/addr"
) )
func BuildGRPCService(serviceID, address string, version string) *mRegistry.Service { func BuildGRPCService(serviceID, transport, address, version string) *mRegistry.Service {
var host string var host string
var port int var port int
@@ -23,20 +23,25 @@ func BuildGRPCService(serviceID, address string, version string) *mRegistry.Serv
host = parts[0] host = parts[0]
} }
addr, err := addr.Extract(host) addr := host
if err != nil { if transport != "unix" {
addr = host var err error
addr, err = mAddr.Extract(host)
if err != nil {
addr = host
}
addr = net.JoinHostPort(addr, strconv.Itoa(port))
} }
node := &mRegistry.Node{ node := &mRegistry.Node{
Id: serviceID + "-" + server.DefaultId, Id: serviceID + "-" + server.DefaultId,
Address: net.JoinHostPort(addr, fmt.Sprint(port)), Address: addr,
Metadata: make(map[string]string), Metadata: make(map[string]string),
} }
node.Metadata["registry"] = GetRegistry().String() node.Metadata["registry"] = GetRegistry().String()
node.Metadata["server"] = "grpc" node.Metadata["server"] = "grpc"
node.Metadata["transport"] = "grpc" node.Metadata["transport"] = transport
node.Metadata["protocol"] = "grpc" node.Metadata["protocol"] = "grpc"
return &mRegistry.Service{ return &mRegistry.Service{
@@ -59,7 +64,7 @@ func BuildHTTPService(serviceID, address string, version string) *mRegistry.Serv
host = parts[0] host = parts[0]
} }
addr, err := addr.Extract(host) addr, err := mAddr.Extract(host)
if err != nil { if err != nil {
addr = host addr = host
} }
+2 -2
View File
@@ -526,7 +526,7 @@ func pingNats(cfg *ociscfg.Config) error {
return err return err
} }
func pingGateway(_ *ociscfg.Config) error { func pingGateway(cfg *ociscfg.Config) error {
// init grpc connection // init grpc connection
_, err := ogrpc.NewClient() _, err := ogrpc.NewClient()
if err != nil { if err != nil {
@@ -536,7 +536,7 @@ func pingGateway(_ *ociscfg.Config) error {
b := backoff.NewExponentialBackOff() b := backoff.NewExponentialBackOff()
o := func() error { o := func() error {
n := b.NextBackOff() n := b.NextBackOff()
_, err := pool.GetGatewayServiceClient("com.owncloud.api.gateway") _, err := pool.GetGatewayServiceClient(cfg.Reva.Address)
if err != nil && n > time.Second { if err != nil && n > time.Second {
logger.New().Error().Err(err).Msgf("can't connect to gateway service, retrying in %s", n) logger.New().Error().Err(err).Msgf("can't connect to gateway service, retrying in %s", n)
} }
+1 -1
View File
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -48,7 +48,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"APP_PROVIDER_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"APP_PROVIDER_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"APP_PROVIDER_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;APP_PROVIDER_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"`
} }
type Drivers struct { type Drivers struct {
+1 -1
View File
@@ -76,7 +76,7 @@ func Server(cfg *config.Config) *cli.Command {
cancel() cancel()
}) })
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -47,7 +47,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"APP_REGISTRY_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"APP_REGISTRY_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"APP_REGISTRY_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;APP_REGISTRY_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type AppRegistry struct { type AppRegistry struct {
+1 -1
View File
@@ -89,7 +89,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -58,7 +58,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"AUTH_APP_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"%%NEXT%%"` Addr string `yaml:"addr" env:"AUTH_APP_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"%%NEXT%%"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"AUTH_APP_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"%%NEXT%%"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;AUTH_APP_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"%%NEXT%%"`
} }
// HTTP defines the available http configuration. // HTTP defines the available http configuration.
+1 -1
View File
@@ -94,7 +94,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -48,7 +48,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"AUTH_BASIC_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"AUTH_BASIC_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"AUTH_BASIC_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;AUTH_BASIC_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type AuthProviders struct { type AuthProviders struct {
+1 -1
View File
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -48,7 +48,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"AUTH_BEARER_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"AUTH_BEARER_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"AUTH_BEARER_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;AUTH_BEARER_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type OIDC struct { type OIDC struct {
+1 -1
View File
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -48,5 +48,5 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"AUTH_MACHINE_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"AUTH_MACHINE_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"AUTH_MACHINE_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;AUTH_MACHINE_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
+1 -1
View File
@@ -82,7 +82,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -47,7 +47,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"AUTH_SERVICE_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"5.0"` Addr string `yaml:"addr" env:"AUTH_SERVICE_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"AUTH_SERVICE_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;AUTH_SERVICE_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"5.0"`
} }
// ServiceAccount is the configuration for the used service account // ServiceAccount is the configuration for the used service account
@@ -33,6 +33,7 @@ func DefaultConfig() *config.Config {
}, },
GRPC: config.GRPC{ GRPC: config.GRPC{
Addr: "127.0.0.1:9301", Addr: "127.0.0.1:9301",
Protocol: "tcp",
Namespace: "com.owncloud.api", Namespace: "com.owncloud.api",
}, },
HTTP: config.HTTP{ HTTP: config.HTTP{
+3 -1
View File
@@ -2,6 +2,8 @@ package config
// GRPC defines the available grpc configuration. // GRPC defines the available grpc configuration.
type GRPC struct { type GRPC struct {
Addr string `yaml:"addr" env:"COLLABORATION_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"6.0.0"` Addr string `yaml:"addr" env:"COLLABORATION_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"6.0.0"`
Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;COLLABORATION_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"%%NEXT%%"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
} }
@@ -18,7 +18,7 @@ import (
// There are no explicit requirements for the context, and it will be passed // There are no explicit requirements for the context, and it will be passed
// without changes to the underlying RegisterService method. // without changes to the underlying RegisterService method.
func RegisterOcisService(ctx context.Context, cfg *config.Config, logger log.Logger) error { func RegisterOcisService(ctx context.Context, cfg *config.Config, logger log.Logger) error {
svc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name+"."+cfg.App.Name, cfg.GRPC.Addr, version.GetString()) svc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name+"."+cfg.App.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
return registry.RegisterService(ctx, svc, logger) return registry.RegisterService(ctx, svc, logger)
} }
+66
View File
@@ -31,6 +31,72 @@ Store specific notes:
- When using `nats-js-kv` it is recommended to set `OCIS_CACHE_STORE_NODES` to the same value as `OCIS_EVENTS_ENDPOINT`. That way the cache uses the same nats instance as the event bus. - When using `nats-js-kv` it is recommended to set `OCIS_CACHE_STORE_NODES` to the same value as `OCIS_EVENTS_ENDPOINT`. That way the cache uses the same nats instance as the event bus.
- When using the `nats-js-kv` store, it is possible to set `OCIS_CACHE_DISABLE_PERSISTENCE` to instruct nats to not persist cache data on disc. - When using the `nats-js-kv` store, it is possible to set `OCIS_CACHE_DISABLE_PERSISTENCE` to instruct nats to not persist cache data on disc.
## Service endpoints
The gateway acts as a proxy for other CS3 services. As such it has to forward requests to a lot of services and needs to establish connections by looking up the IP address using the service registry. Instead of using the service registry each endpoint can also be configured to use the grpc `dns://` or `kubernetes://` URLs, which might be useful when running in kubernetes.
For a local single node deployment you might want to use `unix:` sockets as shown below. Using unix sockets will reduce the amount of service lookups and omit the TCP stack. For now, this is experimental and the services do not delete the socket on shutdown. PRs welcome.
```console
USERS_GRPC_PROTOCOL=unix"
USERS_GRPC_ADDR=/var/run/ocis/users.sock"
GATEWAY_USERS_ENDPOINT=unix:/var/run/ocis/users.sock"
GROUPS_GRPC_PROTOCOL=unix"
GROUPS_GRPC_ADDR=/var/run/ocis/groups.sock"
GATEWAY_GROUPS_ENDPOINT=unix:/var/run/ocis/groups.sock"
AUTH_APP_GRPC_PROTOCOL=unix"
AUTH_APP_GRPC_ADDR=/var/run/ocis/auth-app.sock"
GATEWAY_AUTH_APP_ENDPOINT=unix:/var/run/ocis/auth-app.sock"
AUTH_BASIC_GRPC_PROTOCOL=unix"
AUTH_BASIC_GRPC_ADDR=/var/run/ocis/auth-basic.sock"
GATEWAY_AUTH_BASIC_ENDPOINT=unix:/var/run/ocis/auth-basic.sock"
AUTH_MACHINE_GRPC_PROTOCOL=unix"
AUTH_MACHINE_GRPC_ADDR=/var/run/ocis/auth-machine.sock"
GATEWAY_AUTH_MACHINE_ENDPOINT=unix:/var/run/ocis/auth-machine.sock"
AUTH_SERVICE_GRPC_PROTOCOL=unix"
AUTH_SERVICE_GRPC_ADDR=/var/run/ocis/auth-service.sock"
GATEWAY_AUTH_SERVICE_ENDPOINT=unix:/var/run/ocis/auth-service.sock"
STORAGE_PUBLIC_LINK_GRPC_PROTOCOL=unix"
STORAGE_PUBLIC_LINK_GRPC_ADDR=/var/run/ocis/storage-public-link.sock"
GATEWAY_STORAGE_PUBLIC_LINK_ENDPOINT=unix:/var/run/ocis/storage-public-link.sock"
STORAGE_USERS_GRPC_PROTOCOL=unix"
STORAGE_USERS_GRPC_ADDR=/var/run/ocis/storage-users.sock"
GATEWAY_STORAGE_USERS_ENDPOINT=unix:/var/run/ocis/storage-users.sock"
// graph sometimes bypasses the gateway so we need to configure the socket here as wel
GRAPH_SPACES_STORAGE_USERS_ADDRESS=unix:/var/run/ocis/storage-users.sock"
STORAGE_SHARES_GRPC_PROTOCOL=unix"
STORAGE_SHARES_GRPC_ADDR=/var/run/ocis/storage-shares.sock"
GATEWAY_STORAGE_SHARES_ENDPOINT=unix:/var/run/ocis/storage-shares.sock"
APP_REGISTRY_GRPC_PROTOCOL=unix"
APP_REGISTRY_GRPC_ADDR=/var/run/ocis/app-registry.sock"
GATEWAY_APP_REGISTRY_ENDPOINT=unix:/var/run/ocis/app-registry.sock"
OCM_GRPC_PROTOCOL=unix"
OCM_GRPC_ADDR=/var/run/ocis/ocm.sock"
GATEWAY_OCM_ENDPOINT=unix:/var/run/ocis/ocm.sock"
// storage system
STORAGE_SYSTEM_GRPC_PROTOCOL="unix"
STORAGE_SYSTEM_GRPC_ADDR="/var/run/ocis/storage-system.sock"
STORAGE_GATEWAY_GRPC_ADDR="unix:/var/run/ocis/storage-system.sock"
STORAGE_GRPC_ADDR="unix:/var/run/ocis/storage-system.sock"
SHARING_USER_CS3_PROVIDER_ADDR="unix:/var/run/ocis/storage-system.sock"
SHARING_USER_JSONCS3_PROVIDER_ADDR="unix:/var/run/ocis/storage-system.sock"
SHARING_PUBLIC_CS3_PROVIDER_ADDR="unix:/var/run/ocis/storage-system.sock"
SHARING_PUBLIC_JSONCS3_PROVIDER_ADDR="unix:/var/run/ocis/storage-system.sock"
```
## Storage registry ## Storage registry
In order to add another storage provider the CS3 storage registry that is running as part of the CS3 gateway hes to be made aware of it. The easiest cleanest way to do it is to set `GATEWAY_STORAGE_REGISTRY_CONFIG_JSON=/path/to/storages.json` and list all storage providers like this: In order to add another storage provider the CS3 storage registry that is running as part of the CS3 gateway hes to be made aware of it. The easiest cleanest way to do it is to set `GATEWAY_STORAGE_REGISTRY_CONFIG_JSON=/path/to/storages.json` and list all storage providers like this:
+1 -1
View File
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
cancel() cancel()
}) })
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+15 -15
View File
@@ -31,20 +31,20 @@ type Config struct {
FrontendPublicURL string `yaml:"frontend_public_url" env:"OCIS_URL;GATEWAY_FRONTEND_PUBLIC_URL" desc:"The public facing URL of the oCIS frontend." introductionVersion:"pre5.0"` FrontendPublicURL string `yaml:"frontend_public_url" env:"OCIS_URL;GATEWAY_FRONTEND_PUBLIC_URL" desc:"The public facing URL of the oCIS frontend." introductionVersion:"pre5.0"`
UsersEndpoint string `yaml:"-"` UsersEndpoint string `yaml:"users_endpoint" env:"GATEWAY_USERS_ENDPOINT" desc:"The endpoint of the users service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
GroupsEndpoint string `yaml:"-"` GroupsEndpoint string `yaml:"groups_endpoint" env:"GATEWAY_GROUPS_ENDPOINT" desc:"The endpoint of the groups service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
PermissionsEndpoint string `yaml:"-"` PermissionsEndpoint string `yaml:"permissions_endpoint" env:"GATEWAY_PERMISSIONS_ENDPOINT" desc:"The endpoint of the permissions service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
SharingEndpoint string `yaml:"-"` SharingEndpoint string `yaml:"sharing_endpoint" env:"GATEWAY_SHARING_ENDPOINT" desc:"The endpoint of the shares service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
AuthAppEndpoint string `yaml:"-"` AuthAppEndpoint string `yaml:"auth_app_endpoint" env:"GATEWAY_AUTH_APP_ENDPOINT" desc:"The endpoint of the auth-app service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
AuthBasicEndpoint string `yaml:"-"` AuthBasicEndpoint string `yaml:"auth_basic_endpoint" env:"GATEWAY_AUTH_BASIC_ENDPOINT" desc:"The endpoint of the auth-basic service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
AuthBearerEndpoint string `yaml:"-"` AuthBearerEndpoint string `yaml:"auth_bearer_endpoint" env:"GATEWAY_AUTH_BEARER_ENDPOINT" desc:"The endpoint of the auth-bearer service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
AuthMachineEndpoint string `yaml:"-"` AuthMachineEndpoint string `yaml:"auth_machine_endpoint" env:"GATEWAY_AUTH_MACHINE_ENDPOINT" desc:"The endpoint of the auth-machine service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
AuthServiceEndpoint string `yaml:"-"` AuthServiceEndpoint string `yaml:"auth_service_endpoint" env:"GATEWAY_AUTH_SERVICE_ENDPOINT" desc:"The endpoint of the auth-service service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
StoragePublicLinkEndpoint string `yaml:"-"` StoragePublicLinkEndpoint string `yaml:"storage_public_link_endpoint" env:"GATEWAY_STORAGE_PUBLIC_LINK_ENDPOINT" desc:"The endpoint of the storage-publiclink service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
StorageUsersEndpoint string `yaml:"-"` StorageUsersEndpoint string `yaml:"storage_users_endpoint" env:"GATEWAY_STORAGE_USERS_ENDPOINT" desc:"The endpoint of the storage-users service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
StorageSharesEndpoint string `yaml:"-"` StorageSharesEndpoint string `yaml:"storage_shares_endpoint" env:"GATEWAY_STORAGE_SHARES_ENDPOINT" desc:"The endpoint of the storag-shares service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
AppRegistryEndpoint string `yaml:"-"` AppRegistryEndpoint string `yaml:"app_registry_endpoint" env:"GATEWAY_APP_REGISTRY_ENDPOINT" desc:"The endpoint of the app-registry service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
OCMEndpoint string `yaml:"-"` OCMEndpoint string `yaml:"ocm_endpoint" env:"GATEWAY_OCM_ENDPOINT" desc:"The endpoint of the ocm service. Can take a service name or a gRPC URI with the dns, kubernetes or unix protocol." introductionVersion:"%%NEXT%%"`
StorageRegistry StorageRegistry `yaml:"storage_registry"` // TODO: should we even support switching this? StorageRegistry StorageRegistry `yaml:"storage_registry"` // TODO: should we even support switching this?
@@ -74,7 +74,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"OCIS_GATEWAY_GRPC_ADDR;GATEWAY_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"OCIS_GATEWAY_GRPC_ADDR;GATEWAY_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"GATEWAY_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;GATEWAY_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type StorageRegistry struct { type StorageRegistry struct {
@@ -12,7 +12,7 @@ import (
func init() { func init() {
r := registry.GetRegistry(registry.Inmemory()) r := registry.GetRegistry(registry.Inmemory())
service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "") service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "", "")
service.Nodes = []*mRegistry.Node{{ service.Nodes = []*mRegistry.Node{{
Address: "any", Address: "any",
}} }}
+1 -1
View File
@@ -94,7 +94,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -49,7 +49,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"GROUPS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"GROUPS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"GROUPS_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;GROUPS_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type Drivers struct { type Drivers struct {
@@ -12,7 +12,7 @@ import (
func init() { func init() {
r := registry.GetRegistry(registry.Inmemory()) r := registry.GetRegistry(registry.Inmemory())
service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "") service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "", "")
service.Nodes = []*mRegistry.Node{{ service.Nodes = []*mRegistry.Node{{
Address: "any", Address: "any",
}} }}
+1 -1
View File
@@ -82,7 +82,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -77,7 +77,7 @@ type GRPCConfig struct {
Addr string `ocisConfig:"addr" env:"OCM_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"5.0"` Addr string `ocisConfig:"addr" env:"OCM_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"5.0"`
Namespace string `ocisConfig:"-" yaml:"-"` Namespace string `ocisConfig:"-" yaml:"-"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Protocol string `yaml:"protocol" env:"OCM_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;OCM_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"5.0"`
} }
type ScienceMesh struct { type ScienceMesh struct {
@@ -12,7 +12,7 @@ import (
func init() { func init() {
r := registry.GetRegistry(registry.Inmemory()) r := registry.GetRegistry(registry.Inmemory())
service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "") service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "", "")
service.Nodes = []*mRegistry.Node{{ service.Nodes = []*mRegistry.Node{{
Address: "any", Address: "any",
}} }}
+1 -1
View File
@@ -98,7 +98,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -56,7 +56,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"SHARING_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"SHARING_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"SHARING_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;SHARING_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type UserSharingDrivers struct { type UserSharingDrivers struct {
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
@@ -48,7 +48,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"STORAGE_PUBLICLINK_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"STORAGE_PUBLICLINK_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"STORAGE_PUBLICLINK_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;STORAGE_PUBLICLINK_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
type StorageProvider struct { type StorageProvider struct {
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -49,5 +49,5 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"STORAGE_SHARES_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"STORAGE_SHARES_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"STORAGE_SHARES_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;STORAGE_SHARES_GRPC_PROTOCOL" desc:"The transport protocol of the GRPC service." introductionVersion:"pre5.0"`
} }
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+6 -5
View File
@@ -18,10 +18,11 @@ type Config struct {
GRPC GRPCConfig `yaml:"grpc"` GRPC GRPCConfig `yaml:"grpc"`
HTTP HTTPConfig `yaml:"http"` HTTP HTTPConfig `yaml:"http"`
TokenManager *TokenManager `yaml:"token_manager"` TokenManager *TokenManager `yaml:"token_manager"`
Reva *shared.Reva `yaml:"reva"` Reva *shared.Reva `yaml:"reva"`
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the STORAGE-SYSTEM system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format." introductionVersion:"pre5.0"`
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user." introductionVersion:"pre5.0"` SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the STORAGE-SYSTEM system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format." introductionVersion:"pre5.0"`
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user." introductionVersion:"pre5.0"`
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_SYSTEM_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token." introductionVersion:"pre5.0"` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_SYSTEM_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token." introductionVersion:"pre5.0"`
@@ -60,7 +61,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"STORAGE_SYSTEM_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"STORAGE_SYSTEM_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"STORAGE_SYSTEM_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;STORAGE_SYSTEM_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"`
} }
// HTTPConfig holds HTTPConfig config // HTTPConfig holds HTTPConfig config
+1 -1
View File
@@ -92,7 +92,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -75,7 +75,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"STORAGE_USERS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"STORAGE_USERS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"STORAGE_USERS_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;STORAGE_USERS_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"`
} }
// HTTPConfig is the configuration for the http server // HTTPConfig is the configuration for the http server
@@ -12,7 +12,7 @@ import (
func init() { func init() {
r := registry.GetRegistry(registry.Inmemory()) r := registry.GetRegistry(registry.Inmemory())
service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "") service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "", "")
service.Nodes = []*mRegistry.Node{{ service.Nodes = []*mRegistry.Node{{
Address: "any", Address: "any",
}} }}
@@ -12,7 +12,7 @@ import (
func init() { func init() {
r := registry.GetRegistry(registry.Inmemory()) r := registry.GetRegistry(registry.Inmemory())
service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "") service := registry.BuildGRPCService("com.owncloud.api.gateway", "", "", "")
service.Nodes = []*mRegistry.Node{{ service.Nodes = []*mRegistry.Node{{
Address: "any", Address: "any",
}} }}
+1 -1
View File
@@ -94,7 +94,7 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel) sync.Trap(&gr, cancel)
} }
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Addr, version.GetString()) grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil { if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service") logger.Fatal().Err(err).Msg("failed to register the grpc service")
} }
+1 -1
View File
@@ -48,7 +48,7 @@ type GRPCConfig struct {
Addr string `yaml:"addr" env:"USERS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"` Addr string `yaml:"addr" env:"USERS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
TLS *shared.GRPCServiceTLS `yaml:"tls"` TLS *shared.GRPCServiceTLS `yaml:"tls"`
Namespace string `yaml:"-"` Namespace string `yaml:"-"`
Protocol string `yaml:"protocol" env:"USERS_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"` Protocol string `yaml:"protocol" env:"OCIS_GRPC_PROTOCOL;USERS_GRPC_PROTOCOL" desc:"The transport protocol of the GPRC service." introductionVersion:"pre5.0"`
} }
type Drivers struct { type Drivers struct {