You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_django/init_minio_buckets.sh

23 lines
1.1 KiB
Bash

#!/bin/bash
set -ex
echo "Starting MinIO bucket setup..."
# Wait for MinIO to be ready
/usr/bin/mc config host add myminio http://minio:9000 kikimor shushunka1
# Damages bucket setup
/usr/bin/mc mb myminio/damages --ignore-existing
echo '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:GetObject"],"Resource":["arn:aws:s3:::damages/*"]}]}' > /tmp/public_read_damages_policy.json
/usr/bin/mc admin policy add myminio public_read_damages /tmp/public_read_damages_policy.json
/usr/bin/mc admin policy set myminio public_read_damages bucket myminio/damages
# Static bucket setup
/usr/bin/mc rb --force myminio/static || true # Remove static bucket if it exists
/usr/bin/mc mb myminio/static # Recreate static bucket
echo '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:GetObject"],"Resource":["arn:aws:s3:::static/*"]}]}' > /tmp/public_read_static_policy.json
/usr/bin/mc admin policy add myminio public_read_static /tmp/public_read_static_policy.json
/usr/bin/mc admin policy set myminio public_read_static bucket myminio/static
echo "MinIO bucket setup complete."