phase 17: backup script now reports per-bucket sizes and file counts
This commit is contained in:
+25
-3
@@ -79,13 +79,35 @@ spec:
|
||||
|
||||
for bucket in stonks-raw-market stonks-raw-news stonks-raw-filings stonks-normalized stonks-llm-prompts stonks-llm-results stonks-lakehouse stonks-audit; do
|
||||
if mc ls "backup/\${bucket}" >/dev/null 2>&1; then
|
||||
echo " Mirroring \${bucket}..."
|
||||
mc mirror --quiet "backup/\${bucket}" "\${DIR}/minio/\${bucket}/" 2>/dev/null || echo " (empty or error)"
|
||||
COUNT=\$(mc ls --recursive "backup/\${bucket}" 2>/dev/null | wc -l)
|
||||
if [ "\${COUNT}" -gt 0 ]; then
|
||||
echo " \${bucket}: \${COUNT} objects, mirroring..."
|
||||
mc mirror "backup/\${bucket}" "\${DIR}/minio/\${bucket}/" 2>&1 | tail -1
|
||||
SIZE=\$(du -sh "\${DIR}/minio/\${bucket}/" 2>/dev/null | cut -f1)
|
||||
echo " \${bucket}: done (\${SIZE})"
|
||||
else
|
||||
echo " Bucket \${bucket} not found, skipping"
|
||||
echo " \${bucket}: empty, skipping"
|
||||
fi
|
||||
else
|
||||
echo " \${bucket}: not found, skipping"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=== Backup Summary ==="
|
||||
echo " PostgreSQL: \$(du -h "\${DIR}/stonks.pgdump" | cut -f1)"
|
||||
MINIO_TOTAL=\$(du -sh "\${DIR}/minio/" 2>/dev/null | cut -f1)
|
||||
echo " MinIO total: \${MINIO_TOTAL}"
|
||||
for bucket in stonks-raw-market stonks-raw-news stonks-raw-filings stonks-normalized stonks-llm-prompts stonks-llm-results stonks-lakehouse stonks-audit; do
|
||||
if [ -d "\${DIR}/minio/\${bucket}" ]; then
|
||||
BSIZE=\$(du -sh "\${DIR}/minio/\${bucket}/" 2>/dev/null | cut -f1)
|
||||
BCOUNT=\$(find "\${DIR}/minio/\${bucket}/" -type f 2>/dev/null | wc -l)
|
||||
echo " \${bucket}: \${BSIZE} (\${BCOUNT} files)"
|
||||
fi
|
||||
done
|
||||
TOTAL=\$(du -sh "\${DIR}/" 2>/dev/null | cut -f1)
|
||||
echo " Total backup size: \${TOTAL}"
|
||||
|
||||
echo "[3/3] Writing manifest..."
|
||||
cat > "\${DIR}/manifest.json" <<EOF
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user