forked from mtusi2026/mtusi2026lab4
ЛР 4 - БПИ2302 - Щербацевич - на 4
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 256
|
||||
|
||||
defaults
|
||||
log global
|
||||
mode http
|
||||
option httplog
|
||||
option dontlognull
|
||||
option redispatch
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
timeout http-request 30s
|
||||
retries 2
|
||||
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
resolve_retries 3
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 5s
|
||||
hold other 5s
|
||||
hold refused 5s
|
||||
hold nx 5s
|
||||
hold timeout 5s
|
||||
hold obsolete 5s
|
||||
|
||||
frontend public
|
||||
bind :8080
|
||||
default_backend api
|
||||
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
|
||||
http-check expect status 200
|
||||
default-server inter 1s fall 2 rise 2 resolvers docker init-addr last,libc,none resolve-prefer ipv4
|
||||
server-template api 8 api:8080 check
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
ROOT_USER=$(cat /run/secrets/minio_root_user)
|
||||
ROOT_PASS=$(cat /run/secrets/minio_root_password)
|
||||
API_KEY=$(cat /run/secrets/s3_access_key_id)
|
||||
API_SECRET=$(cat /run/secrets/s3_secret_access_key)
|
||||
BUCKET=${S3_BUCKET:-messenger-attachments}
|
||||
|
||||
i=0
|
||||
while [ "$i" -lt 40 ]; do
|
||||
if mc alias set local http://minio:9000 "$ROOT_USER" "$ROOT_PASS" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
mc alias set local http://minio:9000 "$ROOT_USER" "$ROOT_PASS"
|
||||
|
||||
mc mb --ignore-existing "local/${BUCKET}"
|
||||
mc anonymous set none "local/${BUCKET}"
|
||||
|
||||
if ! mc admin user info local "$API_KEY" >/dev/null 2>&1; then
|
||||
mc admin user add local "$API_KEY" "$API_SECRET"
|
||||
else
|
||||
mc admin user add local "$API_KEY" "$API_SECRET" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
if ! mc admin policy info local messenger-objects >/dev/null 2>&1; then
|
||||
mc admin policy create local messenger-objects /policy.json
|
||||
else
|
||||
mc admin policy create local messenger-objects /policy.json >/dev/null 2>&1 || true
|
||||
fi
|
||||
mc admin policy attach local messenger-objects --user "$API_KEY" >/dev/null 2>&1 || true
|
||||
|
||||
echo "minio bootstrap complete bucket=${BUCKET}"
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "ApiObjectAccess",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetObject",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject",
|
||||
"s3:AbortMultipartUpload",
|
||||
"s3:ListBucket",
|
||||
"s3:GetBucketLocation"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments",
|
||||
"arn:aws:s3:::messenger-attachments/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user