Use Minio Object Storage in Strapi

Art Krisada
2 min readJun 14, 2021

--

Strapi is a Headless CMS. It’s easy to create API from Strapi. It comes with upload plugin. So you can upload images with this plugin. To use Minio as a provider instead of default local upload, you need to install strapi-provider-upload-ts-minio.

This is a note from these documents.

On strapi folder in terminal. Run this.

npm install strapi-provider-upload-ts-minio --save

After install package successfully, you need to configure strapi.

You need to know your minio configuration.

My configuration is as follow. I run my minio in docker.

Host: localhost

Port: 9000

Access key and Secret Key

I create a bucket name strapi and then create folder upload inside the bucket.

Then comeback to Strapi and add configuration in file: ./config/plugins.js

module.exports = ({ env }) => ({  upload: {    provider: "tp-minio",    providerOptions: {      accessKey: env("MINIO_ACCESS_KEY", "AKIAIOSFODNN7EXAMPLE"),      secretKey: env(                 "MINIO_SECRET_KEY",                  "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"      ),      bucket: env("MINIO_BUCKET", "strapi"),      endPoint: env("MINIO_ENDPOINT", "localhost"),      port: parseInt(env("MINIO_PORT", 9000), 10) || 9000,      useSSL: env("MINIO_USE_SSL", false),      folder: "upload",      isDocker: true,      host: env("MINIO_HOST", "localhost:9000")    }  }});

Start Strapi. Login to admin page. Then upload your image.

Check your Minio. You will see the file you upload and other files strapi create for you. Such as small, medium, large, thumbnail and the file you uploaded.

You can upload file by curl. You can follow this example from PhilipSchmid.

https://gist.github.com/PhilipSchmid

--

--

Art Krisada
Art Krisada

Written by Art Krisada

Never stop learning, because life never stop teaching.

Responses (1)