Skip to content

Installing an S3 Cache Server from MinIO

Prerequisites

For downloading curl is needed. Needed for setfacl the package acl is needed.

apt-get install curl acl

Download

Service

Check the releases at MinIO downloads and get the latest release url from there.

For example like:

curl --remote-name --remote-header-name --location --create-dirs -o ${HOME}/downloads\
https://dl.min.io/server/minio/release/linux-amd64/minio_20221129234049.0.0_amd64.deb

Client

Download the MinIO client call inconveniently mc like mc from Midnight Commander.

curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o ${HOME}/minio-binaries/mc

Installation

Service Installation

Create user minio-user for the service to run under.

useradd --system minio-user

Create a configuration file /etc/default/minio for the service.

# Volume to be used for MinIO server.
MINIO_VOLUMES="/mnt/data"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9199 --console-address :9001"
# Root user for the server.
MINIO_ROOT_USER=admin
# Root secret for the server.
MINIO_ROOT_PASSWORD=<the-admin-password>
# set this for MinIO to reload entries with 'mc admin service restart'
MINIO_CONFIG_ENV_FILE=/etc/default/minio
# Set redirection URL for the API on port 9199
MINIO_BROWSER_REDIRECT_URL="https://minio.scanframe.com"

Create the data directory and set the ownership so the service can access it.

In the LXC container which is used here no volume is mounted.
So directory /mnt/data being used as regular directory.

mkdir /mnt/data
chown minio-user:minio-user /mnt/data

Install the package (your version of course)

dpkg -i ~/downloads/minio_20221129234049.0.0_amd64.deb

Client Installation

The client installation can be on any system.
In this case it is installed for the root user.

Create an alias called local to refer to since in this case the service is local.

~/minio-binaries/mc alias set local http://localhost:9199 admin "<the-admin-password>"

And when the MinIO API is behind a proxy and the client is not on the same machine then create a remote alias.

~/minio-binaries/mc alias set remote https://minio-api.scanframe.com admin "<the-admin-password>"

Auto Updates with Cron

To make the service and client update automatically add this to you crontab. The MAILTO is optional.

# Set the e-mail address.
MAILTO=log@scanframe.nl

# Check for update minio service every night a 01:10 for alias server called 'local'
10 1 * * * /root/minio-binaries/mc admin update local

# Check for update minio client every night a 01:20
20 1 * * * /root/minio-binaries/mc update

GitLab-Runner Configuration

Excerpt of the gitlab-runner config.
In this case the username is gitlab-runner and needs to be added.
As for the bucket gitlab it needs to be determined yet.

It is not working at the moment.
Maybe because the runner is not passing the hostname in the header
so the apache proxy does not route it properly.

[runners.cache]
  Type = "s3"
  Shared = true
  [runners.cache.s3]
    AccessKey = "<the-user-name>"
    SecretKey = "<the-user-password>"
    BucketName = "gitlab"
    Insecure = False
    ServerAddress = "minio-api.scanframe.com"