MinIO
This document will guide you through installing the MinIO file service plugin on your Medusa backend.
Overview
To upload and manage file assets in Medusa, you need a file service plugin responsible for hosting the files. Without a file service plugin, you will face issues while working with Medusa, such as when uploading images for products.
Medusa provides three different options to handle your file storage. This document will focus on setting up MinIO on your local machine and connecting Medusa to it.
Prerequisites
A Medusa backend is required to be set up before following along with this document. You can follow the quickstart guide to get started in minutes.
Set up MinIO
You can follow MinIO’s guide to install it on your machine based on your operating system.
After installing it, make sure MinIO is always running when your Medusa backend is running. It’s recommended that you set up an alias to quickly start the MinIO backend as instructed at the end of the installation guides in MinIO.
Change MinIO port
In MinIO’s documentation, port 9000
is used for the address of the MinIO backend. However, this collides with the port for the Medusa backend. You must change the port for MinIO to another one (for example, port 9001
).
After setting up and installing MinIO on your system/sub-system, you can run the following command to change MinIO port to 9001
(or any other available port) instead of 9000
to avoid the port clash:
Create a MinIO bucket
After installing MinIO and logging into the Console, you can create a bucket that will store the files of your Medusa backend by following these steps:
- Go to the Buckets page from the sidebar.
- Click on the “Create Bucket” button.
- For the Bucket Name field, enter a name for the bucket. By MinIO’s requirement, the name can only consist of lower case characters, numbers, dots (
.
), and hyphens (-
). - Click on the Create Bucket button.
- On the bucket's page, click on the edit icon next to Access Policy.
- In the pop-up that opens, change the selected value to “public” and click Set.
Changing the Access Policy to public will allow anyone to access your bucket. Avoid storing sensitive data in the bucket.
Generate Access Keys
To generate access keys for your plugin:
- From the sidebar of your MinIO console, click on Access Keys
- Click on the "Create access key" button
- This will open a new form with randomly-generated keys. Click on the Create button.
- A pop-up will then show the value for your Access Key and Secret Key. Copy them to use in the next section.
You will not be able to access the Secret Key after closing the pop-up. So, make sure to store it somewhere to use later when configuring the plugin.