mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-18 03:18:52 -06:00
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("")
|
||||
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str
|
||||
Ref: &wopiContext.FileReference,
|
||||
Lock: &providerv1beta1.Lock{
|
||||
LockId: lockID,
|
||||
AppName: f.cfg.App.LockName,
|
||||
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
||||
Expiration: &typesv1beta1.Timestamp{
|
||||
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,
|
||||
Lock: &providerv1beta1.Lock{
|
||||
LockId: lockID,
|
||||
AppName: f.cfg.App.LockName,
|
||||
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
||||
Expiration: &typesv1beta1.Timestamp{
|
||||
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
|
||||
@@ -295,7 +295,7 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (string,
|
||||
Ref: &wopiContext.FileReference,
|
||||
Lock: &providerv1beta1.Lock{
|
||||
LockId: lockID,
|
||||
AppName: f.cfg.App.LockName,
|
||||
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
|
||||
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
|
||||
Expiration: &typesv1beta1.Timestamp{
|
||||
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,
|
||||
Lock: &providerv1beta1.Lock{
|
||||
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
|
||||
// without changes to the underlying RegisterService method.
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func RegisterAppProvider(
|
||||
Name: cfg.App.Name,
|
||||
Description: cfg.App.Description,
|
||||
Icon: cfg.App.Icon,
|
||||
Address: cfg.GRPC.Namespace + "." + cfg.Service.Name,
|
||||
Address: cfg.GRPC.Namespace + "." + cfg.Service.Name + "." + cfg.App.Name,
|
||||
MimeTypes: mimeTypes,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
|
||||
return debug.NewService(
|
||||
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.Address(options.Config.Debug.Addr),
|
||||
debug.Token(options.Config.Debug.Token),
|
||||
|
||||
@@ -25,7 +25,7 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
http.TLSConfig(options.Config.HTTP.TLS),
|
||||
http.Logger(options.Logger),
|
||||
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.Address(options.Config.HTTP.Addr),
|
||||
http.Context(options.Context),
|
||||
@@ -41,7 +41,7 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
middlewares := []func(stdhttp.Handler) stdhttp.Handler{
|
||||
chimiddleware.RequestID,
|
||||
middleware.Version(
|
||||
options.Config.Service.Name,
|
||||
options.Config.Service.Name+"."+options.Config.App.Name,
|
||||
version.GetString(),
|
||||
),
|
||||
middleware.Logger(
|
||||
@@ -69,7 +69,7 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
|
||||
mux.Use(
|
||||
otelchi.Middleware(
|
||||
options.Config.Service.Name,
|
||||
options.Config.Service.Name+"."+options.Config.App.Name,
|
||||
otelchi.WithChiRoutes(mux),
|
||||
otelchi.WithTracerProvider(options.TracerProvider),
|
||||
otelchi.WithPropagators(tracing.GetPropagator()),
|
||||
|
||||
@@ -38,7 +38,7 @@ func NewHandler(opts ...Option) (*Service, func(), error) {
|
||||
}
|
||||
|
||||
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,
|
||||
logger: options.Logger,
|
||||
config: options.Config,
|
||||
|
||||
Reference in New Issue
Block a user