Реализовать уровень 3: приватное S3, вложения и сохранность при отказах
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# Не включать set -x: аргументы содержат учебные credentials.
|
||||
|
||||
until mc alias set local http://s3:9000 "$(cat /run/secrets/s3_root_user)" "$(cat /run/secrets/s3_root_password)" >/dev/null 2>&1; do sleep 1; done
|
||||
|
||||
mc mb --ignore-existing local/attachments >/dev/null
|
||||
|
||||
mc anonymous set none local/attachments >/dev/null
|
||||
|
||||
mc admin user add local "$(cat /run/secrets/s3_access_key)" "$(cat /run/secrets/s3_secret_key)" >/dev/null
|
||||
|
||||
mc admin policy create local attachments-app /bootstrap/policy.json >/dev/null
|
||||
|
||||
mc admin policy attach local attachments-app --user "$(cat /run/secrets/s3_access_key)" >/dev/null
|
||||
|
||||
echo 'Private bucket and restricted application user ready'
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ defaults
|
||||
mode http
|
||||
log global
|
||||
timeout connect 1s
|
||||
timeout client 10s
|
||||
timeout server 5s
|
||||
timeout client 60s
|
||||
timeout server 45s
|
||||
timeout check 1s
|
||||
retries 0
|
||||
resolvers docker
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":["arn:aws:s3:::attachments"],"Condition":{"StringLike":{"s3:prefix":["originals/*"]}}},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject"],"Resource":["arn:aws:s3:::attachments/originals/*"]}]}
|
||||
Reference in New Issue
Block a user