Skip to content

Dockerfile to run Minio (S3 compatible storage) on Dokku (mini-Heroku)

License

Notifications You must be signed in to change notification settings

d1ceward/minio_on_dokku

Minio Dokku Maintenance

Run Minio on Dokku

Perquisites

What is Minio?

Minio is an object storage server that is API compatible with the Amazon S3 cloud storage service. You can find more information about Minio on the minio.io website.

What is Dokku?

Dokku is a lightweight implementation of a Platform as a Service (PaaS) that is powered by Docker. It can be thought of as a mini-Heroku.

Requirements

Setup

Note: Throughout this guide, we will use the domain minio.example.com for demonstration purposes. Make sure to replace it with your actual domain name.

Create the app

Log into your Dokku host and create the Minio app:

dokku apps:create minio

Configuration

Setting root user

Minio uses a username/password combination (MINIO_ROOT_USER and MINIO_ROOT_PASSWORD) for authentication and object management. Set these environment variables using the following commands:

dokku config:set minio MINIO_ROOT_USER=<username>
dokku config:set minio MINIO_ROOT_PASSWORD=<password>

Increase the upload size limit

To modify the upload limit, you need to adjust the CLIENT_MAX_BODY_SIZE environment variable used by Dokku. In this example, we set it to a maximum value of 10MB:

dokku config:set minio CLIENT_MAX_BODY_SIZE=10M

Persistent storage

To ensure that uploaded data persists between restarts, we create a folder on the host machine, grant write permissions to the user defined in the Dockerfile, and instruct Dokku to mount it to the app container. Follow these steps:

dokku storage:ensure-directory minio --chown false
dokku storage:mount minio /var/lib/dokku/data/storage/minio:/data

Domain setup

To enable routing for the Minio app, we need to configure the domain. Execute the following command:

dokku domains:set minio minio.example.com

Push Minio to Dokku

Grabbing the repository

Begin by cloning this repository onto your local machine.

Via SSH

git clone [email protected]:d1ceward/minio_on_dokku.git

Via HTTPS

git clone https://github.com/d1ceward/minio_on_dokku.git

Set up git remote

Now, set up your Dokku server as a remote repository.

git remote add dokku [email protected]:minio

Push Minio

Now, you can push the Minio app to Dokku. Ensure you have completed this step before moving on to the next section.

git push dokku master

SSL certificate

Lastly, let's obtain an SSL certificate from Let's Encrypt.

# Install letsencrypt plugin
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git

# Set certificate contact email
dokku letsencrypt:set minio email [email protected]

# Generate certificate
dokku letsencrypt:enable minio

Wrapping up

Congratulations! Your Minio instance is now up and running, and you can access it at https://minio.example.com.

Minio web console

To access the Minio web console and manage your files, you need to configure the necessary proxy settings. The following commands will help you set it up:

# If ssl enabled
dokku proxy:ports-add minio https:<desired_port>:9001

# If ssl disabled (note scheme change)
dokku proxy:ports-add minio http:<desired_port>:9001

Replace <desired_port> with the port number you prefer. By default, Minio uses port 9001.

After setting up the proxy, you can access the Minio web console by visiting https://minio.example.com:9001 in your web browser.

Web console share links issue

To resolve an issue with share links generated by the console pointing to the Docker container IP instead of your Minio instance, you can use the following command:

dokku config:set minio \
  MINIO_SERVER_URL=https://minio.example.com \
  MINIO_BROWSER_REDIRECT_URL=https://minio.example.com:9001

This command sets the appropriate environment variables to ensure that share links correctly point to your Minio instance at https://minio.example.com and utilize the configured port.

Now you're all set to use Minio and leverage its powerful features for your storage needs. Happy file management!

About

Dockerfile to run Minio (S3 compatible storage) on Dokku (mini-Heroku)

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks