Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement asset manager uploader and resolver (#2516)
## Resolver Simple form that takes in a `watcloud://...` URI and returns a URL to the asset. <img width="874" alt="image" src="https://github.com/WATonomous/infra-config/assets/5977478/e8c1dcfa-57c5-4eec-8315-513ecc1fdfef"> Success: <img width="855" alt="image" src="https://github.com/WATonomous/infra-config/assets/5977478/b853d446-d3f3-44d2-89a9-8a3cbad1de92"> Failure: <img width="857" alt="image" src="https://github.com/WATonomous/infra-config/assets/5977478/215aff16-166a-4f4b-8868-1af8295e3d4b"> ## Uploader Frontend for uploading to a public S3 bucket. The target bucket is currently hard coded to `https://rgw.watonomous.ca/asset-temp`. <img width="874" alt="image" src="https://github.com/WATonomous/infra-config/assets/5977478/b2e8236b-9298-4310-9335-a3700069dfca"> Successful upload: <img width="872" alt="image" src="https://github.com/WATonomous/infra-config/assets/5977478/2fd5300d-c5ba-44ae-b722-6c3e59eea829"> Failed upload: <img width="856" alt="image" src="https://github.com/WATonomous/infra-config/assets/5977478/35e1d9bf-7aad-48fa-a9ce-c33ac62bc7ad"> ### Quirk **Note:** We have implemented an automated solution for this quirk: WATonomous/infra-config#2528 The CORS needs to be deployed on rgw (done in code) and on the bucket (the minio Terraform project doesn't have an option for this). To deploy the CORS configuration to the bucket manually, do: ``` s3cmd setcors cors.xml s3://asset-temp ``` The `cors.xml` file is provided as an attachment below. It's derived from https://uppy.io/docs/aws-s3-multipart/#setting-up-your-s3-bucket [cors.json](https://github.com/WATonomous/infra-config/files/14730054/cors.json) [cors.xml.txt](https://github.com/WATonomous/infra-config/files/14730057/cors.xml.txt) Perhaps we can write a custom Terraform [null_resource](https://chat.openai.com/share/a62408fe-1047-4b26-a726-5658282af010) that runs a curl: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketCors.html ### Notes The functionality to display a `watcloud://` URI is not yet implemented. We can do this when we finalize the syntax for the SDK. Sibling project: WATonomous/infra-config#2411 Parent project: #2306 ### TODOs - [x] Dark mode: https://uppy.io/docs/dashboard/#theme, https://nextra.site/docs/docs-theme/api/use-config#return-values - [x] Set a larger width so that it fills up the space: https://uppy.io/docs/dashboard/#width - [x] Show the WATcloud URI after uploading. Perhaps using https://uppy.io/docs/dashboard/#showlinktofileuploadresult - [x] Show useful upload errors. (By default it just shows "Not 2xx")
- Loading branch information