From 17370c2d7d4ce622158688d9abde4f279a7d07d5 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 23 Oct 2024 15:41:42 +0200 Subject: [PATCH 1/2] feat: add web extensions to the ocis_full example --- .../unreleased/web-extensions-example.md | 16 +++++++ deployments/examples/ocis_full/.env | 43 ++++++++++++------- .../examples/ocis_full/config/ocis/apps.yaml | 22 ++++++++++ .../examples/ocis_full/config/ocis/csp.yaml | 2 + .../examples/ocis_full/config/ocis/web.yaml | 18 -------- .../{ => web_extensions}/cloudimporter.yml | 14 +++++- .../ocis_full/web_extensions/drawio.yml | 15 +++++++ .../ocis_full/web_extensions/extensions.yml | 7 +++ .../web_extensions/externalsites.yml | 15 +++++++ .../ocis_full/web_extensions/jsonviewer.yml | 15 +++++++ .../ocis_full/web_extensions/progressbars.yml | 15 +++++++ .../ocis_full/web_extensions/unzip.yml | 17 ++++++++ 12 files changed, 165 insertions(+), 34 deletions(-) create mode 100644 changelog/unreleased/web-extensions-example.md create mode 100644 deployments/examples/ocis_full/config/ocis/apps.yaml delete mode 100644 deployments/examples/ocis_full/config/ocis/web.yaml rename deployments/examples/ocis_full/{ => web_extensions}/cloudimporter.yml (78%) create mode 100644 deployments/examples/ocis_full/web_extensions/drawio.yml create mode 100644 deployments/examples/ocis_full/web_extensions/extensions.yml create mode 100644 deployments/examples/ocis_full/web_extensions/externalsites.yml create mode 100644 deployments/examples/ocis_full/web_extensions/jsonviewer.yml create mode 100644 deployments/examples/ocis_full/web_extensions/progressbars.yml create mode 100644 deployments/examples/ocis_full/web_extensions/unzip.yml diff --git a/changelog/unreleased/web-extensions-example.md b/changelog/unreleased/web-extensions-example.md new file mode 100644 index 00000000000..4f442b0e8f8 --- /dev/null +++ b/changelog/unreleased/web-extensions-example.md @@ -0,0 +1,16 @@ +Enhancement: Add web extensions to the ocis_full example + +We added some of the web extensions from ownCloud to the ocis_full docker compose example. + +- importer +- draw-io +- external-sites +- json-viewer +- unzip +- progressbars + +These can be enabled in the .env file one by one. + +Read more about ocis extensions in https://github.com/owncloud/web-extensions/blob/main/README.md + +https://github.com/owncloud/ocis/pull/10399 diff --git a/deployments/examples/ocis_full/.env b/deployments/examples/ocis_full/.env index 8e5f10c28bf..a7ae7abbb5d 100644 --- a/deployments/examples/ocis_full/.env +++ b/deployments/examples/ocis_full/.env @@ -114,6 +114,33 @@ SMTP_AUTHENTICATION= # Allow insecure connections to the SMTP server. Defaults to false. SMTP_INSECURE= +## oCIS Web Extensions ## +# It is possible to use the oCIS Web Extensions to add custom functionality to the oCIS frontend. +# For more details see https://github.com/owncloud/web-extensions/blob/main/README.md +# Enable this to create a new named volume +EXTENSIONS=:web_extensions/extensions.yml +# Enable the desired extensions by uncommenting the following lines. +# Note: the leading colon is required to enable the service. +# Note: if you want to remove a web extension, please delete the ocis-apps volume and restart the docker-compose. +#UNZIP=:web_extensions/unzip.yml +#DRAWIO=:web_extensions/drawio.yml +#JSONVIEWER=:web_extensions/jsonviewer.yml +#PROGRESSBARS=:web_extensions/progressbars.yml +#EXTERNALSITES=:web_extensions/externalsites.yml +# External Sites needs additional config. +# - config/ocis/apps.yaml +# - config/ocis/csp.yaml +IMPORTER=:web_extensions/cloudimporter.yml +## The docker image to be used for uppy companion. +# owncloud has built a container with public link import support. +COMPANION_IMAGE= +# Domain of Uppy Companion. Defaults to "companion.owncloud.test". +COMPANION_DOMAIN= +# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference. +# Empty by default, which disables providers. +COMPANION_ONEDRIVE_KEY= +COMPANION_ONEDRIVE_SECRET= + ## Default Enabled Services ## @@ -163,20 +190,6 @@ COLLABORA_SSL_VERIFICATION=false #MONITORING=:monitoring_tracing/monitoring.yml -### Uppy Companion Settings ### -# Note: the leading colon is required to enable the service. -#CLOUD_IMPORTER=:cloudimporter.yml -## The docker image to be used for uppy companion. -# owncloud has built a container with public link import support. -COMPANION_IMAGE= -# Domain of Uppy Companion. Defaults to "companion.owncloud.test". -COMPANION_DOMAIN= -# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference. -# Empty by default, which disables providers. -COMPANION_ONEDRIVE_KEY= -COMPANION_ONEDRIVE_SECRET= - - ### Virusscanner Settings ### # Note: the leading colon is required to enable the service. #CLAMAV=:clamav.yml @@ -208,4 +221,4 @@ INBUCKET_DOMAIN= # This MUST be the last line as it assembles the supplemental compose files to be used. # ALL supplemental configs must be added here, whether commented or not. # Each var must either be empty or contain :path/file.yml -COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${S3NG:-}${S3NG_MINIO:-}${COLLABORA:-}${MONITORING:-}${CLOUD_IMPORTER:-}${CLAMAV:-}${ONLYOFFICE:-}${INBUCKET:-} +COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${S3NG:-}${S3NG_MINIO:-}${COLLABORA:-}${MONITORING:-}${IMPORTER:-}${CLAMAV:-}${ONLYOFFICE:-}${INBUCKET:-}${EXTENSIONS:-}${UNZIP:-}${DRAWIO:-}${JSONVIEWER:-}${PROGRESSBARS:-}${EXTERNALSITES:-} diff --git a/deployments/examples/ocis_full/config/ocis/apps.yaml b/deployments/examples/ocis_full/config/ocis/apps.yaml new file mode 100644 index 00000000000..f75fc70c197 --- /dev/null +++ b/deployments/examples/ocis_full/config/ocis/apps.yaml @@ -0,0 +1,22 @@ +importer: + config: + companionUrl: https://${COMPANION_DOMAIN|companion.owncloud.test} + supportedClouds: + - WebdavPublicLink + #- OneDrive # needs a client id and secret + #- GoogleDrive # needs a client id and secret and an addition to the DNS zone +external-sites: + config: + sites: + - name: ownCloud + url: "https://owncloud.dev" + target: embedded + color: "#0D856F" + icon: cloud + priority: 50 + - name: Wikipedia + url: "https://www.wikipedia.org" + target: external + color: "#0D856F" + icon: book + priority: 51 diff --git a/deployments/examples/ocis_full/config/ocis/csp.yaml b/deployments/examples/ocis_full/config/ocis/csp.yaml index fb46082e7dc..b8e5813d3d7 100644 --- a/deployments/examples/ocis_full/config/ocis/csp.yaml +++ b/deployments/examples/ocis_full/config/ocis/csp.yaml @@ -20,6 +20,8 @@ directives: # In contrary to bash and docker the default is given after the | character - 'https://${ONLYOFFICE_DOMAIN|onlyoffice.owncloud.test}/' - 'https://${COLLABORA_DOMAIN|collabora.owncloud.test}/' + # This is needed for the external-sites web extension when embedding sites + - 'https://owncloud.dev' img-src: - '''self''' - 'data:' diff --git a/deployments/examples/ocis_full/config/ocis/web.yaml b/deployments/examples/ocis_full/config/ocis/web.yaml deleted file mode 100644 index 9ffff94810f..00000000000 --- a/deployments/examples/ocis_full/config/ocis/web.yaml +++ /dev/null @@ -1,18 +0,0 @@ -web: - config: - external_apps: - - id: preview - path: web-app-preview - config: - mimeTypes: - - image/tiff - - image/bmp - - image/x-ms-bmp - - id: importer - path: web-app-importer - config: - companionUrl: https://${COMPANION_DOMAIN|companion.owncloud.test} - supportedClouds: - - WebdavPublicLink - #- OneDrive # needs a client id and secret - #- GoogleDrive # needs a client id and secret and an addition to the DNS zone diff --git a/deployments/examples/ocis_full/cloudimporter.yml b/deployments/examples/ocis_full/web_extensions/cloudimporter.yml similarity index 78% rename from deployments/examples/ocis_full/cloudimporter.yml rename to deployments/examples/ocis_full/web_extensions/cloudimporter.yml index 7438a8baa94..82f36486bac 100644 --- a/deployments/examples/ocis_full/cloudimporter.yml +++ b/deployments/examples/ocis_full/web_extensions/cloudimporter.yml @@ -8,7 +8,19 @@ services: ocis: volumes: # the cloud importer needs to be enabled in the web.yaml - - ./config/ocis/web.yaml:/etc/ocis/web.yaml + - ./config/ocis/apps.yaml:/etc/ocis/apps.yaml + depends_on: + importer-init: + condition: service_completed_successfully + + importer-init: + image: owncloud/web-extensions:importer-0.1.0 + user: root + volumes: + - ocis-apps:/apps + entrypoint: + - /bin/sh + command: [ "-c", "cp -R /var/lib/nginx/html/importer/ /apps" ] companion: image: ${COMPANION_IMAGE:-owncloud/uppy-companion:3.12.13-owncloud} diff --git a/deployments/examples/ocis_full/web_extensions/drawio.yml b/deployments/examples/ocis_full/web_extensions/drawio.yml new file mode 100644 index 00000000000..4feaac7997b --- /dev/null +++ b/deployments/examples/ocis_full/web_extensions/drawio.yml @@ -0,0 +1,15 @@ +--- +services: + ocis: + depends_on: + drawio-init: + condition: service_completed_successfully + + drawio-init: + image: owncloud/web-extensions:draw-io-0.2.0 + user: root + volumes: + - ocis-apps:/apps + entrypoint: + - /bin/sh + command: ["-c", "cp -R /var/lib/nginx/html/draw-io/ /apps"] diff --git a/deployments/examples/ocis_full/web_extensions/extensions.yml b/deployments/examples/ocis_full/web_extensions/extensions.yml new file mode 100644 index 00000000000..d2a60a039b9 --- /dev/null +++ b/deployments/examples/ocis_full/web_extensions/extensions.yml @@ -0,0 +1,7 @@ +services: + ocis: + volumes: + - ocis-apps:/var/lib/ocis/web/assets/apps + +volumes: + ocis-apps: diff --git a/deployments/examples/ocis_full/web_extensions/externalsites.yml b/deployments/examples/ocis_full/web_extensions/externalsites.yml new file mode 100644 index 00000000000..378fe432808 --- /dev/null +++ b/deployments/examples/ocis_full/web_extensions/externalsites.yml @@ -0,0 +1,15 @@ +--- +services: + ocis: + depends_on: + externalsites-init: + condition: service_completed_successfully + + externalsites-init: + image: owncloud/web-extensions:external-sites-0.2.0 + user: root + volumes: + - ocis-apps:/apps + entrypoint: + - /bin/sh + command: ["-c", "cp -R /var/lib/nginx/html/external-sites/ /apps"] diff --git a/deployments/examples/ocis_full/web_extensions/jsonviewer.yml b/deployments/examples/ocis_full/web_extensions/jsonviewer.yml new file mode 100644 index 00000000000..7d03a290677 --- /dev/null +++ b/deployments/examples/ocis_full/web_extensions/jsonviewer.yml @@ -0,0 +1,15 @@ +--- +services: + ocis: + depends_on: + jsonviewer-init: + condition: service_completed_successfully + + jsonviewer-init: + image: owncloud/web-extensions:json-viewer-0.2.0 + user: root + volumes: + - ocis-apps:/apps + entrypoint: + - /bin/sh + command: ["-c", "cp -R /var/lib/nginx/html/json-viewer/ /apps"] diff --git a/deployments/examples/ocis_full/web_extensions/progressbars.yml b/deployments/examples/ocis_full/web_extensions/progressbars.yml new file mode 100644 index 00000000000..e40d1fe4238 --- /dev/null +++ b/deployments/examples/ocis_full/web_extensions/progressbars.yml @@ -0,0 +1,15 @@ +--- +services: + ocis: + depends_on: + progressbars-init: + condition: service_completed_successfully + + progressbars-init: + image: owncloud/web-extensions:progress-bars-0.2.0 + user: root + volumes: + - ocis-apps:/apps + entrypoint: + - /bin/sh + command: ["-c", "cp -R /var/lib/nginx/html/progress-bars/ /apps"] diff --git a/deployments/examples/ocis_full/web_extensions/unzip.yml b/deployments/examples/ocis_full/web_extensions/unzip.yml new file mode 100644 index 00000000000..024596e44f8 --- /dev/null +++ b/deployments/examples/ocis_full/web_extensions/unzip.yml @@ -0,0 +1,17 @@ +--- +services: + ocis: + depends_on: + unzip-init: + condition: service_completed_successfully + + unzip-init: + image: owncloud/web-extensions:unzip-0.3.0 + user: root + volumes: + - ocis-apps:/apps + entrypoint: + - /bin/sh + command: ["-c", "cp -R /var/lib/nginx/html/unzip/ /apps"] + + From d65e68ff3509bc131a3dfd9e1ccfa99643665bb5 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 23 Oct 2024 16:27:14 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Martin --- deployments/examples/ocis_full/.env | 9 +++++---- deployments/examples/ocis_full/config/ocis/apps.yaml | 1 + .../web_extensions/{cloudimporter.yml => importer.yml} | 0 3 files changed, 6 insertions(+), 4 deletions(-) rename deployments/examples/ocis_full/web_extensions/{cloudimporter.yml => importer.yml} (100%) diff --git a/deployments/examples/ocis_full/.env b/deployments/examples/ocis_full/.env index a7ae7abbb5d..fb0ac765e93 100644 --- a/deployments/examples/ocis_full/.env +++ b/deployments/examples/ocis_full/.env @@ -118,19 +118,20 @@ SMTP_INSECURE= # It is possible to use the oCIS Web Extensions to add custom functionality to the oCIS frontend. # For more details see https://github.com/owncloud/web-extensions/blob/main/README.md # Enable this to create a new named volume -EXTENSIONS=:web_extensions/extensions.yml +#EXTENSIONS=:web_extensions/extensions.yml # Enable the desired extensions by uncommenting the following lines. # Note: the leading colon is required to enable the service. -# Note: if you want to remove a web extension, please delete the ocis-apps volume and restart the docker-compose. +# Note: if you want to remove a web extension, you must delete the ocis-apps volume. It will be properly recreated on docker compose startup. #UNZIP=:web_extensions/unzip.yml #DRAWIO=:web_extensions/drawio.yml #JSONVIEWER=:web_extensions/jsonviewer.yml #PROGRESSBARS=:web_extensions/progressbars.yml #EXTERNALSITES=:web_extensions/externalsites.yml -# External Sites needs additional config. +# External Sites needs additional config, see the following files for more details. # - config/ocis/apps.yaml # - config/ocis/csp.yaml -IMPORTER=:web_extensions/cloudimporter.yml +#IMPORTER=:web_extensions/importer.yml +# The importer needs additional config, see the following lines for more details. ## The docker image to be used for uppy companion. # owncloud has built a container with public link import support. COMPANION_IMAGE= diff --git a/deployments/examples/ocis_full/config/ocis/apps.yaml b/deployments/examples/ocis_full/config/ocis/apps.yaml index f75fc70c197..63f17ef1c4c 100644 --- a/deployments/examples/ocis_full/config/ocis/apps.yaml +++ b/deployments/examples/ocis_full/config/ocis/apps.yaml @@ -8,6 +8,7 @@ importer: external-sites: config: sites: + # For settings see: https://github.com/owncloud/web-extensions/tree/main/packages/web-app-external-sites - name: ownCloud url: "https://owncloud.dev" target: embedded diff --git a/deployments/examples/ocis_full/web_extensions/cloudimporter.yml b/deployments/examples/ocis_full/web_extensions/importer.yml similarity index 100% rename from deployments/examples/ocis_full/web_extensions/cloudimporter.yml rename to deployments/examples/ocis_full/web_extensions/importer.yml