Skip to content

Maintenance Tasks

The gem provides a Rails engine that adds a mountable web UI for running, pausing, resuming, and cancelling long-running data migrations/backfills — instead of running them as raw rake tasks.

Define the tasks logic in a Task class; the gem runs it as an Active Job, iterating over a collection (DB relation, CSV, etc.), and tracks progress in a maintenance_tasks_runs table. Tasks are interruptible between iterations and support throttling (auto-pause + backoff when a condition, like DB load, is met).

A new task can be generated by using bin/rails generate maintenance_tasks:task some_task_name.

The maintenance tasks dashboard is available at /maintenance_tasks. It is mounted in config/routes.rb and protected by HTTP basic authentication in MaintenanceTaskController.

In production, access is password protected via the ADMIN_DASHBOARDS_USER and ADMIN_DASHBOARDS_PASSWORD environment variables. In staging and test environments, the dashboard is available without that password protection.