enable previewers in containers
pdurbin opened this issue · comments
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:
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: