forked from mtusi2026/mtusi2026lab4
Лаба 4: вложения в S3, уровни 3-5, reconciler (трек 2)
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# Перезапуск API и ВСЕХ хранилищ (PostgreSQL, Valkey, S3) с сохранением volumes (никаких down -v).
|
||||
# В конце ждёт, пока S3 реально отдаёт данные: контейнер healthy раньше, чем volume-сервер готов читать.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
C="docker compose --env-file .env"
|
||||
$C stop api
|
||||
$C restart postgres valkey s3
|
||||
$C start api
|
||||
i=0
|
||||
while [ "$i" -lt 60 ]; do
|
||||
if $C exec -T api python -c "
|
||||
from src import storage, config
|
||||
r = storage.client().list_objects_v2(Bucket=config.S3_BUCKET, Prefix='attachments/', MaxKeys=1)
|
||||
for o in r.get('Contents', []):
|
||||
storage.get_object(o['Key']).read(1)
|
||||
" >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1)); sleep 1
|
||||
done
|
||||
echo "S3 data path is not ready" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user