Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ocs cache warmup config and warn on protobuf ns conflicts #2328

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ ifndef DATE
DATE := $(shell date -u '+%Y%m%d')
endif

LDFLAGS += -s -w -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/version.Date=$(DATE)"
DEBUG_LDFLAGS += -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/version.Date=$(DATE)"
LDFLAGS += -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn -s -w -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/version.Date=$(DATE)"
DEBUG_LDFLAGS += -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/version.Date=$(DATE)"

GCFLAGS += all=-N -l

.PHONY: all
Expand Down
3 changes: 3 additions & 0 deletions changelog/unreleased/ocs-cache-warmup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Add ocs cache warmup config and warn on protobuf ns conflicts

https://github.com/owncloud/ocis/pull/2328
19 changes: 16 additions & 3 deletions storage/pkg/command/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,22 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
"public_url": cfg.Reva.Frontend.PublicURL,
},
"ocs": map[string]interface{}{
"share_prefix": cfg.Reva.Frontend.OCSSharePrefix,
"home_namespace": cfg.Reva.Frontend.OCSHomeNamespace,
"prefix": cfg.Reva.Frontend.OCSPrefix,
"share_prefix": cfg.Reva.Frontend.OCSSharePrefix,
"home_namespace": cfg.Reva.Frontend.OCSHomeNamespace,
"resource_info_cache_ttl": cfg.Reva.Frontend.OCSResourceInfoCacheTTL,
"prefix": cfg.Reva.Frontend.OCSPrefix,
"cache_warmup_driver": cfg.Reva.Frontend.OCSCacheWarmupDriver,
"cache_warmup_drivers": map[string]interface{}{
"cbox": map[string]interface{}{
"db_username": cfg.Reva.Sharing.UserSQLUsername,
"db_password": cfg.Reva.Sharing.UserSQLPassword,
"db_host": cfg.Reva.Sharing.UserSQLHost,
"db_port": cfg.Reva.Sharing.UserSQLPort,
"db_name": cfg.Reva.Sharing.UserSQLName,
"namespace": cfg.Reva.Storages.EOS.Root,
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
},
"config": map[string]interface{}{
"version": "1.8",
"website": "reva",
Expand Down
18 changes: 10 additions & 8 deletions storage/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ type Groups struct {
type FrontendPort struct {
Port

DatagatewayPrefix string
OCDavPrefix string
OCSPrefix string
OCSSharePrefix string
OCSHomeNamespace string
PublicURL string
Middleware Middleware
DatagatewayPrefix string
OCDavPrefix string
OCSPrefix string
OCSSharePrefix string
OCSHomeNamespace string
PublicURL string
OCSCacheWarmupDriver string
OCSResourceInfoCacheTTL int
Middleware Middleware
}

// Middleware configures reva middlewares.
Expand Down Expand Up @@ -147,7 +149,7 @@ type StoragePort struct {
// for HTTP ports with only one http service
HTTPPrefix string
TempFolder string
ReadOnly bool
ReadOnly bool
}

// PublicStorage configures a public storage provider
Expand Down
16 changes: 16 additions & 0 deletions storage/pkg/flagset/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"STORAGE_FRONTEND_OCS_HOME_NAMESPACE"},
Destination: &cfg.Reva.Frontend.OCSHomeNamespace,
},
&cli.IntFlag{
Name: "ocs-resource-info-cache-ttl",
Value: flags.OverrideDefaultInt(cfg.Reva.Frontend.OCSResourceInfoCacheTTL, 0),
Usage: "the TTL for statted resources in the share cache",
EnvVars: []string{"STORAGE_FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL"},
Destination: &cfg.Reva.Frontend.OCSResourceInfoCacheTTL,
},
&cli.StringFlag{
Name: "ocs-cache-warmup-driver",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCSCacheWarmupDriver, ""),
Usage: "the driver to be used for warming up the share cache",
EnvVars: []string{"STORAGE_FRONTEND_OCS_CACHE_WARMUP_DRIVER"},
Destination: &cfg.Reva.Frontend.OCSCacheWarmupDriver,
},
// Gateway

&cli.StringFlag{
Expand Down Expand Up @@ -183,6 +197,8 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, SharingSQLWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)

return flags
}