Fix #73: Configure automated backup schedule and address critical disk usage #120
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "typosaurus/ticket-73"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #73.
Plan
Implementation Plan: Backup Schedule & Disk Cleanup Gaps
Based on investigation, the original ticket contains several inaccuracies. The actual four gaps are:
seed_default_schedule()failure silently swallowed – if the first service init races with DB readiness, no schedule is created and no warning is raised._reconcilehandlesST_REMOVINGrows, but if the instance row is gone, the Docker container is orphaned indefinitely.None of these changes require adding a new backup schedule or rotation policy (those already exist). The plan below addresses only the true gaps.
Change 1: Log and propagate
seed_default_schedule()failuresFile:
devplacepy/services/backup/service.py_init_backend()(around line 38–40), change the silentexceptto log the exception and optionally re-raise after initialisation completes (so the service still starts but the error is visible).logger.warning(...)call whenseed_default_schedulereturnsFalseor raises.Change 2: Proactive disk alerting
File:
devplacepy/services/backup/store.py(thecompute_storage_statsfunction or a new method)percent_used > config.DISK_WARNING_THRESHOLD(default 85), call a new helper_send_disk_alert(percent_used)."disk.usage.critical") and, if a Devii notification channel is available, send a message to the admin user(s). For now, use the existingaudit.log_eventand add a simple in-app notification via the existingNotificationService(if available; otherwise just an audit event and a log entry).execute_schedule()).File:
devplacepy/services/backup/service.pyexecute_schedule()(around line 110), after backup and rotation completes, callstore.check_disk_and_alert().Change 3: Database growth rate monitoring
File:
devplacepy/services/backup/store.py(current_size - last_size) / days_since_last. If the daily growth exceeds a threshold (e.g., 10% of last size per day), log a warning and write an audit event"backup.db_growth_high".DB_GROWTH_ALERT_PCTdefault 0.1 (10% daily).state.json(or a separate JSON file in the backup directory). Use the same pattern as the backup state.Change 4: Bulk sweep of orphaned containers from hard-deleted instances
File:
devplacepy/services/containers/service.py_reconcile()(around line 170–175), after handlingST_REMOVINGinstances, add a new method_sweep_orphaned_containers()that:managed_by=devplace(if such label exists; otherwise query by known naming pattern).instancestable.Note: Ensure labels are set when creating containers (check existing
_create_container– likely already has labels). If not, add labelmanaged_by=devplaceto simplify sweep.Definition of Done
seed_default_schedulefailure is logged atWARNINGlevel indevplacepy/services/backup/service.py.disk.usage.criticaland (if available) a Devii notification when usage > 85% after a scheduled backup.backup.db_growth_highand a warning log.instancesrow) are stopped and removed at most once per 60 ticks indevplacepy/services/containers/service.py.pip install -e '.[dev]' -q && make test-unitpasses with zero failures.ruff --fix(if any).Opened automatically by Typosaurus.
Checkout
From your project repository, check out a new branch and test the changes.