Rende persistenti i log di produzione e protegge il deploy.

Monta /app/log sul disco video, sposta i cron log sullo stesso path, esclude log/ dal sync rsync e aggiunge pulizia volumi Docker obsoleti.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-13 09:23:42 +02:00
parent b802cf3309
commit 208664848e
9 changed files with 82 additions and 7 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Rimuove volumi Docker obsoleti dopo migrazione storage su disco video.
set -euo pipefail
PROJECT="${COMPOSE_PROJECT_NAME:-infra}"
remove_if_empty() {
local name="${PROJECT}_$1"
if ! docker volume inspect "$name" >/dev/null 2>&1; then
echo "Volume ${name}: assente, salto"
return 0
fi
local mount
mount="$(docker volume inspect "$name" --format '{{ .Mountpoint }}')"
if [ -n "$(sudo ls -A "$mount" 2>/dev/null || true)" ]; then
echo "Volume ${name}: non vuoto (${mount}), salto"
return 0
fi
docker volume rm "$name"
echo "Volume ${name}: rimosso"
}
echo "Pulizia volumi Docker obsoleti (progetto ${PROJECT})..."
remove_if_empty rails_storage
remove_if_empty recordings
remove_if_empty garage_data
remove_if_empty garage_meta