forked from mtusi2026/mtusi2026lab7
Щербацевич-БПИ2302-на 3
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ROOT_USER=$(cat /secrets/passwords/minio_root_user)
|
||||
ROOT_PASS=$(cat /secrets/passwords/minio_root_password)
|
||||
API_KEY=$(cat /secrets/passwords/s3_api_key)
|
||||
API_SECRET=$(cat /secrets/passwords/s3_api_secret)
|
||||
WORKER_KEY=$(cat /secrets/passwords/s3_worker_key)
|
||||
WORKER_SECRET=$(cat /secrets/passwords/s3_worker_secret)
|
||||
GC_KEY=$(cat /secrets/passwords/s3_gc_key)
|
||||
GC_SECRET=$(cat /secrets/passwords/s3_gc_secret)
|
||||
export SSL_CERT_FILE=/certs/ca.crt
|
||||
|
||||
i=0
|
||||
while [ "$i" -lt 40 ]; do
|
||||
if mc alias set local https://minio:9000 "$ROOT_USER" "$ROOT_PASS" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
mc alias set local https://minio:9000 "$ROOT_USER" "$ROOT_PASS"
|
||||
mc mb --ignore-existing local/messenger-attachments
|
||||
mc anonymous set none local/messenger-attachments
|
||||
|
||||
add_user() {
|
||||
key=$1
|
||||
secret=$2
|
||||
policy=$3
|
||||
file=$4
|
||||
mc admin user add local "$key" "$secret" >/dev/null 2>&1 || mc admin user add local "$key" "$secret"
|
||||
mc admin policy create local "$policy" "$file" >/dev/null 2>&1 || true
|
||||
mc admin policy attach local "$policy" --user "$key" >/dev/null 2>&1 || mc admin policy set local "$policy" user="$key"
|
||||
}
|
||||
|
||||
add_user "$API_KEY" "$API_SECRET" api-objects /policies/api-policy.json
|
||||
add_user "$WORKER_KEY" "$WORKER_SECRET" worker-objects /policies/worker-policy.json
|
||||
add_user "$GC_KEY" "$GC_SECRET" gc-objects /policies/gc-policy.json
|
||||
echo "minio bootstrap complete"
|
||||
Reference in New Issue
Block a user