A small Play app to upload files to and S3 bucket and get a CDN URL in return.
Requires the login service, so clone that repo and set it up.
You will also need media-service Janus credentials.
scripts/setup
sbt run
The app should now be available at https://s3-uploader.local.dev-gutools.co.uk/
The app is built using GitHub Actions, with CD (via Riff-Raff) enabled for changes on main
.
The Riff-Raff project is media-service::s3-uploader
.
The core functionality of this app is the ability to upload files to S3.
To test:
- Open incognito tab
- Check that you are required to login to https://s3-uploader.gutools.co.uk
- Attempt to upload a small test image (that you don't mind becoming public)
- Check that the test image is accessible using the link provided after upload
If you want another service or app to access the endpoints in s3-uploader (allowing it to upload to s3), there are a couple of steps to follow:
- Add an new Config object for your service in
Config.scala
- Amend the s3-uploader BatchUploaderPolicy (CloudFormation) to allow the s3-uploader to get objects from and put objects to the desired bucket (these changes have to be applied manually via CloudFormation console)
- Add the hostname of the new service to the 'Allowed Origins' in
application.conf
. Locally this file is in the repo. For CODE and PROD, it is in S3 in themedia-service
account - If required, add a new route and method to handle the new request.
- Cross account access etc can be configured at the bucket policy level in S3