Local S3 Connection to Default Uploader
In this guide, we will locally set up MinIO, connect it to Default Uploader, and transform a file. Let’s go!
1. Create a docker-compose file
This script will download the MinIO image and a utility that will create a user, access keys, and a bucket.
2. Create wait-for-it.sh
Copy the file from this GitHub repository.
Your file structure should look like this:
Directoryminio-for-local-development/
- …
- docker-compose.minio.yml
- wait-for-it.sh
3. Run the script
MinIO will be installed, and a user, bucket, and access keys will be created.
4. Open MinIO to the internet
You can use any tool for this; the example will use ngrok. You need to expose the MinIO API port to the internet.
Copy the address from the Forwarding field:
5. Enter the S3 connection details obtained in the previous steps
S3 connection settings in the Default Uploader dashboard:
Click the Save button and then Check Connection. Also, enable the Soft Migration option, which will be useful in the next step.
6. Verification
Go to the MinIO console.
Enter the login details:
Go to the bucket bucket and upload any image.
Directorymybucket/
- cat.jpg
Now, generate a link to retrieve and optimize the file.
https://api.defaultuploader.com/v1/image/upload/CLIENT_TOKEN/S3_FILE_PATH
CLIENT_TOKEN can be found in your dashboard.
You should end up with a link containing your CLIENT_TOKEN and the name of the uploaded file.
https://api.defaultuploader.com/v1/image/upload/66c78a393438de9506dd5e09/cat.jpg
And add the parameter ?w=100
https://api.defaultuploader.com/v1/image/upload/66c78a393438de9506dd5e09/cat.jpg?w=100
Done! You have successfully connected a local S3 to Default Uploader.