Skip to content

How to: Use minio with Carrierwave

Bruno Casali edited this page May 6, 2020 · 5 revisions

minio is an Amazon S3 compatible object storage.

see: https://minio.io/

In your Gemfile:

gem 'carrierwave'
gem 'fog-aws'

Set default configuration as mentioned below, if you wish to use different buckets/servers in different environments please set configuration in config/environments/ files

CarrierWave.configure do |config|
  config.fog_provider = 'fog/aws'                        # Mention Fog provider
  config.fog_credentials = {
    provider:              'AWS',                        # required
    aws_access_key_id:     'Q3AM3UQ867SPQQA43P2F',
    aws_secret_access_key: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
    region:                'us-east-1',                  # optional, defaults to 'us-east-1',
                                                         # Please mention other regions if you have changed
                                                         # minio configuration
    host:                  'play.minio.io',              # Provide your host name here, otherwise fog-aws defaults to
                                                         # s3.amazonaws.com
    endpoint:              'https://play.minio.io:9000', # Required, otherwise defauls to nil
    path_style:         true                             # Required
  }
  config.fog_directory  = 'carrierwave'					 # Bucket name
  config.storage = :fog
end

You might need to check https://github.com/minio/minio/issues/2326 to fix the 'Provided header does not match what was computed.' error.

Clone this wiki locally