forked from mtusi2026/mtusi2026lab5
ЛР 5: асинхронная обработка изображений и идемпотентность pipeline
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 2048
|
||||
|
||||
defaults
|
||||
log global
|
||||
mode http
|
||||
option httplog
|
||||
timeout connect 500ms
|
||||
timeout client 40s
|
||||
timeout server 40s
|
||||
timeout http-request 3s
|
||||
timeout http-keep-alive 5s
|
||||
timeout check 500ms
|
||||
retries 0
|
||||
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
accepted_payload_size 8192
|
||||
resolve_retries 2
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 1s
|
||||
hold obsolete 1s
|
||||
hold nx 1s
|
||||
|
||||
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
|
||||
server-template replica 1-4 api:8080 check inter 500ms fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none
|
||||
|
||||
listen stats
|
||||
bind :8404
|
||||
stats enable
|
||||
stats uri /stats
|
||||
|
||||
# MinIO is reachable only through this internal listener. Public port 9000 is
|
||||
# never published. Block unsupported vulnerable features in the archived CE.
|
||||
frontend private_s3
|
||||
bind :9000
|
||||
no log
|
||||
acl unsigned_trailer req.hdr(x-amz-content-sha256) -i STREAMING-UNSIGNED-PAYLOAD-TRAILER
|
||||
http-request deny deny_status 403 if unsigned_trailer
|
||||
acl internal_storage path,url_dec -m beg -i /minio/storage /minio/peer /minio/grid /minio/bootstrap
|
||||
http-request deny deny_status 403 if internal_storage
|
||||
acl s3_select query,url_dec -m reg -i '(^|&)select([=&]|$)'
|
||||
http-request deny deny_status 403 if s3_select
|
||||
acl replication_header req.hdr(x-minio-source-replication-request) -m found
|
||||
http-request deny deny_status 403 if replication_header
|
||||
default_backend minio_private
|
||||
|
||||
backend minio_private
|
||||
option httpchk
|
||||
http-check send meth GET uri /minio/health/ready ver HTTP/1.1 hdr Host minio-backend
|
||||
http-check expect status 200
|
||||
server minio minio-backend:9000 check inter 1s resolvers docker init-addr none
|
||||
@@ -0,0 +1,20 @@
|
||||
// Standalone health probe for the minimal MinIO container.
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := http.Client{Timeout: time.Second}
|
||||
response, err := client.Get("http://127.0.0.1:9000/minio/health/ready")
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
response.Body.Close()
|
||||
if response.StatusCode != 200 {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
# No shell tracing and no credentials in persistent config or output.
|
||||
for attempt in $(seq 1 30); do
|
||||
if wget -q -O /dev/null http://s3:9000/minio/health/ready; then break; fi
|
||||
sleep 1
|
||||
done
|
||||
mc alias set local http://s3:9000 "$(cat /run/secrets/s3_root_user)" "$(cat /run/secrets/s3_root_password)" >/dev/null
|
||||
mc mb --ignore-existing local/messenger-attachments >/dev/null
|
||||
mc anonymous set none local/messenger-attachments >/dev/null
|
||||
mc admin user add local "$(cat /run/secrets/s3_access_key_id)" "$(cat /run/secrets/s3_secret_access_key)" >/dev/null
|
||||
mc admin policy create local messenger-api /bootstrap/policy.json >/dev/null
|
||||
mc admin policy attach local messenger-api --user "$(cat /run/secrets/s3_access_key_id)" >/dev/null
|
||||
mc admin user add local "$(cat /run/secrets/s3_worker_access_key_id)" "$(cat /run/secrets/s3_worker_secret_access_key)" >/dev/null
|
||||
mc admin policy create local messenger-worker /bootstrap/worker-policy.json >/dev/null
|
||||
mc admin policy attach local messenger-worker --user "$(cat /run/secrets/s3_worker_access_key_id)" >/dev/null
|
||||
echo 'Private bucket and restricted service accounts ready.'
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{"Effect": "Allow", "Action": ["s3:GetBucketLocation", "s3:ListBucket"], "Resource": ["arn:aws:s3:::messenger-attachments"]},
|
||||
{"Effect": "Allow", "Action": ["s3:PutObject"], "Resource": ["arn:aws:s3:::messenger-attachments/staging/*"]},
|
||||
{"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": ["arn:aws:s3:::messenger-attachments/original/*", "arn:aws:s3:::messenger-attachments/thumbnail/*", "arn:aws:s3:::messenger-attachments/crop/*", "arn:aws:s3:::messenger-attachments/optimized/*"]}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{"Effect": "Allow", "Action": ["s3:GetBucketLocation", "s3:ListBucket"], "Resource": ["arn:aws:s3:::messenger-attachments"]},
|
||||
{"Effect": "Allow", "Action": ["s3:GetObject", "s3:DeleteObject"], "Resource": ["arn:aws:s3:::messenger-attachments/staging/*"]},
|
||||
{"Effect": "Allow", "Action": ["s3:PutObject", "s3:GetObject"], "Resource": ["arn:aws:s3:::messenger-attachments/original/*", "arn:aws:s3:::messenger-attachments/thumbnail/*", "arn:aws:s3:::messenger-attachments/crop/*", "arn:aws:s3:::messenger-attachments/optimized/*"]}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user