Files
sase.tr/docker/minio/init-bucket.sh
Sase Dev 7fc47ce9cc chore: initial project scaffold
Setup monorepo structure with pnpm workspaces, Turborepo, TypeScript,
Biome, Docker Compose (PostgreSQL, Redis, MinIO), Nginx configs,
PM2 ecosystem, and SSL certificates.
2026-02-12 00:26:34 +00:00

37 lines
923 B
Bash
Executable File

#!/bin/bash
set -e
# Load env vars
source "$(dirname "$0")/../.env"
MINIO_ENDPOINT="http://127.0.0.1:9000"
BUCKET_NAME="sase-schemas"
ALIAS_NAME="sase-minio"
# Install mc (MinIO Client) if not available
if ! command -v mc &> /dev/null; then
echo "Installing MinIO Client..."
curl -sSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /tmp/mc
chmod +x /tmp/mc
MC="/tmp/mc"
else
MC="mc"
fi
# Configure alias
$MC alias set "$ALIAS_NAME" "$MINIO_ENDPOINT" "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD"
# Create bucket if it doesn't exist
if $MC ls "$ALIAS_NAME/$BUCKET_NAME" &> /dev/null; then
echo "Bucket '$BUCKET_NAME' already exists."
else
$MC mb "$ALIAS_NAME/$BUCKET_NAME"
echo "Bucket '$BUCKET_NAME' created."
fi
# Set public read (download) policy
$MC anonymous set download "$ALIAS_NAME/$BUCKET_NAME"
echo "Public read access set on '$BUCKET_NAME'."
echo "MinIO bucket initialization complete."