feat: add disk space check to requirements recipe - #41
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟡 Changes recommended
The new DB datadir detection can mis-parse MySQL output when warnings are present, which can cause incorrect/failed disk checks on real targets.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new disk space requirement check to the Deployer “requirements” recipe, covering both the webspace filesystem and (when the DB host is local) the database data directory, and refactors MySQL CLI invocation into a shared helper.
Changes:
- Introduces
requirements:check:disk_spaceto report OK/WARN/FAIL based on configurable used-space thresholds. - Adds shared helpers in
deployer/requirements/functions.phpfor disk-space checking, formatting, and MySQL query execution. - Wires the new check into
requirements:check,requirements:list, autoloading, and documentation/config defaults.
File summaries
| File | Description |
|---|---|
| docs/REQUIREMENTS.md | Documents the new disk space check behavior, thresholds, and configuration example. |
| deployer/requirements/task/requirements.php | Adds requirements:check:disk_space to the main requirements check sequence. |
| deployer/requirements/task/list.php | Displays disk space thresholds/details in requirements:list. |
| deployer/requirements/task/check_disk_space.php | Implements the new disk space check task (webspace + conditional DB datadir). |
| deployer/requirements/task/check_database_grants.php | Reuses the new shared runMysqlQuery() helper for grants checks. |
| deployer/requirements/functions.php | Adds runMysqlQuery(), checkDiskSpaceAtPath(), and formatKilobytes(). |
| deployer/requirements/config/set.php | Adds disk space configuration defaults and enable/disable flag. |
| autoload.php | Ensures the new disk space task file is loaded. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
requirements:check:disk_spacesubtask that checks free disk space on the webspace path and, when reachable, the database's data directoryrunMysqlQuery()helper to avoid duplicating the mysql CLI invocation between the new check and the existing database grants checkChanges
deployer/requirements/task/check_disk_space.php- new task: checks webspace path viadf, and the database data directory viaSHOW VARIABLES LIKE 'datadir'when the DB host is localdeployer/requirements/functions.php- addscheckDiskSpaceAtPath(),formatKilobytes(), and the sharedrunMysqlQuery()helperdeployer/requirements/task/check_database_grants.php- reuserunMysqlQuery()instead of duplicating the mysql CLI invocationdeployer/requirements/config/set.php- newrequirements_check_disk_space_enabled,requirements_disk_space_warn_percent(80),requirements_disk_space_fail_percent(95),requirements_disk_space_webspace_path(defaults todeploy_path) settingsdeployer/requirements/task/requirements.php- wire the new subtask intorequirements:checkdeployer/requirements/task/list.php- list the disk space thresholds inrequirements:listautoload.php- require the new task filedocs/REQUIREMENTS.md- document the new check, its thresholds, and how to wire it as a deploy-blocking hookTest Plan
dep requirements:check [host]against a real target and confirm the "Disk space: webspace" row reports plausible OK/WARN/FAIL values127.0.0.1/localhost, and is SKIPped with a clear reason otherwisedep requirements:list [host]and confirm the Disk Space section rendersCloses #38