Using Supervisor to always MinIO via Docker
MinIO is a High Performance Object Storage that uses the same API’s as Amazon S3. It is highly capable, and is perfect to use as a local S3 bucket server.
For this tutorial I am using Ubuntu 20.04, however note that this will work on many other OS as well. I will also be assuming you have Docker installed, as well as have set up using Docker without root.
To test that we have docker and that it works, run the following command. This will download MinIO in docker form, and will allow us to make sure that we’ll be able to set this up properly.
docker run \
-p 9000:9000 \
-p 9001:9001 \
-e "MINIO_ROOT_USER=testing12" \
-e "MINIO_ROOT_PASSWORD=thisisatest" \
quay.io/minio/minio server /data --console-address ":9001"
Once you press enter, you’ll see it download, and then it will show a confirmation that it is infact running, it should look something like this:
API: http://172.17.0.3:9000 http://127.0.0.1:9000Console: http://172.17.0.3:9001 http://127.0.0.1:9001Documentation: https://docs.min.io
Leave it open, and open your browser. Type in http://127.0.0.1:9001. You should see a screen like the following:
If you see this, it’s working! Go ahead and log in real quick with the username testing12
and the password thisisatest
. Once that’s done, you should be able to see a screen like below:
With that, you can go ahead and stop the process from running in your terminal (CTRL + C). If this is all you need, congrats! If not, we can go ahead and install supervisor.
sudo apt-get install supervisor
Now that it’s installed, we’re going to create a file called minio.conf
. Supervisor’s configuration files are all created in the folder /etc/supervisor/conf.d
. Let’s make the file:
sudo nano /etc/supervisor/conf.d/minio.conf
Inside we’ll paste the code below:
[program:minio]
process_name=%(program_name)s_%(process_num)02d
command=docker run -p 9000:9000 -p 9001:9001 -e “MINIO_ROOT_USER=root” -e “MINIO_ROOT_PASSWORD=password” quay.io/minio/minio server /data — console-address “:9001”
autostart=true
autorestart=true
user=elijah
numprocs=1
redirect_stderr=true
stopwaitsecs=3600
Make sure to change user=elijah
to your username. Then, you should also change MINIO_ROOT_USER
and MINIO_ROOT_PASSWORD
to something you’ll remember. Now, we can save the file. At this point, MinIO is still not running. We need to make Supervisor know that the file exists. To do so, we’ll run these commands:
sudo supervisorctl reread
sudo supervisorctl updatesudo supervisorctl start minio:*
And now let’s head back to http://127.0.0.1:9001. It’s working! If it’s not, there may be a typo, or something else may have went wrong. If that happens, feel free to leave a comment, and I can try to help!
MinIO will now keep running, and it will restart on reboot. There we have it, MinIO running on our local machine for us to easily use!