initial commit
This commit is contained in:
32
resources/layout/minio-setup.sh
Normal file
32
resources/layout/minio-setup.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Setting up MinIO bucket and public policy..."
|
||||
|
||||
# Wait for MinIO to become available
|
||||
until curl -s http://localhost:9000/minio/health/ready > /dev/null; do
|
||||
echo "Waiting for MinIO..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Set default values from environment or fallback
|
||||
STORAGE_ID=${STORAGE_ID:-minioadmin}
|
||||
STORAGE_KEY=${STORAGE_KEY:-minioadmin}
|
||||
STORAGE_BUCKET_MEDIA=${STORAGE_BUCKET_MEDIA:-media}
|
||||
STORAGE_BUCKET_STATIC=${STORAGE_BUCKET_STATIC:-static}
|
||||
|
||||
# Setup mc alias
|
||||
mc alias set local http://0.0.0.0:9000 "$STORAGE_ID" "$STORAGE_KEY"
|
||||
|
||||
# Create buckets (no error if already exists)
|
||||
mc mb --ignore-existing local/"$STORAGE_BUCKET_MEDIA"
|
||||
mc mb --ignore-existing local/"$STORAGE_BUCKET_STATIC"
|
||||
|
||||
# Set upload/download access for Django (authenticated)
|
||||
mc policy set write local/"$STORAGE_BUCKET_MEDIA"
|
||||
mc policy set write local/"$STORAGE_BUCKET_STATIC"
|
||||
|
||||
# Set anonymous read policy
|
||||
mc anonymous set download local/"$STORAGE_BUCKET_MEDIA"
|
||||
mc anonymous set download local/"$STORAGE_BUCKET_STATIC"
|
||||
|
||||
echo "✅ MinIO public policy applied"
|
||||
Reference in New Issue
Block a user