docs/deployment.md
This guide captures the production considerations for running SourceMonitor inside a host Rails application. Pair it with your platform playbook (Heroku, Render, Kubernetes, etc.) for environment-specific instructions.
Ruby version management in production: Use rbenv, asdf, or the Ruby version baked into your container image, depending on your deployment platform. The commands below are shown without version manager prefixes—adjust for your environment (e.g.,
rbenv exec bundle install,asdf exec bundle install, or barebundle installin Docker).
bundle install and npm install during build steps.bin/rails railties:install:migrations FROM=source_monitor before bin/rails db:migrate so new engine tables ship with each release.bin/rails assets:precompile pulls in SourceMonitor's bundled CSS/JS outputs and Stimulus controllers. Fail the build if source_monitor:assets:verify raises.bin/rubocop, bin/brakeman --no-pager, bin/lint-assets, and bin/test-coverage mirror the repository CI setup.SourceMonitor assumes the standard Rails 8 process split:
bin/rails solid_queue:start). Scale horizontally to match feed volume and retention pruning needs. The engine uses three queues: source_monitor_fetch (time-sensitive feed polling), source_monitor_scrape (content extraction), and source_monitor_maintenance (health checks, cleanup, favicon, images, OPML import). Use queue selectors if you dedicate workers to specific queues.bin/jobs --recurring_schedule_file=config/recurring.yml so the bundled recurring tasks enqueue fetch/scrape/cleanup jobs. Disable with SOLID_QUEUE_SKIP_RECURRING=true when another scheduler handles cron-style jobs.rails solid_queue:install if queue load warrants isolation. Update the generated config before running migrations.source_monitor.fetch.finish, source_monitor.scheduler.run, source_monitor.dashboard.*) to emit logs or metrics into your monitoring stack.SourceMonitor::Metrics.snapshot periodically (e.g., via a health check controller) to track counters and gauges in Prometheus or StatsD.config.authentication.authenticate_with / authorize_with).config.fetch_queue_concurrency and the number of Solid Queue workers as source volume grows.config.fetching multipliers to smooth out noisy feeds; raising failure_increase_factor slows retries for consistently failing sources.config.fetching.scheduler_batch_size (default 25) to control how many sources are picked up per scheduler run. On larger servers, increase this to 50-100.config.fetching.stale_timeout_minutes (default 5) controls how quickly stuck "fetching" sources are recovered. Lower values mean faster recovery but more aggressive reconciliation.bin/rails source_monitor:maintenance:stagger_fetch_times to distribute them across a time window and prevent thundering herd.config.maintenance_queue_concurrency or SOURCE_MONITOR_MAINTENANCE_CONCURRENCY env var.config.retention to cap database growth; nightly cleanup jobs can run on separate workers if pruning becomes heavy.fetch_failed_total gauge for anomalies.Keep this guide alongside your platform runbooks so teams can confidently deploy and operate SourceMonitor in any environment.
The repository ships a reusable Docker stack under examples/docker that mirrors the recommended process model. It builds a Ruby 4.0 image with Node, mounts your generated example via APP_PATH, and launches three services (web, worker, scheduler) alongside Postgres and Redis. Use it to trial production settings locally or as a baseline for ECS/Kubernetes manifests.
bin/source_monitor install --yes (or an equivalent rake task wrapper) to your internal onboarding docs for both greenfield apps and existing hosts. Pair it with bin/source_monitor verify so operators can re-check queue/Action Cable health after deployments.bin/source_monitor verify right after migrations. Fail the build when the command exits non-zero and surface the JSON blob produced by the printer for diagnostics. This step replaces ad-hoc “did you start Solid Queue?” questions before merging.SOURCE_MONITOR_SETUP_TELEMETRY=true in staging/pre-prod so setup runs append logs to log/source_monitor_setup.log. Ship the file as a build artifact for debugging failed installs.docs/setup.md#rollback-steps in your release checklist so anyone piloting the workflow knows how to revert gem/routes/initializer changes if the experiment needs to pause.