Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support open-with #161

Open
michielbdejong opened this issue Feb 15, 2023 · 39 comments
Open

Support open-with #161

michielbdejong opened this issue Feb 15, 2023 · 39 comments

Comments

@michielbdejong
Copy link
Member

  • step 1 (Ponder Source): Ability to open a CodiMD file in Nextcloud (“open with ...” in EFSS GUI)
    • mechanism fetch app providers from /app/list, then /app/open?file_id=...&app=CodiMD -> app_url=...
  • step 2 (Ponder Source): support remote view in OCM sending in sending EFSS
    • generate view URL like you would in step 1
    • include this in the share details, add "webapp" as another "protocol" entry besides webdav / rclone
  • step 3 (CERN): forward it through sending Reva and through receiving Reva
  • step 4 (Ponder Source): support receive, store, and remote open in OCM receiving EFSS
    • extend oc_share_external db schema (or add additional db table) to store "webapp" details
    • store details there when accepting a share
    • offer it as an additional "Open with remote app..." option
      out of scope:
  • step 5: support for nickname in share creation
  • step 6: support locks in reva-storage mount
@michielbdejong
Copy link
Member Author

First exploration of this: I'm seeing the config related to appprovider / appregistry - will find the code related to this and see if it's supposed to listen on the /app prefix. Currently it's not in my test server, but maybe I misconfigured it:

curl -i -u einstein:relativity https://revanc1.docker/apps/list
HTTP/2 404 
vary: Origin
x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZXZhIiwiZXhwIjoxNjc2NTUxNDcxLCJpYXQiOjE2NzY0NjUwNzEsImlzcyI6Imh0dHBzOi8vcmV2YW5jMS5kb2NrZXIvIiwidXNlciI6eyJpZCI6eyJpZHAiOiJodHRwczovL3JldmFuYzEuZG9ja2VyLyIsIm9wYXF1ZV9pZCI6ImVpbnN0ZWluIn0sImRpc3BsYXlfbmFtZSI6ImVpbnN0ZWluIn0sInNjb3BlIjp7InVzZXIiOnsicmVzb3VyY2UiOnsiZGVjb2RlciI6Impzb24iLCJ2YWx1ZSI6ImV5SnlaWE52ZFhKalpWOXBaQ0k2ZXlKemRHOXlZV2RsWDJsa0lqb2ljM1J2Y21GblpTMXBaQ0lzSW05d1lYRjFaVjlwWkNJNkltOXdZWEYxWlMxcFpDSjlMQ0p3WVhSb0lqb2ljMjl0WlM5bWFXeGxMM0JoZEdndWRIaDBJbjA9In0sInJvbGUiOjF9fX0.qhvWx4wESm1F0g_LRwXUDt7o-whFPzwg5HoB4eHsOv4
content-length: 0
date: Wed, 15 Feb 2023 12:44:31 GMT

@michielbdejong
Copy link
Member Author

# docker-compose configuration file for WOPI server + Postgres + apps (CodiMD, Etherpad, Onlyoffice), for dev purposes
#
# Run with e.g.: HOST_HOSTNAME=`hostname` DBCODIPWD='your_codimd_db_pwd' DBETHPWD=`your_etherpad_db_pwd` CODEADMINPWD=`your_collabora_admin_pwd` WOPIVER=latest docker-compose -f dev_codimd_wopi.yaml up -d
#

version: "3.1"
services:
  wopiserver:
    #image: cs3org/wopiserver:${WOPIVER}-xrootd
    image: wopiserver:cern
    container_name: wopiserver
    hostname: cbox-wopiserver
    network_mode: host
    restart: always
    secrets:
      - cboxcert.pem
      - cboxkey.pem
      - codimd_apikey
      - etherpad_apikey
    environment:
      - DEBUG_METRICS=false
      - HOST_HOSTNAME=${HOST_HOSTNAME}
      - XRD_TIMEOUTRESOLUTION=1
    volumes:
      - config:/etc/wopi
      - logs:/var/log/wopi
      - wopi_recovery:/var/spool/wopirecovery
      - wopi_local_storage:/var/wopi_local_storage
      - /var/lib/sss/pipes:/var/lib/sss/pipes
    healthcheck:
      test: ["CMD", "curl", "--insecure", "https://localhost:8443"]
      interval: 600s
      timeout: 5s
      retries: 3

  database:
    image: postgres:11.6-alpine
    container_name: codimd-postgres
    hostname: cbox-codimd-postgres
    network_mode: appsnet
    environment:
      - POSTGRES_USER=codimd
      - POSTGRES_PASSWORD=${DBCODIPWD}
      - POSTGRES_DB=codimd
    volumes:
      - database-data:/var/lib/postgresql/data
      - upload-data:/home/hackmd/app/public/uploads
    restart: always

  codimd:
    image: gitlab-registry.cern.ch/authoring/notes/codimd:cernbox-integration
    #image: gitlab-registry.cern.ch/lopresti/codimd:cernbox-integration
    container_name: codimd-web
    hostname: cbox-codimd-web
    network_mode: appsnet
    environment:
      - CMD_DB_URL=postgres://codimd:${DBCODIPWD}@codimd-postgres/codimd
      - CMD_AUTO_VERSION_CHECK=false
      - CMD_USECDN=false
      - CMD_ALLOW_ANONYMOUS=true
      - CMD_ALLOW_ANONYMOUS_EDITS=true
      - CMD_ALLOW_ANONYMOUS_VIEWS=true
      - CMD_ALLOW_FREEURL=true
      - CMD_EMAIL=false
      - CMD_ALLOW_EMAIL_REGISTER=false
      - CMD_ALLOW_GRAVATAR=true
      - CMD_ALLOW_PDF_EXPORT=true
      - NODE_TLS_REJECT_UNAUTHORIZED=0
      - CMD_DOMAIN=${HOST_HOSTNAME}
      - CMD_URL_ADDPORT=true
      - CMD_URL_PATH=
      - CMD_USESSL=true
      - CMD_PROTOCOL_USESSL=true
      - CMD_APPLIANCE_MODE=true
      - CMD_API_BODY_LIMIT=210000
      - CMD_FILEPICKER_URL=https://filepicker-dev.cernbox.cern.ch
      # this is a workaround for the PDF export
      - QT_QPA_PLATFORM=
      # the following must be stored properly, this is a test key
      - CMD_API_KEY=testsecret
    secrets:
      - cert.pem
      - key.pem
      - dhparam.pem
      - codimd_apikey
    depends_on:
      - database
    ports:
      - 3000:3000
    restart: always

  etherpad:
    # the cern tag is to be created with the following build command, from a checkout of github.com/ether/etherpad-lite and
    # after having amended the settings.json.docker file with etherpad_settings.json.docker_patch:
    # docker build --build-arg ETHERPAD_PLUGINS="ep_sciencemesh ep_font_size ep_font_family ep_font_color ep_spellcheck ep_table_of_contents ep_subscript_and_superscript ep_mammoth ep_print ep_comments_page ep_embedded_hyperlinks2 ep_auth_session ep_align ep_special_characters ep_markdown ep_image_upload ep_mathjax" --build-arg INSTALL_SOFFICE=True --tag etherpad/etherpad:cern .
    image: etherpad/etherpad:cern
    container_name: etherpad
    hostname: cbox-etherpad
    network_mode: appsnet
    restart: always
    ports:
      - 9001:9001
    environment:
      - SOFFICE=/usr/bin/soffice
      - DB_TYPE=postgres
      - DB_HOST=codimd-postgres
      - DB_PORT=5432
      - DB_USER=etherpad
      - DB_PASS=${DBETHPWD}
      - TITLE=Etherpad for CERNBox
      - DEFAULT_PAD_TEXT=This is Etherpad for CERNBox
      #- LOGLEVEL=DEBUG
    secrets:
      - cert.pem
      - key.pem
      - etherpad_apikey
    command: ["node", "node_modules/ep_etherpad-lite/node/server.js", "--apikey", "/var/run/secrets/etherpad_apikey"]
    healthcheck:
      test: ["CMD", "curl", "-k", "https://localhost:9001"]
      interval: 600s
      timeout: 5s
      retries: 3

  onlyoffice:
    image: onlyoffice/documentserver:latest
    container_name: onlyoffice
    hostname: cbox-onlyoffice
    network_mode: appsnet
    restart: always
    ports:
      - 8000:443
      - 8880:80
    volumes:
      - oo-data:/var/www/onlyoffice/Data
      - oo-logs:/var/log/onlyoffice
    environment:
      - USE_UNAUTHORIZED_STORAGE="true"
    healthcheck:
      test: ["CMD", "curl", "http://localhost"]
      interval: 600s
      timeout: 5s
      retries: 3

  collabora:
    image: collabora/code:latest
    container_name: collabora
    hostname: cbox-collabora
    network_mode: appsnet
    restart: always
    ports:
      - 9980:9980
    environment:
      - server_name=${HOST_HOSTNAME}:9980
      - domain=wopiqa\.cernbox\.cern\.ch:8443
      - cert_domain=1
      - DONT_GEN_SSL_CERT=1
      - extra_params=--o:ssl.cert_file_path=/var/run/secrets/cert.pem --o:ssl.key_file_path=/var/run/secrets/key.pem --o:ssl.ca_file_path=/var/run/secrets/ca-chain.pem
      - username=admin
      - password=${CODEADMINPWD}
    secrets:
      - cert.pem
      - key.pem
      - ca-chain.pem
    healthcheck:
      test: ["CMD", "curl", "-k", "https://localhost:9980"]
      interval: 600s
      timeout: 5s
      retries: 3


secrets:
  cboxcert.pem:
    file: /etc/grid-security/cernbox-hostcert.pem
  cboxkey.pem:
    file: /etc/grid-security/cernbox-hostkey.pem
  cert.pem:
    file: /etc/grid-security/hostcert.pem
  key.pem:
    file: /etc/grid-security/hostkey.pem
    # the key file was obtained as:
    # cd /var/lib/puppet/ssl/private_keys && cp ${HOST_HOSTNAME}.pem ${HOST_HOSTNAME}.key && chmod 644 ${HOST_HOSTNAME}.key
  dhparam.pem:
    file: /etc/grid-security/dhparam.pem
  ca-chain.pem:
    file: /root/APPS/etc/ca-chain.pem
  codimd_apikey:
    file: /etc/wopi/codimd_apikey
  etherpad_apikey:
    file: /etc/wopi/etherpad_apikey

volumes:
  config: {}
  logs: {}
  wopi_recovery: {}
  wopi_local_storage: {}
  database-data: {}
  upload-data: {}
  oo-logs: {}
  oo-data: {}

networks:
  appsnet:

michielbdejong added a commit to pondersource/dev-stock that referenced this issue Feb 24, 2023
@michielbdejong
Copy link
Member Author

@michielbdejong
Copy link
Member Author

How should I configure apps in Reva? I don't see much documentation in https://reva.link/docs/config/http/services/appprovider/ and the docker compose @glpatcern sent me doesn't include a reva config file, I think?

I also don't see anything in https://github.com/cs3org/reva/tree/master/examples

I'll try out https://reva.link/docs/tutorials/wopi-tutorial/

Got quite far with that now I think (see https://github.com/pondersource/dev-stock/commits/sciencemesh-open-with) but now uploading example.txt to Reva is not working.

I tried https://reva.link/docs/tutorials/share-tutorial/#5-1-3-upload-the-example-txt-file but got:

>> upload example.txt /home/my-folder
Local file size: 3 bytes
Data server: http://localhost:19000/data/tus/c65b4ec9-0f61-4563-a5ce-06c0a6e1b0c1
Allowed checksums: [type:RESOURCE_CHECKSUM_TYPE_MD5 priority:100  type:RESOURCE_CHECKSUM_TYPE_UNSET priority:1000 ]
Checksum selected: RESOURCE_CHECKSUM_TYPE_MD5
Local XS: RESOURCE_CHECKSUM_TYPE_MD5:764efa883dda1e11db47671c4a3bbd9e
Patch "http://localhost:19000/data/tus/c65b4ec9-0f61-4563-a5ce-06c0a6e1b0c1": net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x06\x04\x00\x00\x00\x00\x00\x00\x05\x00\x00@\x00"

@michielbdejong
Copy link
Member Author

Hm, still getting a malformed response to 'Put "http://localhost:19000/data/simple/2009075f-806e-4ae5-ba4f-5594a382590a?xs=764efa883dda1e11db47671c4a3bbd9e&xs_type=md5"', will go back to when the OCMD tutorial was working and bisect from there.

@michielbdejong
Copy link
Member Author

OK, so ocmd-server-1.toml is running a data provider on http :19001 with driver "localhome". That is the correct driver for revad1.toml which I'm testing with now (will need to test this with revanc1.toml etc as well!)

Trying now:

[grpc.services.gateway]
datagateway = "https://revad1.docker/data"

[grpc.services.storageprovider]
driver = "localhome"
expose_data_server = true
data_server_url = "https://revad1.docker/data"

[http.services.dataprovider]
driver = "localhome"

michielbdejong added a commit to pondersource/dev-stock that referenced this issue Feb 27, 2023
@michielbdejong
Copy link
Member Author

Next issue:

rpc error: code = Unknown desc = gateway: error calling findAppProvider: internal error: gateway: unexpected grpc response status:code:CODE_INTERNAL message:"error getting the default app provider for the mimetype" trace:"8e15f3827521b047566b6893697f3e10"  when calling GetDefaultAppProviderForMimeType

@michielbdejong
Copy link
Member Author

michielbdejong commented Feb 27, 2023

@michielbdejong
Copy link
Member Author

Hm, still getting

error: not found: default application provider not set for mime type text/plain" 

even though I have https://github.com/pondersource/dev-stock/blob/sciencemesh-open-with/sciencemesh-open-with.toml#L97

@michielbdejong
Copy link
Member Author

We really need a working demo of this, so we can add it to Reva's example folder or point to it from the docs.

Apparently there still is something wrong in my config, configuring Reva is hard! :(
I'll have to trace this through the Reva code, I think.

@michielbdejong
Copy link
Member Author

@glpatcern I think if you don't know how open-with works in Reva then nobody will! :) Can you please document it somewhere?

@glpatcern
Copy link

I will! I acknowledge the documentation is scattered and incomplete. To start with, we have:

Instead, https://developer.sciencemesh.io/docs/technical-documentation/iop/iop-optional-configs/codimd/codimd needs a significant refresh - I'm working on it. So for now you could target the Reva app provider for Collabora (and already the app provider + mimetype configuration documentation is to be improved) and the configuration of Reva + WOPI server. But let's keep in touch for any update on this.

@glpatcern
Copy link

An update:

  • Apps config rehaul sciencemesh/charts#28 is ready and as soon as we tag a fully working version of reva it will be merged.
  • The CodiMD-related documentation was updated, but to test the whole deployment and the open-in-app flow I'd wait for the above.

@mrvahedi68
Copy link

After talking with @glpatcern
We must have 4 services running in Reva:

  • authenticate
  • storage
  • gateway
  • app provider
    Currently, we have the first three items in our Reva instance and must add app Provider in our Reva configuration.

The steps are these:

  • Run a Nextcloud with connected Reva
  • Run a Wopi server (Reference)
  • Configure Wopi url inside Reva configuration. (Example)
  • Run a Colabora container
  • Configure it inside Reva configuration. (Example for CodiMD)
  • Get the list of applications with app/list (We must do this after configuring the Wopi server to test it's working)
  • Get the link to open with an app by app/open

@glpatcern
Copy link

And I have updated the app examples to fix what we found on the way: you have both a Collabora and CodiMD example in the Reva codebase. Suggest to start with Collabora as it's simpler (single container).

@mrvahedi68 mrvahedi68 mentioned this issue May 17, 2023
21 tasks
@shokri-navid
Copy link
Contributor

So I just run WOPI server on my workstation by these steps: ℹ️

1- I cloned this repository.
🔗 https://github.com/cs3org/wopiserver

2- I changed the type of this bash file from shell to bash by changing the #!/bin/sh to #!/bin/bash

3- install rpm build component on my machine by these commands:

sudo apt update
sudo apt install rpm

4- build the docker image using this command:

make docker

5- run wopi server by this command:

docker run --name="wopi.docker" --network=testnet -p 8880:8880 wopiserver:cern

@shokri-navid
Copy link
Contributor

shokri-navid commented May 29, 2023

So, I think I should describe current condition:

  • Wopi server is Up and running. (when I browse this url: Wopi.docker:8880) the result will be:
    image

  • I configured my reva.tomel file like this:

[grpc.services.appprovider.drivers.wopi]
iop_secret = "hello"
wopi_url = "http://0.0.0.0:8880/"
app_name = "CodiMD"
app_url = "https://wopi.docker:3000"
app_int_url = "https://wopi.docker:3000"
folder_base_url = "https://your-reva-frontend.org"

I restart the reva server but:

1- When I am browsing the https://revanc1.docker:8880 I am getting 404 error.
2- when I try to curl this `curl -I https://revanc1.docker/sciencemesh/app/list -u "blah:blah" -H 'Content-Type: application/json' also I am getting the 404 error

@shokri-navid
Copy link
Contributor

when I update the reva.toml and add this section:

[grpc.services.appprovider]
driver = "wopi"
custom_mime_types_json = "custom-mime-types-demo.json"
mime_types = ["text/markdown", "application/compressed-markdown", "text/plain"]
app_provider_url = "localhost:19000"
language = "en-GB"

reva will crash.

I checked log:
and it was because there was another grpc.services.appprovider config and new one raise the duplicat key error.

So I removed the existing and the error disappeared but a new error interrupted :

"unable to register services: rgrpc: grpc service appprovider could not be started,: appprovider: error reading the custom mime types file: +open custom-mime-types-demo.json: no such file or director"

so I create a custom-mime-types-demo.json file inside /etc/revad like this :
https://github.com/cs3org/reva/blob/10969645ff68fd0da33580ceb7509241446300cf/examples/storage-references/custom-mime-types-demo.json#L2

@navid-shokri
Copy link

so, Error changed to:

ERR ../../workspaces/dev-stock/reva/cmd/revad/runtime/runtime.go:219 > error starting the grpc server error="unable to register services: rgrpc: grpc service appprovider could not be started,: Get "https://wopi.docker:3000/hosting/discovery\": dial tcp 172.18.0.11:3000: connect: connection refused" pid=9

@shokri-navid
Copy link
Contributor

whith this final config :

[grpc.services.appprovider]
driver = "wopi"
custom_mime_types_json = "custom-mime-types-demo.json"
mime_types = ["text/markdown", "application/compressed-markdown", "text/plain"]
app_provider_url = "localhost:19000"
language = "en-GB"


[grpc.services.appprovider.drivers.wopi]
iop_secret = "hello"
wopi_url = "http://0.0.0.0:8880/"
app_name = "CodiMD"
app_url = "http://wopi.docker:8880"
app_int_url = "http://wopi.docker:8880"
folder_base_url = "https://your-reva-frontend.org"

I am facing with bellow error

"unable to register services: rgrpc: grpc service appprovider could not be started,: wopi: application server at http://wopi.docker:8880 does not match this AppProvider for CodiMD"

@navid-shokri
Copy link

Collabora installation guide ℹ️
https://www.collaboraoffice.com/code/quick-tryout-nextcloud-docker/

@glpatcern
Copy link

I see a bit of confusion in the above comments, trying to clear things out:

  • On the WOPI side, the docker image to be used is the one produced by the CI. The referenced script is very old and tailored to EOS (as can be seen in the comments), I have removed it.
  • In first approximation, running Collabora is easier because it is all in a single container, whereas CodiMD requires two containers (a database and the app itself).
  • The chain of services would be e.g. (see also https://developer.sciencemesh.io/docs/technical-documentation/iop/iop-optional-configs/collabora-wopi-server/wopiserver):
    Reva-appprovider[19000]
    |--> wopi_url --> wopiserver[8880]
    |--> app_url --> CodiMD[3000] == the app is expected to be deployed at that URL:port.

Therefore app_url cannot be the wopiserver

@navid-shokri
Copy link

navid-shokri commented May 30, 2023

please adjust me if I am wrong. CodeiMD and Collabora are interchangeable with each other. that's right? ❓
And additionally shouldn't I use the make docker? Do you know if the correct image is pushed to the docker hub?

@glpatcern
Copy link

They almost are. CodiMD is not a WOPI native application (and it is deployed with two containers), and it requires an extra configuration option in wopiserver.conf. Can you share your docker-compose deployment? If it is based on what I shared with Michiel some time ago, it's already good to go, but we better double check.

In terms of Helm charts, the reference is https://developer.sciencemesh.io/docs/technical-documentation/iop/iop-optional-configs/codimd/codimd but I understand you're not using those.

@navid-shokri
Copy link

Ok, I will work with Collabora then. thank you for the hints and guidance. I will share as I finished the R&D phase. 🙏

@glpatcern
Copy link

If you share your docker-compose files, I can help kick-starting this also on CodiMD. With Collabora, clearly the idea is to connect it to wopiserver and reva: the Nextcloud tutorial is actually of no use as it would connect it directly to Nextcloud.

@navid-shokri
Copy link

navid-shokri commented May 30, 2023

I guess we are wrong somehow: ⚠️
I am running this curl on my Nextcloud container
curl -I https://revanc1.docker/app/list -u "einstein:loop-bak-secret"
and it responded 404. the Reva log is attached below:

2023-05-30 11:06:13.504 WRN ../../workspaces/dev-stock/reva/internal/http/interceptors/auth/auth.go:218 > core access token not set pid=8 pkg=rhttp traceid=db49b0f14ea70efc7c54c3edb9b0538c
2023-05-30 11:06:13.504 DBG ../../workspaces/dev-stock/reva/internal/http/interceptors/auth/auth.go:231 > credentials obtained from credential strategy: type: basic, client_id: einstein pid=8 pkg=rhttp traceid=db49b0f14ea70efc7c54c3edb9b0538c
2023-05-30 11:06:13.504 DBG ../../workspaces/dev-stock/reva/internal/http/interceptors/auth/auth.go:257 > AuthenticateRequest: type: basic, client_id: einstein against revanc1.docker:19000 pid=8 pkg=rhttp traceid=db49b0f14ea70efc7c54c3edb9b0538c
2023-05-30 11:06:13.504 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/Authenticate pid=8 pkg=rgrpc traceid=3dcbbf1902dac8bd98e56ffd0895461d
2023-05-30 11:06:13.504 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProviders pid=8 pkg=rgrpc traceid=50fd08c53e6609f865ca8c053afbb3b5
2023-05-30 11:06:13.505 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="30/May/2023:11:06:13 +0000" from=tcp://127.0.0.1:57980 pid=8 pkg=rgrpc start="30/May/2023:11:06:13 +0000" time_ns=127602 traceid=50fd08c53e6609f865ca8c053afbb3b5 uri=/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProviders user-agent=grpc-go/1.52.0
2023-05-30 11:06:13.505 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate pid=8 pkg=rgrpc traceid=358a096aff7e7640f747f863d508246d
2023-05-30 11:06:13.505 INF ../../workspaces/dev-stock/reva/pkg/auth/manager/nextcloud/nextcloud.go:175 > Authenticate einstein {"clientID":"einstein","clientSecret":"Kwi72XnHSw7O2ggA7Zv1LIQ4qtmdqasZ"} pid=8 pkg=rgrpc traceid=358a096aff7e7640f747f863d508246d
2023-05-30 11:06:13.505 INF ../../workspaces/dev-stock/reva/pkg/auth/manager/nextcloud/nextcloud.go:126 > am.do https://nc1.docker/index.php/apps/sciencemesh/~einstein/api/auth/Authenticate {"clientID":"einstein","clientSecret":"Kwi72XnHSw7O2ggA7Zv1LIQ4qtmdqasZ"} shared-secret-1 pid=8 pkg=rgrpc traceid=358a096aff7e7640f747f863d508246d
2023-05-30 11:06:13.584 INF ../../workspaces/dev-stock/reva/pkg/auth/manager/nextcloud/nextcloud.go:145 > am.do response 200 {"user":{"id":{"idp":"https:\/\/revanc1.docker\/","opaque_id":"einstein"},"display_name":"einstein","email":null,"type":1},"scopes":{"user":{"resource":{"decoder":"json","value":"eyJyZXNvdXJjZV9pZCI6eyJzdG9yYWdlX2lkIjoic3RvcmFnZS1pZCIsIm9wYXF1ZV9pZCI6Im9wYXF1ZS1pZCJ9LCJwYXRoIjoic29tZS9maWxlL3BhdGgudHh0In0="},"role":1}}} pid=8 pkg=rgrpc traceid=358a096aff7e7640f747f863d508246d
2023-05-30 11:06:13.584 INF ../../workspaces/dev-stock/reva/internal/grpc/services/authprovider/authprovider.go:153 > user authenticated pid=8 pkg=rgrpc traceid=358a096aff7e7640f747f863d508246d userId={"idp":"https://revanc1.docker/","opaque_id":"einstein"}
2023-05-30 11:06:13.584 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="30/May/2023:11:06:13 +0000" from=tcp://127.0.0.1:57994 pid=8 pkg=rgrpc start="30/May/2023:11:06:13 +0000" time_ns=78914518 traceid=358a096aff7e7640f747f863d508246d uri=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate user-agent=grpc-go/1.52.0
2023-05-30 11:06:13.585 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="30/May/2023:11:06:13 +0000" from=tcp://127.0.0.1:47492 pid=8 pkg=rgrpc start="30/May/2023:11:06:13 +0000" time_ns=170403 traceid=f393f3a6c840158fe532f13c4e02952c uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProviders user-agent=grpc-go/1.52.0
2023-05-30 11:06:13.585 INF ../../workspaces/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:259 > CreateHome pid=8 pkg=rgrpc traceid=99b6dd5a5e61c900db8ae97a70ddc97b
2023-05-30 11:06:13.585 INF ../../workspaces/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:221 > nc.do req https://nc1.docker/index.php/apps/sciencemesh/~einstein/api/storage/CreateHome  pid=8 pkg=rgrpc traceid=99b6dd5a5e61c900db8ae97a70ddc97b
2023-05-30 11:06:13.664 INF ../../workspaces/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:240 > nc.do res https://nc1.docker/index.php/apps/sciencemesh/~einstein/api/storage/CreateHome "OK" pid=8 pkg=rgrpc traceid=99b6dd5a5e61c900db8ae97a70ddc97b
2023-05-30 11:06:13.664 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="30/May/2023:11:06:13 +0000" from=tcp://127.0.0.1:47502 pid=8 pkg=rgrpc start="30/May/2023:11:06:13 +0000" time_ns=78819416 traceid=99b6dd5a5e61c900db8ae97a70ddc97b uri=/cs3.storage.provider.v1beta1.ProviderAPI/CreateHome user-agent=grpc-go/1.52.0
2023-05-30 11:06:13.664 DBG ../../workspaces/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="30/May/2023:11:06:13 +0000" from=tcp://127.0.0.1:51834 pid=8 pkg=rgrpc start="30/May/2023:11:06:13 +0000" time_ns=160412379 traceid=3dcbbf1902dac8bd98e56ffd0895461d uri=/cs3.gateway.v1beta1.GatewayAPI/Authenticate user-agent=grpc-go/1.52.0
2023-05-30 11:06:13.665 INF ../../workspaces/dev-stock/reva/internal/http/interceptors/auth/auth.go:271 > core access token generated pid=8 pkg=rhttp traceid=db49b0f14ea70efc7c54c3edb9b0538c
2023-05-30 11:06:13.665 INF ../../workspaces/dev-stock/reva/internal/http/interceptors/providerauthorizer/providerauthorizer.go:81 > skipping provider authorizer check for: /app/list pid=8 pkg=rhttp traceid=db49b0f14ea70efc7c54c3edb9b0538c
2023-05-30 11:06:13.665 DBG ../../workspaces/dev-stock/reva/pkg/rhttp/rhttp.go:311 > http routing: url=/app/list svc=not-found pid=8 pkg=rhttp
2023-05-30 11:06:13.665 WRN ../../workspaces/dev-stock/reva/internal/http/interceptors/log/log.go:108 > http end="30/May/2023:11:06:13 +0000" host=172.18.0.4 method=HEAD pid=8 pkg=rhttp proto=HTTP/2.0 size=0 start="30/May/2023:11:06:13 +0000" status=404 time_ns=161435896 traceid=db49b0f14ea70efc7c54c3edb9b0538c uri=/app/list url=/app/list

But the token generate api works properly ind it indicate our reva is in healthy mode.

@shokri-navid
Copy link
Contributor

Thank to @glpatcern We had a instructive chat and he provide me some great hints:
first of All:
I should use this Image repository to setup my WOPI server:
https://hub.docker.com/r/cs3org/wopiserver/tags

next is:

for the configuration, the wopiserver.conf is self-documented - see
https://github.com/cs3org/wopiserver/blob/master/wopiserver.conf

and then:
the Wopi server just send response for the mime types those are supported with configured application:
for example Collabra does not support md files.

finally:
correct mime types for Collabora should be:
mime_types = ["application/vnd.oasis.opendocument.text", "application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.presentation", "text/rtf"]

@shokri-navid
Copy link
Contributor

⚠️
I applied all of these suggestion on my testing environment bu still I am facing with 404 error.

should I pass any argument to the app/list API?

@shokri-navid
Copy link
Contributor

ℹ️

So It seems I should configure my wopiserver like this :
https://github.com/cs3org/wopiserver/blob/master/docker/etc/wopiserver.cs3.conf

@shokri-navid
Copy link
Contributor

ℹ️

@glpatcern found a point in my reva.tomel file.
that I did not register [http.services.appprovider]

configuration sample:
https://developer.sciencemesh.io/docs/technical-documentation/iop/iop-optional-configs/collabora-wopi-server/wopiserver/#configure-reva-to-integrate-with-the-wopi-server

@navid-shokri
Copy link

😁 💥
finally after adding the [http.services.appprovider] It worked:

curl -X GET https://revanc1.docker/app/list -u "einstein:REVA_LOOPBACK_SECRET" -H "Content-Type: application/json"

returns:

{
   "mime-types":[
      {
         "mime_type":"text/rtf",
         "app_providers":[
            {
               "name":"Collabora"
            }
         ]
      },
      {
         "mime_type":"application/vnd.oasis.opendocument.spreadsheet",
         "app_providers":[
            {
               "name":"Collabora"
            }
         ]
      },
      {
         "mime_type":"application/vnd.oasis.opendocument.presentation",
         "app_providers":[
            {
               "name":"Collabora"
            }
         ]
      },
      {
         "mime_type":"application/vnd.oasis.opendocument.text",
         "app_providers":[
            {
               "name":"Collabora"
            }
         ]
      }
   ]
}

@shokri-navid
Copy link
Contributor

shokri-navid commented Jun 1, 2023

ℹ️ 🔴
@michielbdejong @MahdiBaghbani
there are also some more advises about configuring reva toml file:

[grpc.services.appregistry.static.rules]
"text/plain" = "revanc1.docker:19000"
"text/markdown" = "revanc1.docker:19000"
"application/compressed-markdown" = "revanc1.docker:19000"
"application/vnd.oasis.opendocument.text" = "revanc1.docker:19000"
"application/vnd.oasis.opendocument.spreadsheet" = "revanc1.docker:19000"
"application/vnd.oasis.opendocument.presentation" = "revanc1.docker:19000"

instead you should configure it as per the same link

https://github.com/sciencemesh/sciencemesh/blob/master/docs/content/en/docs/Technical-documentation/IOP/IOP-Optional-Configs/Collabora-wopi-server/wopiserver.md#configure-reva-to-integrate-with-the-wopi-server

@navid-shokri
Copy link

💥 ℹ️
I ran /app/open by this curl:

curl -v POST https://revanc1.docker/app/open -u 'einstein:GSLqfQdyojnSAnX3KDnCoiqyNhfRS9Nz' -H 'Content-Type: application/x-www-form-urlencoded' -d "file_id=3&path=/path"

{
  "code": "INVALID_PARAMETER",
  "message": "invalid file ID"
}

@glpatcern
Copy link

@navid-shokri did you get the wopiserver up and running? And for the parameters, you can specify either the file_id or the path, but if you use the file_id it must resolve

@navid-shokri
Copy link

Yes, it is Up and running. I sent a sample and a random string. the latest example that I sent was just for checking the request structure.
But just for more explicitly file_id is the name of the file in OC/NC. right?

@glpatcern
Copy link

Yes, it is Up and running.

OK, more specifically does it show Health check: OK at the bottom of the index page?

But just for more explicitly file_id is the name of the file in OC/NC. right?

No, the file_id is the opaqueid, typically the inode, as returned by Stat(). A priori Stat(reference=path) and Stat(reference=opaque_id) for a given file return a StatResponse that includes both opaque_id and path as well as all other attributes for the file (reference in there is the CS3 Reference struct).

@glpatcern
Copy link

glpatcern commented Jun 15, 2023

I thought to provide here a summary of what we need to progress with the open-with flow, also given the findings in the ScienceMesh "hackathons".

In terms of configuration:

In terms of ScienceMesh app developments:

  • The implementation of a persistent store for incoming OCM shares with a webapp payload, as this comes with a specific URL template that is different from the WebDAV path, so it cannot be stored in the native oc_external_shares table or the like.
  • The implementation of the CS3API Locks in the nextcloud storage driver in reva. This is something where we can help.
  • A hook in the OC/NC frontend for "Open remotely", which calls POST /sciencemesh/open-in-app to reva. This call returns an app-url to be opened in a _blank target (not in an iframe).

For local apps, in addition to the CS3API Locks in the nextcloud storage driver:

  • A hook in the OC/NC frontend for "Open with app", which calls POST /app/open to reva, with a similar response as above.

For local apps reva provides a "discovery" endpoint at /app/list, whereas this discovery is not available for remote apps.

@glpatcern
Copy link

Superseded by sciencemesh/nc-sciencemesh#53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants