storage-users: Add config option for graceful shutdown timeout

Add STORAGE_USERS_GRACEFUL_SHUTDOWN_TIMEOUT setting to allow a graceful
shutdown of the storage-users service. This currently only applicable
when running storage-user as a sepearate service.

Setting STORAGE_USERS_GRACEFUL_SHUTDOWN_TIMEOUT to a non-zero value
gives the storage-users service a chance to cleanly shutdown and finish
any in progess tasks (e.g. metadata propagation) before exiting.

Partial-Fix: #6602
This commit is contained in:
Ralf Haferkamp committed 2023-07-18 16:47:26 +02:00
1 parent b480fc09b0
commit e32aef17cd
3 files changed
+16 -12

No files matched your search

+2 -1
View File
@@ -21,7 +21,8 @@ type Config struct {
TokenManager *TokenManager `yaml:"token_manager"` TokenManager *TokenManager `yaml:"token_manager"`
Reva *shared.Reva `yaml:"reva"` Reva *shared.Reva `yaml:"reva"`
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."` SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`
GracefulShutdownTimeout int `yaml:"graceful_shutdown_timeout" env:"STORAGE_USERS_GRACEFUL_SHUTDOWN_TIMEOUT" desc:"The number of seconds to wait for the service to shutdown cleanly before exiting with an error. Note: This setting is only applicable when running the 'storage-users' service as a standalone service."`
Driver string `yaml:"driver" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service. Defaults to 'ocis', Supported values are: 'ocis', 's3ng' and 'owncloudsql'. The 'ocis' driver stores all data (blob and meta data) in an POSIX compliant volume. The 's3ng' driver stores metadata in a POSIX compliant volume and uploads blobs to the s3 bucket."` Driver string `yaml:"driver" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service. Defaults to 'ocis', Supported values are: 'ocis', 's3ng' and 'owncloudsql'. The 'ocis' driver stores all data (blob and meta data) in an POSIX compliant volume. The 's3ng' driver stores metadata in a POSIX compliant volume and uploads blobs to the s3 bucket."`
Drivers Drivers `yaml:"drivers"` Drivers Drivers `yaml:"drivers"`
@@ -41,12 +41,13 @@ func DefaultConfig() *config.Config {
Service: config.Service{ Service: config.Service{
Name: "storage-users", Name: "storage-users",
}, },
Reva: shared.DefaultRevaConfig(), Reva: shared.DefaultRevaConfig(),
DataServerURL: "http://localhost:9158/data", DataServerURL: "http://localhost:9158/data",
DataGatewayURL: "https://localhost:9200/data", DataGatewayURL: "https://localhost:9200/data",
TransferExpires: 86400, TransferExpires: 86400,
UploadExpiration: 24 * 60 * 60, UploadExpiration: 24 * 60 * 60,
Driver: "ocis", GracefulShutdownTimeout: 30,
Driver: "ocis",
Drivers: config.Drivers{ Drivers: config.Drivers{
OwnCloudSQL: config.OwnCloudSQLDriver{ OwnCloudSQL: config.OwnCloudSQLDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "owncloud"), Root: filepath.Join(defaults.BaseDataPath(), "storage", "owncloud"),
@@ -1,3 +1,4 @@
// Package revaconfig contains the config for the reva service
package revaconfig package revaconfig
import ( import (
@@ -10,11 +11,12 @@ import (
func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
rcfg := map[string]interface{}{ rcfg := map[string]interface{}{
"core": map[string]interface{}{ "core": map[string]interface{}{
"tracing_enabled": cfg.Tracing.Enabled, "tracing_enabled": cfg.Tracing.Enabled,
"tracing_exporter": cfg.Tracing.Type, "tracing_exporter": cfg.Tracing.Type,
"tracing_endpoint": cfg.Tracing.Endpoint, "tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector, "tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": cfg.Service.Name, "tracing_service_name": cfg.Service.Name,
"graceful_shutdown_timeout": cfg.GracefulShutdownTimeout,
}, },
"shared": map[string]interface{}{ "shared": map[string]interface{}{
"jwt_secret": cfg.TokenManager.JWTSecret, "jwt_secret": cfg.TokenManager.JWTSecret,