Replay fuori da Puma, fix ops cron e firma release Android.

Dopo auth Rails redirect a URL presigned su /media/ (edge → Garage); aumenta
RAILS_MAX_THREADS, corregge ingest log ops via stdin e keystore Play Console.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-13 22:59:15 +02:00
parent e1636139a9
commit 13390d8a3c
14 changed files with 214 additions and 11 deletions

View File

@@ -66,6 +66,12 @@ REPLAY_STORAGE_REGION=garage
REPLAY_STORAGE_ACCESS_KEY_ID=
REPLAY_STORAGE_SECRET_ACCESS_KEY=
REPLAY_STORAGE_FORCE_PATH_STYLE=true
# Streaming replay: Rails fa auth, edge serve /media/ → Garage (non passa da Puma)
REPLAY_MEDIA_PUBLIC_BASE_URL=https://www.matchlivetv.it/media
REPLAY_MEDIA_REDIRECT=true
# Puma: 5 thread (no secondo worker senza più RAM)
RAILS_MAX_THREADS=5
# Ops monitoring — notifiche push (ntfy self-hosted) e health check
# 1) Avvia servizio: docker compose up -d ntfy

View File

@@ -55,6 +55,7 @@ services:
command: bundle exec rails server -b 0.0.0.0 -p 3000 -e production
environment:
RAILS_ENV: production
RAILS_MAX_THREADS: ${RAILS_MAX_THREADS:-5}
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/matchlivetv
REDIS_URL: redis://redis:6379/0
MEDIAMTX_API_URL: http://mediamtx:9997
@@ -157,6 +158,7 @@ services:
command: bundle exec sidekiq -C config/sidekiq.yml -e production
environment:
RAILS_ENV: production
RAILS_MAX_THREADS: ${RAILS_MAX_THREADS:-5}
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/matchlivetv
REDIS_URL: redis://redis:6379/0
MEDIAMTX_API_URL: http://mediamtx:9997

View File

@@ -22,6 +22,28 @@ http {
set $rails_backend rails:3000;
# Replay MP4/thumbnail: solo lettura da Garage (URL presigned da Rails).
location /media/ {
limit_except GET HEAD {
deny all;
}
rewrite ^/media/(.*)$ /$1 break;
proxy_pass http://garage:3900;
proxy_http_version 1.1;
proxy_buffering off;
proxy_request_buffering off;
proxy_connect_timeout 5s;
proxy_read_timeout 3600s;
# Presigned S3 firmati sull'endpoint interno garage:3900
proxy_set_header Host garage:3900;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
}
location = /edge-health {
access_log off;
add_header Content-Type text/plain;

View File

@@ -32,4 +32,5 @@ if [[ ! -s "$TMP" ]]; then
exit 0
fi
"${ROOT}/scripts/cron/run_rails_task.sh" ops:ingest_logs["$TMP"]
# Il file temp è sull'host: passa il contenuto via stdin al container Rails.
"${ROOT}/scripts/cron/run_rails_task.sh" ops:ingest_logs < "$TMP"

View File

@@ -29,7 +29,7 @@ CRON_BLOCK="${MARKER}
30 * * * * mkdir -p ${LOG_DIR} && ${RUNNER} recordings:cleanup_local >> ${LOG_FILE} 2>&1
0 3 * * * mkdir -p ${LOG_DIR} && ${RUNNER} recordings:purge_expired >> ${LOG_FILE} 2>&1
0 8 * * * mkdir -p ${LOG_DIR} && ${RUNNER} recordings:expiry_warnings >> ${LOG_FILE} 2>&1
*/10 * * * * mkdir -p ${LOG_DIR} && ${SCAN_LOGS} >> ${OPS_LOG_FILE} 2>&1
*/10 * * * * mkdir -p ${LOG_DIR} && /bin/bash ${SCAN_LOGS} >> ${OPS_LOG_FILE} 2>&1
"
existing="$(crontab -l 2>/dev/null || true)"