fix: append the app name to the service name for parallel deployment
This will allow multiple collaboration services to target 2, 3 or more different WOPI apps. It's expected that each different collaboration service is deployed in a different container or host
This commit is contained in:
@@ -24,14 +24,14 @@ func Version(cfg *config.Config) *cli.Command {
|
|||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
|
|
||||||
reg := registry.GetRegistry()
|
reg := registry.GetRegistry()
|
||||||
services, err := reg.GetService(cfg.HTTP.Namespace + "." + cfg.Service.Name)
|
services, err := reg.GetService(cfg.HTTP.Namespace + "." + cfg.Service.Name + "." + cfg.App.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(fmt.Errorf("could not get %s services from the registry: %v", cfg.Service.Name, err))
|
fmt.Println(fmt.Errorf("could not get %s services from the registry: %v", cfg.Service.Name+"."+cfg.App.Name, err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(services) == 0 {
|
if len(services) == 0 {
|
||||||
fmt.Println("No running " + cfg.Service.Name + " service found.")
|
fmt.Println("No running " + cfg.Service.Name + "." + cfg.App.Name + " service found.")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str
|
|||||||
Ref: &wopiContext.FileReference,
|
Ref: &wopiContext.FileReference,
|
||||||
Lock: &providerv1beta1.Lock{
|
Lock: &providerv1beta1.Lock{
|
||||||
LockId: lockID,
|
LockId: lockID,
|
||||||
AppName: f.cfg.App.LockName,
|
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||||
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
||||||
Expiration: &typesv1beta1.Timestamp{
|
Expiration: &typesv1beta1.Timestamp{
|
||||||
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
||||||
@@ -182,7 +182,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str
|
|||||||
Ref: &wopiContext.FileReference,
|
Ref: &wopiContext.FileReference,
|
||||||
Lock: &providerv1beta1.Lock{
|
Lock: &providerv1beta1.Lock{
|
||||||
LockId: lockID,
|
LockId: lockID,
|
||||||
AppName: f.cfg.App.LockName,
|
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||||
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
||||||
Expiration: &typesv1beta1.Timestamp{
|
Expiration: &typesv1beta1.Timestamp{
|
||||||
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
||||||
@@ -295,7 +295,7 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (string,
|
|||||||
Ref: &wopiContext.FileReference,
|
Ref: &wopiContext.FileReference,
|
||||||
Lock: &providerv1beta1.Lock{
|
Lock: &providerv1beta1.Lock{
|
||||||
LockId: lockID,
|
LockId: lockID,
|
||||||
AppName: f.cfg.App.LockName,
|
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||||
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
||||||
Expiration: &typesv1beta1.Timestamp{
|
Expiration: &typesv1beta1.Timestamp{
|
||||||
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
||||||
@@ -403,7 +403,7 @@ func (f *FileConnector) UnLock(ctx context.Context, lockID string) (string, erro
|
|||||||
Ref: &wopiContext.FileReference,
|
Ref: &wopiContext.FileReference,
|
||||||
Lock: &providerv1beta1.Lock{
|
Lock: &providerv1beta1.Lock{
|
||||||
LockId: lockID,
|
LockId: lockID,
|
||||||
AppName: f.cfg.App.LockName,
|
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,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, uuid.Must(uuid.NewV4()).String(), cfg.GRPC.Addr, version.GetString())
|
svc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name+"."+cfg.App.Name, uuid.Must(uuid.NewV4()).String(), cfg.GRPC.Addr, version.GetString())
|
||||||
return registry.RegisterService(ctx, svc, logger)
|
return registry.RegisterService(ctx, svc, logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ func RegisterAppProvider(
|
|||||||
Name: cfg.App.Name,
|
Name: cfg.App.Name,
|
||||||
Description: cfg.App.Description,
|
Description: cfg.App.Description,
|
||||||
Icon: cfg.App.Icon,
|
Icon: cfg.App.Icon,
|
||||||
Address: cfg.GRPC.Namespace + "." + cfg.Service.Name,
|
Address: cfg.GRPC.Namespace + "." + cfg.Service.Name + "." + cfg.App.Name,
|
||||||
MimeTypes: mimeTypes,
|
MimeTypes: mimeTypes,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
|||||||
|
|
||||||
return debug.NewService(
|
return debug.NewService(
|
||||||
debug.Logger(options.Logger),
|
debug.Logger(options.Logger),
|
||||||
debug.Name(options.Config.Service.Name),
|
debug.Name(options.Config.Service.Name+"."+options.Config.App.Name),
|
||||||
debug.Version(version.GetString()),
|
debug.Version(version.GetString()),
|
||||||
debug.Address(options.Config.Debug.Addr),
|
debug.Address(options.Config.Debug.Addr),
|
||||||
debug.Token(options.Config.Debug.Token),
|
debug.Token(options.Config.Debug.Token),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func Server(opts ...Option) (http.Service, error) {
|
|||||||
http.TLSConfig(options.Config.HTTP.TLS),
|
http.TLSConfig(options.Config.HTTP.TLS),
|
||||||
http.Logger(options.Logger),
|
http.Logger(options.Logger),
|
||||||
http.Namespace(options.Config.HTTP.Namespace),
|
http.Namespace(options.Config.HTTP.Namespace),
|
||||||
http.Name(options.Config.Service.Name),
|
http.Name(options.Config.Service.Name+"."+options.Config.App.Name),
|
||||||
http.Version(version.GetString()),
|
http.Version(version.GetString()),
|
||||||
http.Address(options.Config.HTTP.Addr),
|
http.Address(options.Config.HTTP.Addr),
|
||||||
http.Context(options.Context),
|
http.Context(options.Context),
|
||||||
@@ -41,7 +41,7 @@ func Server(opts ...Option) (http.Service, error) {
|
|||||||
middlewares := []func(stdhttp.Handler) stdhttp.Handler{
|
middlewares := []func(stdhttp.Handler) stdhttp.Handler{
|
||||||
chimiddleware.RequestID,
|
chimiddleware.RequestID,
|
||||||
middleware.Version(
|
middleware.Version(
|
||||||
options.Config.Service.Name,
|
options.Config.Service.Name+"."+options.Config.App.Name,
|
||||||
version.GetString(),
|
version.GetString(),
|
||||||
),
|
),
|
||||||
middleware.Logger(
|
middleware.Logger(
|
||||||
@@ -69,7 +69,7 @@ func Server(opts ...Option) (http.Service, error) {
|
|||||||
|
|
||||||
mux.Use(
|
mux.Use(
|
||||||
otelchi.Middleware(
|
otelchi.Middleware(
|
||||||
options.Config.Service.Name,
|
options.Config.Service.Name+"."+options.Config.App.Name,
|
||||||
otelchi.WithChiRoutes(mux),
|
otelchi.WithChiRoutes(mux),
|
||||||
otelchi.WithTracerProvider(options.TracerProvider),
|
otelchi.WithTracerProvider(options.TracerProvider),
|
||||||
otelchi.WithPropagators(tracing.GetPropagator()),
|
otelchi.WithPropagators(tracing.GetPropagator()),
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func NewHandler(opts ...Option) (*Service, func(), error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &Service{
|
return &Service{
|
||||||
id: options.Config.GRPC.Namespace + "." + options.Config.Service.Name,
|
id: options.Config.GRPC.Namespace + "." + options.Config.Service.Name + "." + options.Config.App.Name,
|
||||||
appURLs: options.AppURLs,
|
appURLs: options.AppURLs,
|
||||||
logger: options.Logger,
|
logger: options.Logger,
|
||||||
config: options.Config,
|
config: options.Config,
|
||||||
|
|||||||
Reference in New Issue
Block a user