Rudel
Features

Automation

Rudel's automation layer is the part that keeps a busy installation from turning into a graveyard of forgotten sandboxes and unbounded recovery data. The hourly WP-Cron runner can sweep stale sandboxes, create scheduled app backups, prune old recovery history, and surface environments that are close to expiry.

What runs automatically

When any automation feature is enabled, Rudel schedules an hourly cron event and runs:

  • standard cleanup
  • merged-branch cleanup
  • scheduled app backups
  • app backup retention pruning
  • app deployment-history pruning
  • expiring-environment reporting

Key config values

These settings are persisted in the host WordPress database through the wp_options row named rudel_config. They are runtime configuration, not checked-in project files.

KeyMeaningDefault
auto_cleanup_enabledRun standard sandbox cleanup automatically1
auto_cleanup_mergedRun merged-branch cleanup automatically0
auto_app_backups_enabledCreate scheduled app backups0
auto_app_backup_interval_hoursMinimum hours between scheduled backups for the same app24
auto_app_backup_retention_countKeep only the newest N app backups0
auto_app_deployment_retention_countKeep only the newest N deployment records per app0
expiring_environment_notice_daysInclude environments expiring within N days in automation output0

Scheduled app backups

If an app is a long-lived runtime target, it often deserves its own regular recovery points even when no sandbox deploy is happening.

Enable that flow:

$config = new \Rudel\RudelConfig();
$config->set( 'auto_app_backups_enabled', 1 );
$config->set( 'auto_app_backup_interval_hours', 24 );
$config->save();

Rudel will then create a scheduled backup for each app only when the most recent backup is older than the configured interval. That keeps the backup history useful without generating duplicate recovery points every hour.

Retention

App recovery history can grow indefinitely if you never prune it. Retention settings let Rudel trim that state automatically:

$config = new \Rudel\RudelConfig();
$config->set( 'auto_app_backup_retention_count', 10 );
$config->set( 'auto_app_deployment_retention_count', 25 );
$config->save();

Backups and deployment records are pruned per app, newest first. Retention is about keeping recovery history valuable, not about deleting state blindly.

Expiry reporting

Some teams want cleanup to be aggressive. Others want a warning window first. expiring_environment_notice_days gives you that second option by surfacing upcoming expiries through the automation result and hook layer.

$config = new \Rudel\RudelConfig();
$config->set( 'expiring_environment_notice_days', 3 );
$config->save();

That does not delete anything by itself. It simply reports what is close to expiry so your own code can notify owners, open tickets, or escalate the state somewhere else.

Running automation on demand

From PHP:

use Rudel\Rudel;

$result = Rudel::run_automation();

Rudel::run_automation() is the accurate entry point here because it runs the full maintenance pipeline, not just one cleanup routine.

Hooks

Automation is designed to be integrated rather than hidden. The main hooks are:

  • rudel_before_automation_cleanup
  • rudel_after_automation_cleanup
  • rudel_before_automation_app_backups
  • rudel_after_automation_app_backups
  • rudel_before_automation_app_retention
  • rudel_after_automation_app_retention
  • rudel_after_automation_expiring_environments

See Hooks for the broader extension contract.

On this page