From f960ae4d646b5bacc7e8c18c593f5ac9ae91d080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 12 Aug 2024 13:48:23 +0200 Subject: [PATCH 1/2] add OCIS_ENABLE_OCM env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .drone.star | 3 +-- .vscode/launch.json | 7 +------ changelog/unreleased/add-enable-ocm-variable.md | 5 +++++ docs/ocis/development/testing.md | 14 ++------------ ocis-pkg/config/config.go | 1 + ocis/pkg/runtime/service/service.go | 5 +++++ services/frontend/pkg/config/config.go | 8 ++++---- services/graph/pkg/config/config.go | 2 +- tests/config/drone/.env-federation | 7 +------ 9 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 changelog/unreleased/add-enable-ocm-variable.md diff --git a/.drone.star b/.drone.star index 2c9885d2b3c..97df8b23f48 100644 --- a/.drone.star +++ b/.drone.star @@ -145,8 +145,7 @@ config = { "skip": False, "federationServer": True, "extraServerEnvironment": { - "OCIS_ADD_RUN_SERVICES": "ocm", - "GRAPH_INCLUDE_OCM_SHAREES": True, + "OCIS_ENABLE_OCM": True, "OCM_OCM_INVITE_MANAGER_INSECURE": True, "OCM_OCM_SHARE_PROVIDER_INSECURE": True, "OCM_OCM_STORAGE_PROVIDER_INSECURE": True, diff --git a/.vscode/launch.json b/.vscode/launch.json index 245bb816660..b98f49c6b55 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -88,18 +88,13 @@ "OCM_OCM_INVITE_MANAGER_INSECURE": "true", "OCM_OCM_SHARE_PROVIDER_INSECURE": "true", "OCM_OCM_STORAGE_PROVIDER_INSECURE": "true", - "FRONTEND_OCS_INCLUDE_OCM_SHAREES": "true", "OCIS_BASE_DATA_PATH": "${env:HOME}/.ocis-10200", "OCIS_CONFIG_DIR": "${env:HOME}/.ocis-10200/config", "OCIS_EVENTS_ENDPOINT": "127.0.0.1:10233", "OCIS_LDAP_URI": "ldaps://localhost:10235", "OCIS_RUNTIME_PORT": "10250", "OCIS_URL": "https://federation-ocis-server:10200", - "FRONTEND_OCS_LIST_OCM_SHARES": "true", - "FRONTEND_ENABLE_FEDERATED_SHARING_INCOMING": "true", - "FRONTEND_ENABLE_FEDERATED_SHARING_OUTGOING": "true", - "OCIS_ADD_RUN_SERVICES": "ocm", - "GRAPH_INCLUDE_OCM_SHAREES": "true", + "OCIS_ENABLE_OCM": "true", "APP_PROVIDER_DEBUG_ADDR": "127.0.0.1:10165", "APP_PROVIDER_GRPC_ADDR": "127.0.0.1:10164", "APP_REGISTRY_DEBUG_ADDR": "127.0.0.1:10243", diff --git a/changelog/unreleased/add-enable-ocm-variable.md b/changelog/unreleased/add-enable-ocm-variable.md new file mode 100644 index 00000000000..409abdbb89b --- /dev/null +++ b/changelog/unreleased/add-enable-ocm-variable.md @@ -0,0 +1,5 @@ +Enhancement: Add OCIS_ENABLE_OCM env var + +We added a new `OCIS_ENABLE_OCM` env var that will enable all ocm flags and add `ocm` to the services started by the runtime. + +https://github.com/owncloud/ocis/pull/9784 diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 933c6969fe4..97eabe45901 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -556,12 +556,8 @@ in the `/etc/hosts` file # run oCIS OCIS_URL="https://ocis-server:9200" \ PROXY_ENABLE_BASIC_AUTH=true \ -GRAPH_INCLUDE_OCM_SHAREES=true \ -OCM_OCM_INVITE_MANAGER_INSECURE=true \ -OCM_OCM_SHARE_PROVIDER_INSECURE=true \ -OCM_OCM_STORAGE_PROVIDER_INSECURE=true \ +OCIS_ENABLE_OCM=true \ OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE="${workspaceFolder}/tests/config/drone/providers.json" \ -OCIS_ADD_RUN_SERVICES="ocm" \ ocis/bin/ocis server ``` @@ -583,13 +579,7 @@ ocis/bin/ocis server The second oCIS instance should be available at: https://federation-ocis-server:10200/ {{< hint info >}} -To enable ocm in the web interface, you need to set the following envs: -`FRONTEND_OCS_INCLUDE_OCM_SHAREES=true` \ -`FRONTEND_OCS_LIST_OCM_SHARES=true` \ -`FRONTEND_ENABLE_FEDERATED_SHARING_INCOMING=true` \ -`FRONTEND_ENABLE_FEDERATED_SHARING_OUTGOING=true` \ - -and put `ocm` to apps https://github.com/owncloud/ocis/blob/master/services/web/pkg/config/defaults/defaultconfig.go#L101 +To enable ocm in the web interface, you need to set `OCIS_ENABLE_OCM=true`. It will enable all ocm flags and start the ocm service when running `ocis server`. {{< /hint>}} #### Run the Acceptance Test diff --git a/ocis-pkg/config/config.go b/ocis-pkg/config/config.go index 79926807fb6..a5cd63f3daf 100644 --- a/ocis-pkg/config/config.go +++ b/ocis-pkg/config/config.go @@ -56,6 +56,7 @@ type Runtime struct { Services []string `yaml:"services" env:"OCIS_RUN_EXTENSIONS;OCIS_RUN_SERVICES" desc:"A comma-separated list of service names. Will start only the listed services." introductionVersion:"pre5.0"` Disabled []string `yaml:"disabled_services" env:"OCIS_EXCLUDE_RUN_SERVICES" desc:"A comma-separated list of service names. Will start all default services except of the ones listed. Has no effect when OCIS_RUN_SERVICES is set." introductionVersion:"pre5.0"` Additional []string `yaml:"add_services" env:"OCIS_ADD_RUN_SERVICES" desc:"A comma-separated list of service names. Will add the listed services to the default configuration. Has no effect when OCIS_RUN_SERVICES is set. Note that one can add services not started by the default list and exclude services from the default list by using both envvars at the same time." introductionVersion:"pre5.0"` + EnableOCM bool `yaml:"enable_ocm" env:"OCIS_ENABLE_OCM" desc:"Enable all OCM config flags and start the ocm service." introductionVersion:"%%NEXT%%"` } // Config combines all available configuration parts. diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index 311d6f7c1ea..89edf1a8b42 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -473,6 +473,11 @@ func (s *Service) generateRunSet(cfg *ociscfg.Config) { runset[name] = struct{}{} } + // add ocm service if explicitly enabled by config + if cfg.Runtime.EnableOCM { + runset[cfg.OCM.Service.Name] = struct{}{} + } + // remove services if explicitly excluded by config for _, name := range cfg.Runtime.Disabled { delete(runset, name) diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index ed0f43d0069..0ccc7cf997d 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -31,8 +31,8 @@ type Config struct { UploadMaxChunkSize int `yaml:"upload_max_chunk_size" env:"FRONTEND_UPLOAD_MAX_CHUNK_SIZE" desc:"Sets the max chunk sizes in bytes for uploads via the clients." introductionVersion:"pre5.0"` UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests." introductionVersion:"pre5.0"` DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in clients. Currently only 'tus' is available. See the developer API documentation for more details about TUS." introductionVersion:"pre5.0"` - EnableFederatedSharingIncoming bool `yaml:"enable_federated_sharing_incoming" env:"FRONTEND_ENABLE_FEDERATED_SHARING_INCOMING" desc:"Changing this value is NOT supported. Enables support for incoming federated sharing for clients. The backend behaviour is not changed." introductionVersion:"pre5.0"` - EnableFederatedSharingOutgoing bool `yaml:"enable_federated_sharing_outgoing" env:"FRONTEND_ENABLE_FEDERATED_SHARING_OUTGOING" desc:"Changing this value is NOT supported. Enables support for outgoing federated sharing for clients. The backend behaviour is not changed." introductionVersion:"pre5.0"` + EnableFederatedSharingIncoming bool `yaml:"enable_federated_sharing_incoming" env:"OCIS_ENABLE_OCM;FRONTEND_ENABLE_FEDERATED_SHARING_INCOMING" desc:"Changing this value is NOT supported. Enables support for incoming federated sharing for clients. The backend behaviour is not changed." introductionVersion:"pre5.0"` + EnableFederatedSharingOutgoing bool `yaml:"enable_federated_sharing_outgoing" env:"OCIS_ENABLE_OCM;FRONTEND_ENABLE_FEDERATED_SHARING_OUTGOING" desc:"Changing this value is NOT supported. Enables support for outgoing federated sharing for clients. The backend behaviour is not changed." introductionVersion:"pre5.0"` SearchMinLength int `yaml:"search_min_length" env:"FRONTEND_SEARCH_MIN_LENGTH" desc:"Minimum number of characters to enter before a client should start a search for Share receivers. This setting can be used to customize the user experience if e.g too many results are displayed." introductionVersion:"pre5.0"` Edition string `yaml:"edition" env:"OCIS_EDITION;FRONTEND_EDITION" desc:"Edition of oCIS. Used for branding purposes." introductionVersion:"pre5.0"` DisableSSE bool `yaml:"disable_sse" env:"OCIS_DISABLE_SSE;FRONTEND_DISABLE_SSE" desc:"When set to true, clients are informed that the Server-Sent Events endpoint is not accessible." introductionVersion:"pre5.0"` @@ -141,10 +141,10 @@ type OCS struct { CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs EnableDenials bool `yaml:"enable_denials" env:"FRONTEND_OCS_ENABLE_DENIALS" desc:"EXPERIMENTAL: enable the feature to deny access on folders." introductionVersion:"pre5.0"` - ListOCMShares bool `yaml:"list_ocm_shares" env:"FRONTEND_OCS_LIST_OCM_SHARES" desc:"Include OCM shares when listing shares. See the OCM service documentation for more details." introductionVersion:"5.0"` + ListOCMShares bool `yaml:"list_ocm_shares" env:"OCIS_ENABLE_OCM;FRONTEND_OCS_LIST_OCM_SHARES" desc:"Include OCM shares when listing shares. See the OCM service documentation for more details." introductionVersion:"5.0"` + IncludeOCMSharees bool `yaml:"include_ocm_sharees" env:"OCIS_ENABLE_OCM;FRONTEND_OCS_INCLUDE_OCM_SHAREES" desc:"Include OCM sharees when listing sharees." introductionVersion:"5.0"` PublicShareMustHavePassword bool `yaml:"public_sharing_share_must_have_password" env:"OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD;FRONTEND_OCS_PUBLIC_SHARE_MUST_HAVE_PASSWORD" desc:"Set this to true if you want to enforce passwords on all public shares." introductionVersion:"5.0"` WriteablePublicShareMustHavePassword bool `yaml:"public_sharing_writeableshare_must_have_password" env:"OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD;FRONTEND_OCS_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD" desc:"Set this to true if you want to enforce passwords for writable shares. Only effective if the setting for 'passwords on all public shares' is set to false." introductionVersion:"5.0"` - IncludeOCMSharees bool `yaml:"include_ocm_sharees" env:"FRONTEND_OCS_INCLUDE_OCM_SHAREES" desc:"Include OCM sharees when listing sharees." introductionVersion:"5.0"` ShowUserEmailInResults bool `yaml:"show_email_in_results" env:"OCIS_SHOW_USER_EMAIL_IN_RESULTS" desc:"Include user email addresses in responses. If absent or set to false emails will be omitted from results. Please note that admin users can always see all email addresses." introductionVersion:"6.0.0"` } diff --git a/services/graph/pkg/config/config.go b/services/graph/pkg/config/config.go index f99b5e40e2c..31a9ce39b66 100644 --- a/services/graph/pkg/config/config.go +++ b/services/graph/pkg/config/config.go @@ -28,7 +28,7 @@ type Config struct { Application Application `yaml:"application"` Spaces Spaces `yaml:"spaces"` Identity Identity `yaml:"identity"` - IncludeOCMSharees bool `yaml:"include_ocm_sharees" env:"GRAPH_INCLUDE_OCM_SHAREES" desc:"Include OCM sharees when listing users." introductionVersion:"5.0"` + IncludeOCMSharees bool `yaml:"include_ocm_sharees" env:"OCIS_ENABLE_OCM;GRAPH_INCLUDE_OCM_SHAREES" desc:"Include OCM sharees when listing users." introductionVersion:"5.0"` Events Events `yaml:"events"` Keycloak Keycloak `yaml:"keycloak"` diff --git a/tests/config/drone/.env-federation b/tests/config/drone/.env-federation index 6e381baaac6..ca69c3554e2 100644 --- a/tests/config/drone/.env-federation +++ b/tests/config/drone/.env-federation @@ -2,18 +2,13 @@ export OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE=tests/config/drone/providers.j export OCM_OCM_INVITE_MANAGER_INSECURE=true export OCM_OCM_SHARE_PROVIDER_INSECURE=true export OCM_OCM_STORAGE_PROVIDER_INSECURE=true -export FRONTEND_OCS_INCLUDE_OCM_SHAREES=true export OCIS_BASE_DATA_PATH=${HOME}/.ocis-10200 export OCIS_CONFIG_DIR=${HOME}/.ocis-10200/config export OCIS_EVENTS_ENDPOINT=127.0.0.1:10233 export OCIS_LDAP_URI=ldaps://localhost:10235 export OCIS_RUNTIME_PORT=10250 export OCIS_URL=https://federation-ocis-server:10200 -export FRONTEND_OCS_LIST_OCM_SHARES=true -export FRONTEND_ENABLE_FEDERATED_SHARING_INCOMING=true -export FRONTEND_ENABLE_FEDERATED_SHARING_OUTGOING=true -export OCIS_ADD_RUN_SERVICES=ocm -export GRAPH_INCLUDE_OCM_SHAREES=true +export OCIS_ENABLE_OCM=true export APP_PROVIDER_DEBUG_ADDR=127.0.0.1:10165 export APP_PROVIDER_GRPC_ADDR=127.0.0.1:10164 export APP_REGISTRY_DEBUG_ADDR=127.0.0.1:10243 From d61e2c18b78f4c95e546fb8805be017f026c94cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 12 Aug 2024 16:53:56 +0200 Subject: [PATCH 2/2] remove runtime changes for OCIS_ENABLE_OCM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .drone.star | 1 + .vscode/launch.json | 1 + changelog/unreleased/add-enable-ocm-variable.md | 2 +- docs/ocis/development/testing.md | 5 ++++- ocis-pkg/config/config.go | 1 - ocis/pkg/runtime/service/service.go | 5 ----- tests/config/drone/.env-federation | 1 + 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.drone.star b/.drone.star index 97df8b23f48..a93145542e9 100644 --- a/.drone.star +++ b/.drone.star @@ -145,6 +145,7 @@ config = { "skip": False, "federationServer": True, "extraServerEnvironment": { + "OCIS_ADD_RUN_SERVICES": "ocm", "OCIS_ENABLE_OCM": True, "OCM_OCM_INVITE_MANAGER_INSECURE": True, "OCM_OCM_SHARE_PROVIDER_INSECURE": True, diff --git a/.vscode/launch.json b/.vscode/launch.json index b98f49c6b55..cbe767ab9e0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -94,6 +94,7 @@ "OCIS_LDAP_URI": "ldaps://localhost:10235", "OCIS_RUNTIME_PORT": "10250", "OCIS_URL": "https://federation-ocis-server:10200", + "OCIS_ADD_RUN_SERVICES": "ocm", "OCIS_ENABLE_OCM": "true", "APP_PROVIDER_DEBUG_ADDR": "127.0.0.1:10165", "APP_PROVIDER_GRPC_ADDR": "127.0.0.1:10164", diff --git a/changelog/unreleased/add-enable-ocm-variable.md b/changelog/unreleased/add-enable-ocm-variable.md index 409abdbb89b..70e7ad709c5 100644 --- a/changelog/unreleased/add-enable-ocm-variable.md +++ b/changelog/unreleased/add-enable-ocm-variable.md @@ -1,5 +1,5 @@ Enhancement: Add OCIS_ENABLE_OCM env var -We added a new `OCIS_ENABLE_OCM` env var that will enable all ocm flags and add `ocm` to the services started by the runtime. +We added a new `OCIS_ENABLE_OCM` env var that will enable all ocm flags. https://github.com/owncloud/ocis/pull/9784 diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 97eabe45901..7955b9b2d83 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -558,6 +558,7 @@ OCIS_URL="https://ocis-server:9200" \ PROXY_ENABLE_BASIC_AUTH=true \ OCIS_ENABLE_OCM=true \ OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE="${workspaceFolder}/tests/config/drone/providers.json" \ +OCIS_ADD_RUN_SERVICES="ocm" \ ocis/bin/ocis server ``` @@ -579,7 +580,9 @@ ocis/bin/ocis server The second oCIS instance should be available at: https://federation-ocis-server:10200/ {{< hint info >}} -To enable ocm in the web interface, you need to set `OCIS_ENABLE_OCM=true`. It will enable all ocm flags and start the ocm service when running `ocis server`. +To enable ocm in the web interface, you need to set the following envs: +`OCIS_ENABLE_OCM="true"` +`OCIS_ADD_RUN_SERVICES="ocm"` {{< /hint>}} #### Run the Acceptance Test diff --git a/ocis-pkg/config/config.go b/ocis-pkg/config/config.go index a5cd63f3daf..79926807fb6 100644 --- a/ocis-pkg/config/config.go +++ b/ocis-pkg/config/config.go @@ -56,7 +56,6 @@ type Runtime struct { Services []string `yaml:"services" env:"OCIS_RUN_EXTENSIONS;OCIS_RUN_SERVICES" desc:"A comma-separated list of service names. Will start only the listed services." introductionVersion:"pre5.0"` Disabled []string `yaml:"disabled_services" env:"OCIS_EXCLUDE_RUN_SERVICES" desc:"A comma-separated list of service names. Will start all default services except of the ones listed. Has no effect when OCIS_RUN_SERVICES is set." introductionVersion:"pre5.0"` Additional []string `yaml:"add_services" env:"OCIS_ADD_RUN_SERVICES" desc:"A comma-separated list of service names. Will add the listed services to the default configuration. Has no effect when OCIS_RUN_SERVICES is set. Note that one can add services not started by the default list and exclude services from the default list by using both envvars at the same time." introductionVersion:"pre5.0"` - EnableOCM bool `yaml:"enable_ocm" env:"OCIS_ENABLE_OCM" desc:"Enable all OCM config flags and start the ocm service." introductionVersion:"%%NEXT%%"` } // Config combines all available configuration parts. diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index 89edf1a8b42..311d6f7c1ea 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -473,11 +473,6 @@ func (s *Service) generateRunSet(cfg *ociscfg.Config) { runset[name] = struct{}{} } - // add ocm service if explicitly enabled by config - if cfg.Runtime.EnableOCM { - runset[cfg.OCM.Service.Name] = struct{}{} - } - // remove services if explicitly excluded by config for _, name := range cfg.Runtime.Disabled { delete(runset, name) diff --git a/tests/config/drone/.env-federation b/tests/config/drone/.env-federation index ca69c3554e2..760aed4cbce 100644 --- a/tests/config/drone/.env-federation +++ b/tests/config/drone/.env-federation @@ -8,6 +8,7 @@ export OCIS_EVENTS_ENDPOINT=127.0.0.1:10233 export OCIS_LDAP_URI=ldaps://localhost:10235 export OCIS_RUNTIME_PORT=10250 export OCIS_URL=https://federation-ocis-server:10200 +export OCIS_ADD_RUN_SERVICES=ocm export OCIS_ENABLE_OCM=true export APP_PROVIDER_DEBUG_ADDR=127.0.0.1:10165 export APP_PROVIDER_GRPC_ADDR=127.0.0.1:10164