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

@@ -5,7 +5,19 @@ set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
RUNNER="${ROOT}/scripts/cron/run_rails_task.sh"
SCAN_LOGS="${ROOT}/scripts/cron/scan_ops_logs.sh"
LOG_DIR="${MATCHLIVETV_LOG_DIR:-/opt/matchlivetv/log}"
ENV_FILE="${ROOT}/.env"
VIDEOS_ROOT="/media/videos/matchlivetv"
if [ -f "$ENV_FILE" ]; then
line="$(grep -E '^MATCHLIVETV_VIDEOS_ROOT=' "$ENV_FILE" 2>/dev/null | tail -1 || true)"
if [ -n "$line" ]; then
VIDEOS_ROOT="${line#MATCHLIVETV_VIDEOS_ROOT=}"
VIDEOS_ROOT="${VIDEOS_ROOT%\"}"
VIDEOS_ROOT="${VIDEOS_ROOT#\"}"
fi
fi
LOG_DIR="${MATCHLIVETV_LOG_DIR:-${VIDEOS_ROOT}/log}"
LOG_FILE="${LOG_DIR}/cron-replay.log"
OPS_LOG_FILE="${LOG_DIR}/cron-ops.log"
@@ -30,5 +42,6 @@ fi
echo "$CRON_BLOCK"
} | sed '/^$/d' | crontab -
echo "Log persistenti: ${LOG_DIR}"
echo "Crontab installato:"
crontab -l | grep -A3 "$MARKER"
crontab -l | grep -A4 "$MARKER"