Реализовать lab4 на оценку 4: SeaweedFS, вложения и согласованность БД/S3.

Перенесён стенд lab3 (API, Redis-сессии, идемпотентность, HAProxy, реплики API). Добавлены приватный bucket SeaweedFS с отдельным ключом API, загрузка PNG/JPEG с лимитами и полной проверкой, компенсация и reconciler, плавная остановка API, тесты и evidence.
This commit is contained in:
Mikhail Verkovykh
2026-11-06 19:48:37 +03:00
parent ec540a1a72
commit 728e53cc55
94 changed files with 8821 additions and 43 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
# s3-gw shares the network namespace of the `s3` container. When s3 restarts (crash,
# `docker restart`, Docker daemon restart) it gets a NEW namespace and this one is left
# with only `lo`: HAProxy keeps running but nothing can reach it. Exit in that case so
# the restart policy starts s3-gw again inside the current namespace of s3.
haproxy -W -db -f /usr/local/etc/haproxy/haproxy.cfg &
pid=$!
trap 'kill -TERM "$pid" 2>/dev/null' TERM INT USR1
orphaned() {
# /proc/net/dev: two header lines (with '|') and one line per interface.
! grep -qv -e '^ *lo:' -e '|' /proc/net/dev
}
while kill -0 "$pid" 2>/dev/null; do
if orphaned; then
echo "s3-gw: network namespace of s3 is gone; exiting so the restart policy re-joins it" >&2
kill -TERM "$pid" 2>/dev/null
wait "$pid"
# Docker does not retry a start that fails because s3 is not running yet:
# give the restart policy of s3 time to bring it back first.
sleep 5
exit 1
fi
sleep 2 &
wait $!
done
wait "$pid"