# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: MinIO
spec:
    description: MinIO is a high performance distributed object storage server, designed for large-scale private cloud infrastructure.
    coverImage: https://raw.githubusercontent.com/minio/minio/master/.github/logo.svg
    icon: https://cdn.zeabur.com/marketplace/minio.svg
    tags:
        - storage
    readme: |
        Note: This template is maintained by the Zeabur team, if you have any questions or need help, please contact us at [Zeabur's offical Discord server](https://zeabur.com/dc).

        ---

        MinIO is a High Performance Object Storage released under GNU Affero General Public License v3.0. It is API compatible with Amazon S3 cloud storage service. Use MinIO to build high performance infrastructure for machine learning, analytics and application data workloads.
    services:
        - name: minio
          icon: https://cdn.zeabur.com/marketplace/minio.svg
          template: PREBUILT
          spec:
            source:
                image: quay.io/minio/minio:latest
                command:
                    - /bin/sh
                args:
                    - -c
                    - |
                      minio server /data --console-address :9090 &
                      MINIO_PID=$!
                      while ! curl -s http://localhost:9000/minio/health/live; do
                        echo 'Waiting for MinIO to start...'
                        sleep 1
                      done
                      sleep 5
                      mc alias set myminio http://localhost:9000 $MINIO_USERNAME $MINIO_PASSWORD
                      echo "Creating bucket '$MINIO_DEFAULT_BUCKET'"
                      mc mb myminio/$MINIO_DEFAULT_BUCKET
                      wait $MINIO_PID
            ports:
                - id: web
                  port: 9000
                  type: HTTP
                - id: console
                  port: 9090
                  type: HTTP
            volumes:
                - id: data
                  dir: /data
            instructions:
                - title: Go to MinIO Console
                  content: ${MINIO_CONSOLE_URL}
                - title: Default Username (S3 Access Key ID)
                  content: ${MINIO_USERNAME}
                - title: Default Password (S3 Secret Access Key)
                  content: ${MINIO_PASSWORD}
                - title: Default Bucket
                  content: ${MINIO_DEFAULT_BUCKET}
            env:
                MINIO_BROWSER_REDIRECT:
                    default: "false"
                MINIO_CONSOLE_URL:
                    default: ${ZEABUR_CONSOLE_URL}
                    expose: true
                MINIO_DEFAULT_BUCKET:
                    default: zeabur
                MINIO_PASSWORD:
                    default: ${MINIO_ROOT_PASSWORD}
                    expose: true
                MINIO_ROOT_PASSWORD:
                    default: ${PASSWORD}
                MINIO_ROOT_USER:
                    default: minio
                MINIO_USERNAME:
                    default: ${MINIO_ROOT_USER}
                    expose: true
