ЛР 5 — БПИ2302 — Щербацевич — на 4

This commit is contained in:
2026-11-20 19:54:38 +03:00
parent 276dbdad8a
commit 1844c21198
88 changed files with 7499 additions and 30 deletions
+1
View File
@@ -0,0 +1 @@
{"inject_transient": false, "crash_after_s3": false, "relay_exit_before_publish": false, "stall_seconds": 0, "timeout_seconds": 0}
+39
View File
@@ -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
+36
View File
@@ -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" >/dev/null
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}"
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu
export MINIO_ROOT_USER="$(cat /run/secrets/minio_root_user)"
export MINIO_ROOT_PASSWORD="$(cat /run/secrets/minio_root_password)"
exec /usr/bin/docker-entrypoint.sh server /data --address :9000 --console-address :9001
+21
View File
@@ -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/*"
]
}
]
}
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu
export RABBITMQ_DEFAULT_USER="$(cat /run/secrets/rabbitmq_user)"
export RABBITMQ_DEFAULT_PASS="$(cat /run/secrets/rabbitmq_password)"
exec docker-entrypoint.sh rabbitmq-server