forked from mtusi2026/mtusi2026lab4
Добавил загрузку картинок в S3 и проверку доступа к вложениям
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 512
|
||||
stats socket ipv4@0.0.0.0:9999 level admin
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
option http-server-close
|
||||
timeout connect 1s
|
||||
timeout client 40s
|
||||
timeout server 40s
|
||||
timeout http-request 5s
|
||||
timeout check 1s
|
||||
retries 0
|
||||
|
||||
resolvers docker
|
||||
nameserver embedded 127.0.0.11:53
|
||||
resolve_retries 2
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 1s
|
||||
hold obsolete 1s
|
||||
hold nx 1s
|
||||
hold timeout 1s
|
||||
hold refused 1s
|
||||
|
||||
frontend public
|
||||
bind :8080
|
||||
default_backend messenger
|
||||
|
||||
backend messenger
|
||||
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 fastinter 500ms downinter 1s fall 2 rise 1
|
||||
server-template api 8 api:8080 check resolvers docker init-addr none resolve-prefer ipv4
|
||||
@@ -0,0 +1,9 @@
|
||||
bind 0.0.0.0
|
||||
protected-mode yes
|
||||
port 6379
|
||||
dir /data
|
||||
appendonly yes
|
||||
appendfsync always
|
||||
save ""
|
||||
maxmemory 128mb
|
||||
maxmemory-policy noeviction
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM golang:1.24.7-bookworm AS build
|
||||
ENV CGO_ENABLED=0 GOTOOLCHAIN=auto
|
||||
RUN go install github.com/minio/minio@RELEASE.2025-09-07T16-13-09Z
|
||||
RUN go install github.com/minio/mc@RELEASE.2025-08-13T08-35-41Z
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /go/bin/minio /usr/local/bin/minio
|
||||
COPY --from=build /go/bin/mc /usr/local/bin/mc
|
||||
ENTRYPOINT ["minio"]
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":["arn:aws:s3:::attachments"]},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject"],"Resource":["arn:aws:s3:::attachments/original/*"]}]}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mc alias set local http://minio:9000 lab-admin "$(cat /run/secrets/s3_root_password)" >/dev/null
|
||||
mc mb --ignore-existing local/attachments
|
||||
mc anonymous set none local/attachments
|
||||
mc admin user add local messenger-api "$(cat /run/secrets/s3_secret_key)" >/dev/null
|
||||
mc admin policy create local messenger-api /bootstrap/api-policy.json
|
||||
mc admin policy attach local messenger-api --user messenger-api
|
||||
Reference in New Issue
Block a user