Skip to content

v0.6.1-beta - Fix Automated Scheduled Sync

Choose a tag to compare

@benjaminmue benjaminmue released this 19 Jan 19:38
· 130 commits to main since this release

What's Changed

This release fixes the automated nightly CRON job that syncs TMDB metadata and OMDb ratings. Previously, the job was failing silently due to missing Docker environment variables in the cron context.

Bug Fixes

  • Fixed CRON environment isolation: Created wrapper script (run-scheduled-sync.sh) that explicitly exports all required environment variables (TMDB_API_KEY, DATABASE_*, OMDB_API_KEY, TZ) to the cron context
  • Fixed duplicate execution: Eliminated duplicate cron jobs by using only user crontab (removed /etc/cron.d/ configuration)
  • Fixed Docker logs visibility: Added supervisord sync-log-tail process to stream sync output to Docker logs
  • Fixed timezone alignment: Updated DateTime.php to respect the TZ environment variable instead of using hardcoded timezone

Improvements

  • Dual logging: Sync output now appears in both Docker logs and file logs (storage/logs/scheduled-sync.log)
  • Added OMDB_API_KEY: Environment variable is now properly passed to container for OMDb ratings sync
  • Better error visibility: Wrapper script logs start/completion messages with timestamps to Docker logs

Technical Details

New Files:

  • build/scripts/run-scheduled-sync.sh - Wrapper script with environment variable exports

Modified Files:

  • build/Dockerfile - Install wrapper script as user crontab only
  • build/config/supervisord.conf - Add sync-log-tail process
  • docker-compose.yml - Add OMDB_API_KEY environment variable
  • docker/cron/pathary-sync - Update crontab schedule to 2:00 AM
  • src/ValueObject/DateTime.php - Use TZ environment variable
  • build/scripts/entrypoint.sh - Update info message

Verification

The automated sync now:

  • ✅ Runs successfully at scheduled time (2:00 AM)
  • ✅ Syncs both TMDB metadata and OMDb ratings
  • ✅ Uses consistent timezone (respects TZ environment variable)
  • ✅ Executes only once per schedule (no duplicates)
  • ✅ Outputs visible in Docker logs: docker compose logs app

Full Changelog: v0.6.0-beta...v0.6.1-beta