revert storage, remove tracing.service and bring back common

This commit is contained in:
Willy Kloucek
2021-12-17 16:30:57 +01:00
committed by Jörn Friedrich Dreyer
parent 9422388b74
commit 3c3fc2e098
114 changed files with 824 additions and 875 deletions

View File

@@ -12,7 +12,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -28,7 +27,7 @@ func AppProvider(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-app-provider")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -129,7 +128,7 @@ type AppProviderSutureService struct {
// NewAppProvider creates a new store.AppProviderSutureService
func NewAppProvider(cfg *ociscfg.Config) suture.Service {
////cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return AppProviderSutureService{
cfg: cfg.Storage,
}

View File

@@ -13,7 +13,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -29,7 +28,7 @@ func AuthBasic(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-auth-basic")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -148,7 +147,7 @@ type AuthBasicSutureService struct {
// NewAuthBasicSutureService creates a new store.AuthBasicSutureService
func NewAuthBasic(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return AuthBasicSutureService{
cfg: cfg.Storage,
}

View File

@@ -12,7 +12,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -28,7 +27,7 @@ func AuthBearer(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-auth-bearer")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -124,7 +123,7 @@ type AuthBearerSutureService struct {
// NewAuthBearerSutureService creates a new gateway.AuthBearerSutureService
func NewAuthBearer(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return AuthBearerSutureService{
cfg: cfg.Storage,
}

View File

@@ -12,7 +12,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -28,7 +27,7 @@ func AuthMachine(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-auth-machine")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -120,7 +119,7 @@ type AuthMachineSutureService struct {
// NewAuthMachineSutureService creates a new gateway.AuthMachineSutureService
func NewAuthMachine(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return AuthMachineSutureService{
cfg: cfg.Storage,
}

View File

@@ -16,7 +16,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/conversions"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -35,7 +34,7 @@ func Frontend(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-frontend")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
@@ -344,7 +343,7 @@ type FrontendSutureService struct {
// NewFrontend creates a new frontend.FrontendSutureService
func NewFrontend(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return FrontendSutureService{
cfg: cfg.Storage,
}

View File

@@ -15,10 +15,10 @@ import (
"github.com/oklog/run"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/shared"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/service/external"
"github.com/owncloud/ocis/storage/pkg/tracing"
@@ -43,7 +43,7 @@ func Gateway(cfg *config.Config) *cli.Command {
return nil
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -389,7 +389,7 @@ type GatewaySutureService struct {
// NewGatewaySutureService creates a new gateway.GatewaySutureService
func NewGateway(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return GatewaySutureService{
cfg: cfg.Storage,
}
@@ -425,16 +425,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config, storageExtension string) er
}
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
//if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
// cfg.Log = &shared.Log{
// Level: cfg.Commons.Log.Level,
// Pretty: cfg.Commons.Log.Pretty,
// Color: cfg.Commons.Log.Color,
// File: cfg.Commons.Log.File,
// }
//} else if cfg.Log == nil && cfg.Commons == nil {
// cfg.Log = &shared.Log{}
//}
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
cfg.Log = &shared.Log{
Level: cfg.Commons.Log.Level,
Pretty: cfg.Commons.Log.Pretty,
Color: cfg.Commons.Log.Color,
File: cfg.Commons.Log.File,
}
} else if cfg.Log == nil && cfg.Commons == nil {
cfg.Log = &shared.Log{}
}
// load all env variables relevant to the config in the current context.
conf.LoadOSEnv(config.GetEnv(cfg), false)

View File

@@ -13,7 +13,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -29,7 +28,7 @@ func Groups(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-groups")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -162,7 +161,7 @@ type GroupSutureService struct {
// NewGroupProviderSutureService creates a new storage.GroupProvider
func NewGroupProvider(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return GroupSutureService{
cfg: cfg.Storage,
}

View File

@@ -5,7 +5,6 @@ import (
"net/http"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/urfave/cli/v2"
)
@@ -18,7 +17,7 @@ func Health(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
resp, err := http.Get(
fmt.Sprintf(

View File

@@ -3,6 +3,7 @@ package command
import (
"os"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
@@ -22,10 +23,8 @@ func Execute(cfg *config.Config) error {
Email: "support@owncloud.com",
},
},
Before: func(c *cli.Context) error {
cfg.Service.Version = version.String
return ParseConfig(c, cfg, "_")
return ParseConfig(c, cfg, "storage")
},
Commands: []*cli.Command{
@@ -36,7 +35,6 @@ func Execute(cfg *config.Config) error {
AppProvider(cfg),
AuthBasic(cfg),
AuthBearer(cfg),
AuthMachine(cfg),
Sharing(cfg),
StorageUsers(cfg),
StorageShares(cfg),
@@ -58,3 +56,14 @@ func Execute(cfg *config.Config) error {
return app.Run(os.Args)
}
// NewLogger initializes a service-specific logger instance.
func NewLogger(cfg *config.Config) log.Logger {
return log.NewLogger(
log.Name("storage"),
log.Level(cfg.Log.Level),
log.Pretty(cfg.Log.Pretty),
log.Color(cfg.Log.Color),
log.File(cfg.Log.File),
)
}

View File

@@ -7,7 +7,6 @@ import (
"path"
"path/filepath"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/sync"
@@ -31,7 +30,7 @@ func Sharing(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-sharing")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
@@ -188,7 +187,7 @@ type SharingSutureService struct {
// NewSharingSutureService creates a new store.SharingSutureService
func NewSharing(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return SharingSutureService{
cfg: cfg.Storage,
}

View File

@@ -7,7 +7,6 @@ import (
"path"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
@@ -35,7 +34,7 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
},
Category: "Extensions",
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
@@ -166,7 +165,7 @@ type MetadataSutureService struct {
// NewSutureService creates a new storagemetadata.SutureService
func NewStorageMetadata(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return MetadataSutureService{
cfg: cfg.Storage,
}

View File

@@ -12,7 +12,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -29,7 +28,7 @@ func StoragePublicLink(cfg *config.Config) *cli.Command {
},
Category: "Extensions",
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
@@ -126,7 +125,7 @@ type StoragePublicLinkSutureService struct {
// NewStoragePublicLinkSutureService creates a new storage.StoragePublicLinkSutureService
func NewStoragePublicLink(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return StoragePublicLinkSutureService{
cfg: cfg.Storage,
}

View File

@@ -7,7 +7,6 @@ import (
"path"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
@@ -29,7 +28,7 @@ func StorageShares(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-shares")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
@@ -125,7 +124,7 @@ type StorageSharesSutureService struct {
// NewStorageShares creates a new storage.StorageSharesSutureService
func NewStorageShares(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return StorageSharesSutureService{
cfg: cfg.Storage,
}

View File

@@ -13,7 +13,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/command/storagedrivers"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -29,7 +28,7 @@ func StorageUsers(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-userprovider")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
@@ -146,7 +145,7 @@ type StorageUsersSutureService struct {
// NewStorageUsersSutureService creates a new storage.StorageUsersSutureService
func NewStorageUsers(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return StorageUsersSutureService{
cfg: cfg.Storage,
}

View File

@@ -13,7 +13,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/logging"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
"github.com/thejerf/suture/v4"
@@ -29,7 +28,7 @@ func Users(cfg *config.Config) *cli.Command {
return ParseConfig(c, cfg, "storage-users")
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
@@ -183,7 +182,7 @@ type UserProviderSutureService struct {
// NewUserProviderSutureService creates a new storage.UserProvider
func NewUserProvider(cfg *ociscfg.Config) suture.Service {
//cfg.Storage.Commons = cfg.Commons
cfg.Storage.Commons = cfg.Commons
return UserProviderSutureService{
cfg: cfg.Storage,
}