How to run Minio on Platform.sh

Goal

Minio offers cloud file storage with an S3 compatible API. This guide shows how to deploy it on Platform.sh.

Assumptions

To complete this, you will need:

Steps

1. Create the application directory

Create an empty directory and cd into it.

mkdir minio
cd minio

Initialize git and set the platform Git remote:

git init
platform project:set-remote <project id>

2. Configure the application

Minio will be configured to store its configuration and files in mounts. Edit .platform/app.yaml to have the following contents:

name: app

# Any type will work here
type: "nodejs:10"

hooks:
    build: |
      set -e      
      wget https://dl.minio.io/server/minio/release/linux-amd64/minio
      chmod +x minio

mounts:
    'minio_data':
        source: local
        source_path: minio_data_dir
    'minio_config':
        source: local
        source_path: minio_config_dir

web:
    upstream:
        socket_family: tcp
        protocol: http

    commands:
        start: |
          ./minio server /app/minio_data --address localhost:$PORT --config-dir /app/minio_config --certs-dir /app/minio_config/certs

variables:
    env:
        MINIO_ACCESS_KEY: access
        MINIO_SECRET_KEY: changeme

disk: 2048

Change the MINIO_ACCESS_KEY and MINIO_SECRET_KEY values as required. Modify the disk value based on storage requirements, it should be at least 2048.

Define a route in .platform/routes.yaml :

"https://{default}/":
    type: upstream
    upstream: "app:http"

Add an empty .platform/services.yaml file:

touch .platform/services.yaml

3. Add, commit and push:

git add .
git commit -m "Minio configured"
git push platform master

4. Test by visiting the URL of your project:

platform url

The Minio web UI page will be displayed and can be logged in with the MINIO_ACCESS_KEY and MINIO_SECRET_KEY values specified in .platform.app.yaml previously.

minio_login

Conclusion

The Minio server and web UI are running and ready to handle file requests.

Another approach would be to compile minio from source… an even shorter :

name: minio
type: golang:1.11
hooks:
    build:  go get -u github.com/minio/minio
commands:
    start: ~/go/bin/minio server /app/minio_data --address localhost:$PORT --config-dir /app/minio_config --certs-dir /app/minio_config/certs