Amazon S3 Direct Upload for Web UI is an addon that allows Web UI to make use of S3 Direct Upload to directly upload files to a transient bucket, which will then be moved by the Nuxeo server to a final bucket once the upload is finished. For that purpose, this addon deploys a custom upload provider for Web UI that leverages the AWS SDK for Javascript, to upload blobs directly to an S3 bucket. This addon requires Amazon S3 Online Storage to be installed and configured.
Installation
This addon requires no specific installation steps. It can be installed like any other package with nuxeoctl command line.
Configuration
Only S3 Direct upload must be configured, as described in its documentation page. No further configuration is required.
Technical Overview
Once installed, this addon sets the S3 direct upload as the default upload provider for Web UI, which means that every blob uploaded through the UI will be sent to an S3 bucket, unless the target element is configured otherwise.
The upload is done in three steps:
The Web UI makes a call to a REST API endpoint, to initiate a new batch using the S3 batch handler:
POST 'http://localhost:8080/nuxeo/api/v1/upload/new/s3'
This call returns a batch object in JSON format with all the required information to upload the blob to an S3 bucket, including the bucket name, region and credentials:
{ "batchId": "batchId-0fd1e21d-8c21-4b37-9ccb-26a056fcffa5", "extraInfo": { "awsSecretAccessKey": "...", "awsSecretKeyId": "...", "awsSessionToken": "...", "baseKey": "...", "bucket": "my-bucket", "expiration": 1533877058000, "region": "eu-west-3", "useS3Accelerate": false }, "fileEntries": [], "provider": "s3" }
Web UI then uses the S3 service provided by the AWS SDK for Javascript to upload the blob, using the data retrieved on step 1.
Once the upload is finalized, a last REST API call is made to notify the Nuxeo server that the upload to the transient bucket is finished, including a reference to the blob in the payload:
POST 'http://localhost:8080/nuxeo/api/v1/upload/batchId-0fd1e21d-8c21-4b37-9ccb-26a056fcffa5/0/complete'
{ "bucket": "my-bucket", "etag": "asdasdas23as", "fileSize": 11251065, "key": "myfile.ext", "name": "myfile.ext" }
The server will then move the blob from the transient to the final bucket. For more information regarding S3 Direct Upload, please check the related documentation page.