This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
The blog post is available here: https://tgrall.github.io/blog/2024/12/21/quarkus-uploading-image-to-the-cloud/
As documented in the blog post, this project use 3 different cloud storage services:
- AWS S3
- Azure Blob Storage
- Google Cloud Storage
When you run quarkus in development mode a local data service is used for AWS and Azure, but not for GCP. So if you want to test on GCP you need to create a bucket and a service account.
Also this project contains a Terraform script to create the required resources on all providers, you can find this in ./terraform folder.
cd ./terraform
terraform init
terraform plan
terraform apply
You can get the Azure connection string using the following command:
terraform output connection_string
Copy the string the application.properties
file, and set the value of the quarkus.devservices.enabled=
property to false
.
cd ./terraform
terraform destroy
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
Once the Quarkus application is started point your browser to the following URL:
You can enter some values, select the cloud storage service, and upload a picture.
You can call the following endpoint to upload a picture to the cloud storage:
AWS S3
curl -i -X POST http://localhost:8080/api/v1/boards/picture/aws \
-H 'Content-Type: multipart/form-data' \
-F 'picture=@./src/test/resources/test-board.png' \
-F 'board={"id":5 , "year":2024, "brand":"jp-australia", "slug":"jp-australia-2024-ultimate-wave"}'
Azure Blob Storage
curl -i -X POST http://localhost:8080/api/v1/boards/picture/azure \
-H 'Content-Type: multipart/form-data' \
-F 'picture=@./src/test/resources/test-board.png' \
-F 'board={"id":5 , "year":2024, "brand":"jp-australia", "slug":"jp-australia-2024-ultimate-wave"}'
Google Cloud Storage
curl -i -X POST http://localhost:8080/api/v1/boards/picture/gcp \
-H 'Content-Type: multipart/form-data' \
-F 'picture=@./src/test/resources/test-board.png' \
-F 'board={"id":5 , "year":2024, "brand":"jp-australia", "slug":"jp-australia-2024-ultimate-wave"}'