Skip to content

enable previewers in containers #10506

@pdurbin

Description

@pdurbin

In today's Containerization Working Group meeting (recording, notes) I explained that I would like to have file previewers in our containerized dev and demo environments.

(I want other things too such as language packs and CVOC scripts but previewers feels like a good place to start.)

There were several suggestions of how to accomplish this, but I said I'd start with the simplest one, which is to use the previewers hosted on GitHub Pages. Unfortunately, this doesn't work, due to CORS.

This is the URL I'm using to try to preview the file: http://localhost:8080/file.xhtml?fileId=18&version=DRAFT&toolType=PREVIEW

Here's the curl command I used from https://github.com/gdcc/dataverse-previewers/blob/1.4/6.1curlcommands.md

curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
'{
  "displayName":"Read Text",
  "description":"Read the text file.",
  "toolName":"textPreviewer",
  "scope":"file",
  "types":["preview"],
  "toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/v1.4/TextPreview.html",
  "toolParameters": {
      "queryParameters":[
        {"fileid":"{fileId}"},
        {"siteUrl":"{siteUrl}"},
        {"datasetid":"{datasetId}"},
        {"datasetversion":"{datasetVersion}"},
        {"locale":"{localeCode}"}
      ]
    },
  "contentType":"text/plain",
  "allowedApiCalls": [
    {
      "name": "retrieveFileContents",
      "httpMethod": "GET",
      "urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=true",
      "timeOut": 3600
    },
    {
      "name": "downloadFile",
      "httpMethod": "GET",
      "urlTemplate": "/api/v1/access/datafile/{fileId}?gbrecs=false",
      "timeOut": 3600
    },
    {
      "name": "getDatasetVersionMetadata",
      "httpMethod": "GET",
      "urlTemplate": "/api/v1/datasets/{datasetId}/versions/{datasetVersion}",
      "timeOut": 3600
    }
  ]
}'

Here's the CORS error:

Image

Image

We'll need to determine what to try next. Possible solutions:

  • Put the files in /dv/docroot/dataexplore or similar, a directory where Payara serves static files
  • Put the files in a Docker container

Related discussion:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: ContainersAnything related to cloudy Dataverse, shipped in containers.Size: 30A percentage of a sprint. 21 hours. (formerly size:33)

    Type

    No type

    Projects

    Status

    Done 🧹

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions