forked from mtusi2026/mtusi2026lab4
Реализовать ЛР4: S3-хранилище и вложения на оценку 3
Стенд: PostgreSQL 16 + две API-реплики за HAProxy + SeaweedFS S3 в приватном bucket. Метаданные вложений в PostgreSQL, байты в S3, object key назначает сервер. Лимиты 10 MiB и 40 млн пикселей, MIME по магическим байтам, проверка filename. Добавлены smoke/негативные тесты, хуки restart/stop-one, сценарий отказа S3 и отчёт с доказательствами.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Restart every process that owns state, without removing volumes or re-seeding.
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
echo "missing .env; copy .env.example and fill local values" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
docker compose --env-file .env restart postgres seaweedfs haproxy api1 api2
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. ./.env
|
||||
port="${LAB4_PORT:-8080}"
|
||||
|
||||
# /health/ready covers PostgreSQL and S3, so a 200 means the whole synchronous
|
||||
# path is usable again. Wait for it before reporting success to the caller.
|
||||
i=0
|
||||
while [ "$i" -lt 90 ]; do
|
||||
if curl -fsS "http://127.0.0.1:${port}/health/ready" >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "stack did not become ready within 90 seconds" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user