# ============================================================ # Docker Compose - S3 to Local Mirror + Web Dashboard # ============================================================ # Servizio che sincronizza un bucket S3-compatibile (RustFS, MinIO, etc.) # verso una cartella locale montata come volume. # Include una dashboard web in tempo reale (stile Syncthing). # # Uso: # 1. Configurare il file .env con i parametri del bucket # 2. docker compose up -d # 3. Aprire http://localhost:8080 per la dashboard # 4. I file appariranno nella cartella definita da LOCAL_SYNC_PATH # ============================================================ services: s3-sync: build: context: . dockerfile: Dockerfile container_name: s3-to-local-sync restart: unless-stopped # Variabili d'ambiente passate al container environment: # --- S3 --- - S3_ENDPOINT=${S3_ENDPOINT} - S3_ACCESS_KEY=${S3_ACCESS_KEY} - S3_SECRET_KEY=${S3_SECRET_KEY} - S3_BUCKET=${S3_BUCKET} - S3_PATH_PREFIX=${S3_PATH_PREFIX:-} - S3_REGION=${S3_REGION:-} - S3_FORCE_PATH_STYLE=${S3_FORCE_PATH_STYLE:-true} - S3_INSECURE_SSL=${S3_INSECURE_SSL:-false} # --- Sync / Pianificazione --- - SYNC_INTERVAL=${SYNC_INTERVAL:-300} - SYNC_SCHEDULE=${SYNC_SCHEDULE:-} - SYNC_ON_START=${SYNC_ON_START:-true} - SYNC_MODE=${SYNC_MODE:-mirror} - SYNC_TRANSFERS=${SYNC_TRANSFERS:-4} - SYNC_BANDWIDTH=${SYNC_BANDWIDTH:-0} - SYNC_LOG_LEVEL=${SYNC_LOG_LEVEL:-INFO} # --- Notifiche Gotify --- - GOTIFY_ENABLED=${GOTIFY_ENABLED:-false} - GOTIFY_URL=${GOTIFY_URL:-} - GOTIFY_TOKEN=${GOTIFY_TOKEN:-} - GOTIFY_PRIORITY=${GOTIFY_PRIORITY:-5} # --- Web Dashboard --- - WEB_PORT=${WEB_PORT:-8080} - STATE_DIR=/data/state # --- Sistema --- - PUID=${PUID:-1000} - PGID=${PGID:-1000} - TZ=${TZ:-Europe/Rome} # Volumi: # - Cartella locale per i file sincronizzati # - Volume per lo stato interno (persistente tra i restart) volumes: - ${LOCAL_SYNC_PATH:-./data}:/data/local - sync-state:/data/state # Porta per la dashboard web ports: - "${WEB_PORT:-8080}:${WEB_PORT:-8080}" # Healthcheck: verifica che sia il sync che il web server siano attivi healthcheck: test: ["CMD-SHELL", "pgrep -f sync.sh && wget -q --spider http://localhost:${WEB_PORT:-8080}/ || exit 1"] interval: 60s timeout: 10s retries: 3 start_period: 30s # Limiti risorse (opzionali, decommentare se necessario) # deploy: # resources: # limits: # memory: 256M # cpus: "0.5" # Volume per lo stato persistente della sync (storico, log, etc.) volumes: sync-state: driver: local