From 4950bcb7f46e83d9a4d6df85293dbb2c4f86dee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 25 Jan 2024 15:48:18 +0100 Subject: [PATCH 1/2] make storage users service name configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer add example how to add a new storage provider to the storage registry Signed-off-by: Jörn Friedrich Dreyer --- services/gateway/README.md | 72 +++++++++++++++++++++ services/storage-users/pkg/config/config.go | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/services/gateway/README.md b/services/gateway/README.md index a4d9af865..f4ead34ba 100644 --- a/services/gateway/README.md +++ b/services/gateway/README.md @@ -30,3 +30,75 @@ Store specific notes: - When using `redis-sentinel`, the Redis master to use is configured via e.g. `OCIS_CACHE_STORE_NODES` in the form of `:/` like `10.10.0.200:26379/mymaster`. - When using `nats-js-kv` it is recommended to set `OCIS_CACHE_STORE_NODES` to the same value as `OCIS_EVENTS_ENDPOINT`. That way the cache uses the same nats instance as the event bus. - When using the `nats-js-kv` store, it is possible to set `OCIS_CACHE_DISABLE_PERSISTENCE` to instruct nats to not persist cache data on disc. + +## Storage registry + +In order to add another storage provider the CS3 storage registry that is running as part of the CS3 gateway hes to be made aware of it. The easiest cleanest way to do it is to set `GATEWAY_STORAGE_REGISTRY_CONFIG_JSON=/path/to/storages.json` and list all storage providers like this: + +```json +{ + "com.owncloud.api.storage-users": { + "providerid": "{storage-users-mount-uuid}", + "spaces": { + "personal": { + "mount_point": "/users", + "path_template": "/users/{{.Space.Owner.Id.OpaqueId}}" + }, + "project": { + "mount_point": "/projects", + "path_template": "/projects/{{.Space.Name}}" + } + } + }, + "com.owncloud.api.storage-shares": { + "providerid": "a0ca6a90-a365-4782-871e-d44447bbc668", + "spaces": { + "virtual": { + "mount_point": "/users/{{.CurrentUser.Id.OpaqueId}}/Shares" + }, + "grant": { + "mount_point": "." + }, + "mountpoint": { + "mount_point": "/users/{{.CurrentUser.Id.OpaqueId}}/Shares", + "path_template": "/users/{{.CurrentUser.Id.OpaqueId}}/Shares/{{.Space.Name}}" + } + } + }, + "com.owncloud.api.storage-publiclink": { + "providerid": "7993447f-687f-490d-875c-ac95e89a62a4", + "spaces": { + "grant": { + "mount_point": "." + }, + "mountpoint": { + "mount_point": "/public", + "path_template": "/public/{{.Space.Root.OpaqueId}}" + } + } + }, + "com.owncloud.api.ocm": { + "providerid": "89f37a33-858b-45fa-8890-a1f2b27d90e1", + "spaces": { + "grant": { + "mount_point": "." + }, + "mountpoint": { + "mount_point": "/ocm", + "path_template": "/ocm/{{.Space.Root.OpaqueId}}" + } + } + }, + "com.owncloud.api.storage-hello": { + "providerid": "hello-storage-id", + "spaces": { + "project": { + "mount_point": "/hello", + "path_template": "/hello/{{.Space.Name}}" + } + } + } +} +``` + +In the above replace `{storage-users-mount-uuid}` with the mount UUID that was generated for the storage-users service. You can find it in the `config.yaml` generated on by `ocis init`. The last entry `com.owncloud.api.storage-hello` and its `providerid` `"hello-storage-id"` are an example for in additional storage provider, in this case running `hellofs`, an example minimal storage driver. \ No newline at end of file diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 2cbee246a..d69257fc7 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -59,7 +59,7 @@ type Log struct { // Service holds general service configuration type Service struct { - Name string `yaml:"-"` + Name string `yaml:"-" env:"STORAGE_USERS_SERVICE_NAME" desc:"Service name to use. Change this when starting an additional storage provider with a custom configuration to prevent it from colliding with the default 'storage-users' service."` } // Debug is the configuration for the debug server From 052ebf164507ecad18a153e9d6e29125c074b210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 30 Jul 2024 17:13:32 +0200 Subject: [PATCH 2/2] Update services/storage-users/pkg/config/config.go Co-authored-by: Christian Richter <1058116+dragonchaser@users.noreply.github.com> --- services/storage-users/pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index d69257fc7..ef852f661 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -59,7 +59,7 @@ type Log struct { // Service holds general service configuration type Service struct { - Name string `yaml:"-" env:"STORAGE_USERS_SERVICE_NAME" desc:"Service name to use. Change this when starting an additional storage provider with a custom configuration to prevent it from colliding with the default 'storage-users' service."` + Name string `yaml:"-" env:"STORAGE_USERS_SERVICE_NAME" desc:"Service name to use. Change this when starting an additional storage provider with a custom configuration to prevent it from colliding with the default 'storage-users' service." introductionVersion:"%%NEXT%%"` } // Debug is the configuration for the debug server