Document the trellis ops surface and fix two silent monitoring bugs - #189
Merged
Conversation
The convention said Co-Authored-By lines for Claude or Mistral were permitted. They are not wanted: commit messages should carry the change and its reasoning and nothing else, which is the rule PR descriptions already followed.
Two bugs in setup-monitoring.yml that both failed silently, found while porting these playbooks into the trellis-wp-monitoring Ansible role. The security alert built its subject with an unquoted $(date +%Y-%m-%d %H:%M). date takes %H:%M as a second operand and errors out, so mail received a truncated subject and '%H:%M' as an extra recipient. Quoting the format string as one argument fixes it. The weekly summary was an inline cron command containing $(date +%Y-%m-%d). cron treats an unescaped % as end-of-command and pipes the remainder to the job's stdin, so that entry was truncated mid-word and never wrote a file. It now calls a wrapper script like the other two reports already did, which keeps % out of the crontab entirely, and gains the 90-day cleanup the other two had. Verified by rendering every wrapper with and without an alert email (bash -n clean) and asserting no crontab entry contains an unescaped %.
The Trellis section pointed at documentation but never said what commands exist, and nothing outside the plugin section mentioned that trellis-cli users reach all of this as 'trellis ops <...>'. It now opens with that equivalence and a generated table of all 27 @platform trellis commands, grouped as trellis ops presents them, with the server-executed log readers marked. The old documentation table is kept under a Guides heading. The plugin section gains the detail that matters most in practice: plugins register from PATH before trellis-cli resolves a project, so trellis ops runs anywhere, and the Ansible commands find the project through wp-ops' own detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version:
5.7.0This release fixes two silently failing monitoring automations in
trellis/monitoring/setup-monitoring.ymland documents the fulltrellis opscommand surface in the README, tagged as version 5.7.0. Both monitoring defects were shell/cron quoting bugs discovered while porting the playbook into the standaloneimagewize/trellis-wp-monitoringAnsible role: the security alert e-mail produced a mangled subject line and a bogus recipient, and the weekly traffic summary cron job never executed at all. Neither failure surfaced an error, so an operator would see only a missing report or a malformed alert. Alongside the fixes, the README's Trellis section gains a generated reference table covering all 27@platform trelliscommands, and the contributor guide tightens its commit-message convention to match the rule PR descriptions already followed.Monitoring Playbook Fixes:
dateformat string in the security alert subject. Previously$(date +%Y-%m-%d %H:%M)passed%H:%Mas a second operand, causingdateto error out andmailto receive both a truncated subject and%H:%Mas an additional recipient.weekly-summary.shwrapper script deployed via thecopymodule at mode0755. Cron treats an unescaped%as end-of-command and pipes the remainder to stdin, so the entry containing$(date +%Y-%m-%d)was truncated mid-word and produced no output.find -mtime +90 -deletecleanup those two jobs had but the weekly summary lacked.README Command Reference:
trellis opspresents them: monitoring (11), backup (9), content (2), misc (2), security (2), and diagnostics (1).(runs on server), clarifying that invoking one locally prints the SSH invocation rather than failing.$PATHbefore resolving a project, sotrellis ops doctorruns from anywhere whiletrellis infodoes not; Ansible commands still locate the project by walking up from the current directory.trellis ops trellis database-backupexample showing equivalence with thewp-opsinvocation.Conventions and Release Metadata:
CHANGELOG.mdwith Fixed and Added sections documenting the root cause of each monitoring bug and the scope of the README addition.Files Changed:
CHANGELOG.md(Modified)CLAUDE.md(Modified)README.md(Modified)trellis/monitoring/setup-monitoring.yml(Modified)