forked from mtusi2026/mtusi2026lab4
lab4
This commit is contained in:
@@ -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
|
||||
@@ -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 "$@"
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"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/*"]}}},
|
||||
{"Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/originals/*"]}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"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/*"]}}},
|
||||
{"Effect": "Allow", "Action": ["s3:GetObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/originals/*"]}
|
||||
]
|
||||
}
|
||||
@@ -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"]
|
||||
Reference in New Issue
Block a user