Skip to content

Document the trellis ops surface and fix two silent monitoring bugs - #189

Merged
jasperf merged 4 commits into
mainfrom
docs/trellis-ops-and-monitoring-fixes
Aug 21, 2026
Merged

Document the trellis ops surface and fix two silent monitoring bugs#189
jasperf merged 4 commits into
mainfrom
docs/trellis-ops-and-monitoring-fixes

Conversation

@jasperf

@jasperf jasperf commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Version: 5.7.0

This release fixes two silently failing monitoring automations in trellis/monitoring/setup-monitoring.yml and documents the full trellis ops command 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 standalone imagewize/trellis-wp-monitoring Ansible 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 trellis commands, and the contributor guide tightens its commit-message convention to match the rule PR descriptions already followed.

Monitoring Playbook Fixes:

  • Quoted the date format string in the security alert subject. Previously $(date +%Y-%m-%d %H:%M) passed %H:%M as a second operand, causing date to error out and mail to receive both a truncated subject and %H:%M as an additional recipient.
  • Replaced the inline weekly-summary cron command with a weekly-summary.sh wrapper script deployed via the copy module at mode 0755. 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.
  • The wrapper brings the weekly job in line with the existing daily traffic and security reports, which already used wrapper scripts, and adds the 90-day find -mtime +90 -delete cleanup those two jobs had but the weekly summary lacked.

README Command Reference:

  • Added a "Command reference" section listing all 27 Trellis-relevant commands, grouped as trellis ops presents them: monitoring (11), backup (9), content (2), misc (2), security (2), and diagnostics (1).
  • Marked commands that execute on the host with (runs on server), clarifying that invoking one locally prints the SSH invocation rather than failing.
  • Clarified plugin resolution behaviour: trellis-cli registers plugins from $PATH before resolving a project, so trellis ops doctor runs from anywhere while trellis info does not; Ansible commands still locate the project by walking up from the current directory.
  • Moved the existing documentation table under a "Guides" heading rather than replacing it, and added a trellis ops trellis database-backup example showing equivalence with the wp-ops invocation.

Conventions and Release Metadata:

  • Tightened the commit-message convention in the contributor guide: commit messages carry the change and its reasoning only, with no attribution trailers or tool references. This matches the constraint PR descriptions were already held to.
  • Recorded the 5.7.0 entry in CHANGELOG.md with Fixed and Added sections documenting the root cause of each monitoring bug and the scope of the README addition.

Files Changed:

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.
@jasperf
jasperf merged commit 68f9c9a into main Aug 21, 2026
1 check passed
@jasperf
jasperf deleted the docs/trellis-ops-and-monitoring-fixes branch August 21, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant