diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 23af0b3e1b..cfff671771 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -102,6 +102,7 @@ type Drivers struct { OCIS OCISDriver `yaml:"ocis"` S3NG S3NGDriver `yaml:"s3ng"` OwnCloudSQL OwnCloudSQLDriver `yaml:"owncloudsql"` + Posix PosixDriver `yaml:"posix"` S3 S3Driver `yaml:",omitempty"` // not supported by the oCIS product, therefore not part of docs EOS EOSDriver `yaml:",omitempty"` // not supported by the oCIS product, therefore not part of docs @@ -125,9 +126,11 @@ type OCISDriver struct { // PersonalSpaceAliasTemplate contains the template used to construct // the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"` PersonalSpaceAliasTemplate string `yaml:"personalspacealias_template" env:"STORAGE_USERS_OCIS_PERSONAL_SPACE_ALIAS_TEMPLATE" desc:"Template string to construct personal space aliases." introductionVersion:"pre5.0"` + PersonalSpacePathTemplate string `yaml:"personalspacepath_template" env:"STORAGE_USERS_OCIS_PERSONAL_SPACE_PATH_TEMPLATE" desc:"Template string to construct the paths of the personal space roots." introductionVersion:"6.0"` // GeneralSpaceAliasTemplate contains the template used to construct // the general space alias, eg: `{{.SpaceType}}/{{.SpaceName | replace " " "-" | lower}}` GeneralSpaceAliasTemplate string `yaml:"generalspacealias_template" env:"STORAGE_USERS_OCIS_GENERAL_SPACE_ALIAS_TEMPLATE" desc:"Template string to construct general space aliases." introductionVersion:"pre5.0"` + GeneralSpacePathTemplate string `yaml:"generalspacepath_template" env:"STORAGE_USERS_OCIS_GENERAL_SPACE_PATH_TEMPLATE" desc:"Template string to construct the paths of the projects space roots." introductionVersion:"6.0"` // ShareFolder defines the name of the folder jailing all shares ShareFolder string `yaml:"share_folder" env:"STORAGE_USERS_OCIS_SHARE_FOLDER" desc:"Name of the folder jailing all shares." introductionVersion:"pre5.0"` MaxAcquireLockCycles int `yaml:"max_acquire_lock_cycles" env:"STORAGE_USERS_OCIS_MAX_ACQUIRE_LOCK_CYCLES" desc:"When trying to lock files, ocis will try this amount of times to acquire the lock before failing. After each try it will wait for an increasing amount of time. Values of 0 or below will be ignored and the default value will be used." introductionVersion:"pre5.0"` @@ -160,9 +163,11 @@ type S3NGDriver struct { // PersonalSpaceAliasTemplate contains the template used to construct // the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"` PersonalSpaceAliasTemplate string `yaml:"personalspacealias_template" env:"STORAGE_USERS_S3NG_PERSONAL_SPACE_ALIAS_TEMPLATE" desc:"Template string to construct personal space aliases." introductionVersion:"pre5.0"` + PersonalSpacePathTemplate string `yaml:"personalspacepath_template" env:"STORAGE_USERS_S3NG_PERSONAL_SPACE_PATH_TEMPLATE" desc:"Template string to construct the paths of the personal space roots." introductionVersion:"6.0"` // GeneralSpaceAliasTemplate contains the template used to construct // the general space alias, eg: `{{.SpaceType}}/{{.SpaceName | replace " " "-" | lower}}` GeneralSpaceAliasTemplate string `yaml:"generalspacealias_template" env:"STORAGE_USERS_S3NG_GENERAL_SPACE_ALIAS_TEMPLATE" desc:"Template string to construct general space aliases." introductionVersion:"pre5.0"` + GeneralSpacePathTemplate string `yaml:"generalspacepath_template" env:"STORAGE_USERS_S3NG_GENERAL_SPACE_PATH_TEMPLATE" desc:"Template string to construct the paths of the projects space roots." introductionVersion:"6.0"` // ShareFolder defines the name of the folder jailing all shares ShareFolder string `yaml:"share_folder" env:"STORAGE_USERS_S3NG_SHARE_FOLDER" desc:"Name of the folder jailing all shares." introductionVersion:"pre5.0"` MaxAcquireLockCycles int `yaml:"max_acquire_lock_cycles" env:"STORAGE_USERS_S3NG_MAX_ACQUIRE_LOCK_CYCLES" desc:"When trying to lock files, ocis will try this amount of times to acquire the lock before failing. After each try it will wait for an increasing amount of time. Values of 0 or below will be ignored and the default value of 20 will be used." introductionVersion:"pre5.0"` @@ -186,6 +191,21 @@ type OwnCloudSQLDriver struct { UsersProviderEndpoint string `yaml:"users_provider_endpoint" env:"STORAGE_USERS_OWNCLOUDSQL_USERS_PROVIDER_ENDPOINT" desc:"Endpoint of the users provider." introductionVersion:"pre5.0"` } +// PosixDriver is the storage driver configuration when using 'posix' storage driver +type PosixDriver struct { + // Root is the absolute path to the location of the data + Root string `yaml:"root" env:"STORAGE_USERS_POSIX_ROOT" desc:"The directory where the filesystem storage will store its data. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/owncloud." introductionVersion:"6.0"` + PersonalSpacePathTemplate string `yaml:"personalspacepath_template" env:"STORAGE_USERS_POSIX_PERSONAL_SPACE_PATH_TEMPLATE" desc:"Template string to construct the paths of the personal space roots." introductionVersion:"6.0"` + GeneralSpacePathTemplate string `yaml:"generalspacepath_template" env:"STORAGE_USERS_POSIX_GENERAL_SPACE_PATH_TEMPLATE" desc:"Template string to construct the paths of the projects space roots." introductionVersion:"6.0"` + PermissionsEndpoint string `yaml:"permissions_endpoint" env:"STORAGE_USERS_PERMISSION_ENDPOINT;STORAGE_USERS_POSIX_PERMISSIONS_ENDPOINT" desc:"Endpoint of the permissions service. The endpoints can differ for 'ocis', 'posix' and 's3ng'." introductionVersion:"6.0"` + + UseSpaceGroups bool `yaml:"use_space_groups" env:"STORAGE_USERS_POSIX_USE_SPACE_GROUPS" desc:"Use space groups to manage permissions on spaces." introductionVersion:"6.0"` + + WatchType string `yaml:"watch_type" env:"STORAGE_USERS_POSIX_WATCH_TYPE" desc:"Type of the watcher to use for getting notified about changes to the filesystem. Currently available options are 'inotifywait' (default), 'gpfswatchfolder' and 'gpfsfileauditlogging'." introductionVersion:"6.0"` + WatchPath string `yaml:"watch_path" env:"STORAGE_USERS_POSIX_WATCH_PATH" desc:"Path to the watch directory/file. Only applies to the 'gpfsfileauditlogging' and 'inotifywait' watcher, in which case it is the path of the file audit log file/base directory to watch." introductionVersion:"6.0"` + WatchFolderKafkaBrokers string `yaml:"watch_folder_kafka_hosts" env:"STORAGE_USERS_POSIX_WATCH_FOLDER_KAFKA_BROKERS" desc:"Comma-separated list of kafka brokers to read the watchfolder events from." introductionVersion:"6.0"` +} + // Events combines the configuration options for the event bus. type Events struct { Addr string `yaml:"endpoint" env:"OCIS_EVENTS_ENDPOINT;STORAGE_USERS_EVENTS_ENDPOINT" desc:"The address of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture." introductionVersion:"pre5.0"` diff --git a/services/storage-users/pkg/config/defaults/defaultconfig.go b/services/storage-users/pkg/config/defaults/defaultconfig.go index f165fbdc53..9cbb4b160d 100644 --- a/services/storage-users/pkg/config/defaults/defaultconfig.go +++ b/services/storage-users/pkg/config/defaults/defaultconfig.go @@ -116,7 +116,9 @@ func DefaultConfig() *config.Config { ConcurrentStreamParts: true, NumThreads: 4, PersonalSpaceAliasTemplate: "{{.SpaceType}}/{{.User.Username | lower}}", + PersonalSpacePathTemplate: "", GeneralSpaceAliasTemplate: "{{.SpaceType}}/{{.SpaceName | replace \" \" \"-\" | lower}}", + GeneralSpacePathTemplate: "", PermissionsEndpoint: "com.owncloud.api.settings", MaxAcquireLockCycles: 20, MaxConcurrency: 5, @@ -130,13 +132,21 @@ func DefaultConfig() *config.Config { ShareFolder: "/Shares", UserLayout: "{{.Id.OpaqueId}}", PersonalSpaceAliasTemplate: "{{.SpaceType}}/{{.User.Username | lower}}", + PersonalSpacePathTemplate: "", GeneralSpaceAliasTemplate: "{{.SpaceType}}/{{.SpaceName | replace \" \" \"-\" | lower}}", + GeneralSpacePathTemplate: "", PermissionsEndpoint: "com.owncloud.api.settings", MaxAcquireLockCycles: 20, MaxConcurrency: 5, LockCycleDurationFactor: 30, AsyncUploads: true, }, + Posix: config.PosixDriver{ + UseSpaceGroups: false, + PersonalSpacePathTemplate: "users/{{.User.Username}}", + GeneralSpacePathTemplate: "projects/{{.SpaceId}}", + PermissionsEndpoint: "com.owncloud.api.settings", + }, }, Events: config.Events{ Addr: "127.0.0.1:9233", diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index 841a319099..8d3c108e92 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -84,6 +84,33 @@ func Local(cfg *config.Config) map[string]interface{} { } } +// Posix is the config mapping for the Posix storage driver +func Posix(cfg *config.Config) map[string]interface{} { + return map[string]interface{}{ + "root": cfg.Drivers.Posix.Root, + "personalspacepath_template": cfg.Drivers.Posix.PersonalSpacePathTemplate, + "generalspacepath_template": cfg.Drivers.Posix.GeneralSpacePathTemplate, + "permissionssvc": cfg.Drivers.Posix.PermissionsEndpoint, + "permissionssvc_tls_mode": cfg.Commons.GRPCClientTLS.Mode, + "treetime_accounting": true, + "treesize_accounting": true, + "idcache": map[string]interface{}{ + "cache_store": cfg.IDCache.Store, + "cache_nodes": cfg.IDCache.Nodes, + "cache_database": cfg.IDCache.Database, + "cache_ttl": cfg.IDCache.TTL, + "cache_size": cfg.IDCache.Size, + "cache_disable_persistence": cfg.IDCache.DisablePersistence, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, + }, + "use_space_groups": cfg.Drivers.Posix.UseSpaceGroups, + "watch_type": cfg.Drivers.Posix.WatchType, + "watch_path": cfg.Drivers.Posix.WatchPath, + "watch_folder_kafka_brokers": cfg.Drivers.Posix.WatchFolderKafkaBrokers, + } +} + // LocalHome is the config mapping for the LocalHome storage driver func LocalHome(cfg *config.Config) map[string]interface{} { return map[string]interface{}{ @@ -122,7 +149,9 @@ func Ocis(cfg *config.Config) map[string]interface{} { "user_layout": cfg.Drivers.OCIS.UserLayout, "share_folder": cfg.Drivers.OCIS.ShareFolder, "personalspacealias_template": cfg.Drivers.OCIS.PersonalSpaceAliasTemplate, + "personalspacepath_template": cfg.Drivers.OCIS.PersonalSpacePathTemplate, "generalspacealias_template": cfg.Drivers.OCIS.GeneralSpaceAliasTemplate, + "generalspacepath_template": cfg.Drivers.OCIS.GeneralSpacePathTemplate, "treetime_accounting": true, "treesize_accounting": true, "permissionssvc": cfg.Drivers.OCIS.PermissionsEndpoint, @@ -176,7 +205,9 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "user_layout": cfg.Drivers.OCIS.UserLayout, "share_folder": cfg.Drivers.OCIS.ShareFolder, "personalspacealias_template": cfg.Drivers.OCIS.PersonalSpaceAliasTemplate, + "personalspacepath_template": cfg.Drivers.OCIS.PersonalSpacePathTemplate, "generalspacealias_template": cfg.Drivers.OCIS.GeneralSpaceAliasTemplate, + "generalspacepath_template": cfg.Drivers.OCIS.GeneralSpacePathTemplate, "treetime_accounting": true, "treesize_accounting": true, "permissionssvc": cfg.Drivers.OCIS.PermissionsEndpoint, @@ -232,8 +263,10 @@ func S3NG(cfg *config.Config) map[string]interface{} { "root": cfg.Drivers.S3NG.Root, "user_layout": cfg.Drivers.S3NG.UserLayout, "share_folder": cfg.Drivers.S3NG.ShareFolder, - "personalspacealias_template": cfg.Drivers.S3NG.PersonalSpaceAliasTemplate, - "generalspacealias_template": cfg.Drivers.S3NG.GeneralSpaceAliasTemplate, + "personalspacealias_template": cfg.Drivers.OCIS.PersonalSpaceAliasTemplate, + "personalspacepath_template": cfg.Drivers.OCIS.PersonalSpacePathTemplate, + "generalspacealias_template": cfg.Drivers.OCIS.GeneralSpaceAliasTemplate, + "generalspacepath_template": cfg.Drivers.OCIS.GeneralSpacePathTemplate, "treetime_accounting": true, "treesize_accounting": true, "permissionssvc": cfg.Drivers.S3NG.PermissionsEndpoint, @@ -296,8 +329,10 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "root": cfg.Drivers.S3NG.Root, "user_layout": cfg.Drivers.S3NG.UserLayout, "share_folder": cfg.Drivers.S3NG.ShareFolder, - "personalspacealias_template": cfg.Drivers.S3NG.PersonalSpaceAliasTemplate, - "generalspacealias_template": cfg.Drivers.S3NG.GeneralSpaceAliasTemplate, + "personalspacealias_template": cfg.Drivers.OCIS.PersonalSpaceAliasTemplate, + "personalspacepath_template": cfg.Drivers.OCIS.PersonalSpacePathTemplate, + "generalspacealias_template": cfg.Drivers.OCIS.GeneralSpaceAliasTemplate, + "generalspacepath_template": cfg.Drivers.OCIS.GeneralSpacePathTemplate, "treetime_accounting": true, "treesize_accounting": true, "permissionssvc": cfg.Drivers.S3NG.PermissionsEndpoint, diff --git a/services/storage-users/pkg/revaconfig/user.go b/services/storage-users/pkg/revaconfig/user.go index ef64d94b20..29a26af32b 100644 --- a/services/storage-users/pkg/revaconfig/user.go +++ b/services/storage-users/pkg/revaconfig/user.go @@ -14,6 +14,7 @@ func StorageProviderDrivers(cfg *config.Config) map[string]interface{} { "ocis": OcisNoEvents(cfg), "s3": S3(cfg), "s3ng": S3NGNoEvents(cfg), + "posix": Posix(cfg), } } @@ -29,5 +30,6 @@ func DataProviderDrivers(cfg *config.Config) map[string]interface{} { "ocis": Ocis(cfg), "s3": S3(cfg), "s3ng": S3NG(cfg), + "posix": Posix(cfg), } }