MinIO is an object storage server, and API compatible with Amazon S3 cloud storage service. Read more at the minio.io website.
Dokku is the smallest PaaS implementation you've ever seen - Docker powered mini-Heroku.
Execute the following commands on your Dokku host to create the MinIO app and set nginx max upload size for this app. Change the variable values to fit your case:
APP_NAME=myminio
ADMIN_EMAIL=admin@myminio.example.net
MINIO_DOMAIN=myminio.example.net
MINIO_REDIRECT_URL=https://myminio.example.net:9001
MINIO_UID=1000
MINIO_GID=1000
STORAGE_PATH=/var/lib/dokku/data/storage/$APP_NAME
dokku apps:create $APP_NAME
dokku config:set --no-restart $APP_NAME MINIO_ROOT_USER=$(echo `openssl rand -base64 45` | tr -d \=+ | cut -c 1-20)
dokku config:set --no-restart $APP_NAME MINIO_ROOT_PASSWORD=$(echo `openssl rand -base64 45` | tr -d \=+ | cut -c 1-32)
dokku config:set --no-restart $APP_NAME MINIO_BROWSER_REDIRECT_URL=$MINIO_REDIRECT_URL
dokku config:set --no-restart $APP_NAME MINIO_DOMAIN=$MINIO_DOMAIN
You can retrieve above values at any time with the command dokku config:show $APP_NAME
. You may use MINIO_ROOT_USER
and MINIO_ROOT_PASSWORD
to authenticate on the Web interface.
To persists uploaded data between restarts, we create a folder on the host machine, add write permissions to the user
defined in Dockerfile
and tell Dokku to mount it to the app container.
sudo mkdir -p "$STORAGE_PATH"
sudo chown $MINIO_UID:$MINIO_GID "$STORAGE_PATH"
dokku storage:mount $APP_NAME "$STORAGE_PATH:/data"
dokku nginx:set $APP_NAME client-max-body-size 1g
To get the routing working, we need to apply a few settings. First we set the domain.
dokku domains:set $APP_NAME $MINIO_DOMAIN
The parent Dockerfile, provided by the MinIO project, exposes port 9000
for Web
requests and 9001
for Web console. Dokku will set up this port for outside communication, as explained in its
documentation. Because we want
MinIO to be available on the default port 80
(or 443
for SSL), we need to fiddle around with the proxy settings.
First add the correct port mapping for this project as defined in the parent Dockerfile
and then remove the proxy
mapping added by Dokku.
dokku proxy:ports-add $APP_NAME http:80:9000 https:443:9000 https:9001:9001
dokku proxy:ports-remove $APP_NAME http:80:5000
First clone this repository to your machine:
git clone git@github.com:PythonicCafe/dokku-minio.git
Now you need to set up your Dokku server as a remote. Run on your local machine:
git remote add dokku dokku@<dokku-host-machine>:<app-name>
Now we can push MinIO to Dokku (before moving on to the next part):
git push dokku main
These are the only commands you'll need to run on your local machine.
Last but not least, we can go an grab the SSL certificate from Let's Encrypt. You'll need dokku-letsencrypt plugin installed. If it's not, install by running:
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
Now get the SSL certificate:
dokku letsencrypt:set $APP_NAME email $ADMIN_EMAIL
dokku letsencrypt:enable $APP_NAME
Note: you must execute these steps after pushing the app to Dokku host.
Your MinIO instance should now be available on https://$MINIO_DOMAIN
. Enjoy! :)