This commit is contained in:
2026-10-26 18:05:06 +03:00
parent 276dbdad8a
commit 78591e033c
96 changed files with 17965 additions and 21 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
set -eu
# Пароль не передаётся аргументом процесса и не печатается в лог.
# Root-owned directory avoids sticky /tmp protected_regular on container restart.
mkdir -p /run/broker
chmod 755 /run/broker
{
echo 'dir /data'
echo 'appendonly yes'
echo 'appendfsync always'
echo 'save ""'
echo 'maxmemory 192mb'
echo 'maxmemory-policy noeviction'
printf 'requirepass %s\n' "$(cat /run/secrets/broker_password)"
} > /run/broker/broker.conf
chmod 600 /run/broker/broker.conf
chown redis:redis /run/broker/broker.conf
exec /usr/local/bin/docker-entrypoint.sh redis-server /run/broker/broker.conf
+37
View File
@@ -0,0 +1,37 @@
global
log stdout format raw local0
maxconn 2048
defaults
mode http
log global
option httplog
timeout connect 500ms
timeout client 30s
timeout server 50s
timeout check 1s
retries 0
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 1
timeout resolve 1s
timeout retry 1s
hold valid 1s
hold nx 1s
hold other 1s
hold refused 1s
hold timeout 1s
hold obsolete 1s
frontend public
bind :8080
http-request deny if { path_beg /internal/ }
default_backend messenger
backend messenger
balance roundrobin
option httpchk GET /health/ready
http-check expect status 200
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 1
server-template api 1-4 api:8080 check resolvers docker init-addr none resolve-prefer ipv4
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu
export MINIO_ROOT_USER="$(cat /run/secrets/s3_root_user)"
export MINIO_ROOT_PASSWORD="$(cat /run/secrets/s3_root_password)"
exec minio "$@"
+45
View File
@@ -0,0 +1,45 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::messenger-attachments"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::messenger-attachments"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"originals/*",
"staging/*",
"variants/*"
]
}
}
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::messenger-attachments/originals/*",
"arn:aws:s3:::messenger-attachments/staging/*",
"arn:aws:s3:::messenger-attachments/variants/*"
]
}
]
}
+27
View File
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1.7.0
FROM python:3.12.10-slim-bookworm
ARG COMPONENT
ARG RELEASE
ARG SHA256
RUN python - <<'PY'
import hashlib
import os
from pathlib import Path
import shutil
import urllib.request
component = os.environ['COMPONENT']
release = os.environ['RELEASE']
assert component in {'minio', 'mc'}
name = f'{component}.linux-amd64.{release}'
url = f'https://github.com/minio/{component}/releases/download/{release}/{name}'
target = Path('/usr/local/bin') / component
with urllib.request.urlopen(url, timeout=180) as response, target.open('wb') as file:
shutil.copyfileobj(response, file)
with target.open('rb') as file:
digest = hashlib.file_digest(file, 'sha256').hexdigest()
assert digest == os.environ['SHA256'], 'Unexpected binary checksum'
target.chmod(0o755)
PY
COPY infra/minio-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]