Search by

vaersaagod / parrot

vaersaagod

Reports a Craft site's versions, packages and server state to Tortuga, Værsågod's fleet monitoring. Report only: it never changes the site.

Package info

github.com/vaersaagod/parrot

Type:craft-plugin

pkg:composer/vaersaagod/parrot

Statistics

Installs: 48

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0-alpha.6 2026-12-03 22:06 UTC

This package is auto-updated.

Last update: 2026-12-03 22:07:33 UTC


README

Sits on a Craft site and tells Tortuga, Værsågod's fleet monitoring hub, everything it sees: the site's versions, packages and server state.

The plugin is report only. It never changes the site: no updates, no cache clears, no writes to project config, and it never asks Craft's API for update info (that request can write licence keys). It only runs from the console, from cron and the deploy script.

Requirements

Craft CMS 3.6 or later, 4 or 5, on PHP 8.0 or later.

Craft 3 also runs on PHP 7, which Parrot doesn't. On a Craft 3 site still on PHP 7, Parrot's commands fail, but the site itself is unaffected: only its plugin class is loaded on web requests, and that works on PHP 7. Move the site to PHP 8 first. Composer can't check this for you, since Craft 3 projects usually pin Composer's PHP version to 7.2.5.

Installation

composer require vaersaagod/parrot:^1.0@alpha
./craft plugin/install parrot

Switching from Tortuga Client

Parrot was called Tortuga Client (vaersaagod/tortuga-client) in its first release. The report, the hub and the TORTUGA_URL and TORTUGA_KEY settings are the same, so only the plugin and its commands change:

./craft plugin/uninstall tortuga-client
composer remove vaersaagod/tortuga-client
composer require vaersaagod/parrot:^1.0@alpha
./craft plugin/install parrot

Commit and deploy, then change tortuga-client/report to parrot/report in the site's scheduled job and deploy script.

Uninstall before removing the package: once its code is gone, Craft can only remove the old plugin with ./craft plugin/uninstall tortuga-client --force.

Configuration

Add the hub's URL and the site's key (created on the site's page in the hub) to the site's environment:

TORTUGA_URL=https://tortuga.example.com
TORTUGA_KEY=tsk_12_...

Everything else has defaults. To change them, copy this to config/parrot.php:

<?php

return [
    // The hub URL and key, if not from TORTUGA_URL and TORTUGA_KEY
    //'hubUrl' => '$TORTUGA_URL',
    //'key' => '$TORTUGA_KEY',

    // Where to look for other Craft installs on the server
    //'craftInstallPatterns' => ['/home/*/*/craft', '/home/*/*/current/craft'],

    // How many seconds `apt list --upgradable` may take
    //'aptTimeout' => 20,
];

Setting up a site

  1. Create the site in the hub. Its page shows the key once, along with the lines below.

  2. Add TORTUGA_URL and TORTUGA_KEY to the site's environment in Forge.

  3. Add an hourly Forge scheduled job, run as the site user:

    /home/forge/example.no/craft parrot/report --jitter=600
  4. Add this as the last line of the Forge deploy script:

    ./craft parrot/report --deploy || true
  5. Check the setup by running ./craft parrot/report/test in the site's folder on the server.

craft runs with the server's php. Forge servers have one PHP version installed, so that is the site's. On a server with several, start the commands with the site's binary (php8.3 craft …); the hub flags a site whose cron job runs another PHP than its website.

Commands

# Send the report (hourly from cron); --jitter=600 first waits up to 10 minutes,
# so the sites on a server don't all report at the same moment
./craft parrot/report --jitter=600

# Send a deploy report, with the commit, branch and author from Forge's deploy script
./craft parrot/report --deploy

# Send a report now and explain any problem, to check the setup
./craft parrot/report/test

# Print the report as JSON without sending it
./craft parrot/report/preview

# Leave out the full package lists, as in a normal report
./craft parrot/report/preview --without-lists

Without TORTUGA_URL and TORTUGA_KEY, parrot/report sends nothing and exits successfully, so local copies of a site stay quiet. When a report can't be sent, the reason is printed and written to Craft's log, and the next hourly report tries again.

Reports are signed with the site's key. The package lists and the PHP-FPM configuration are only sent when the hub asks for them, which it does when they have changed; otherwise only their hashes go.

What is reported

  • Site: Craft version and edition, environment, devMode, project path, site URLs, PHP version and extensions (of the command-line PHP that runs the report), database driver and version, Craft's cached update info (critical updates newer than what is installed, abandoned plugins), whether a few settings are on (security key set, admin changes allowed, emails diverted to a test address, system online, public registration opening the control panel, robots disallowed), pending migrations, whether project config changes are waiting, the queue's failed and waiting jobs, the user IDs of the administrators (nothing else about them), which PHP-FPM socket the site's nginx config passes requests to and, on deploys, the commit, branch and author from Forge.
  • Plugins: handle, package, version, edition, installed and enabled, and the licence status Craft last heard (valid, trial, invalid, mismatched, astray or unknown). Never licence keys.
  • Composer: every package and version in composer.lock, what the project's composer.json requires (its root dependencies, with their constraints), and how the lock file compares with what is installed in vendor (packages that differ, and whether dev packages are installed).
  • Server: a SHA-256 of /etc/machine-id (never the id itself), hostname, OS release, kernel, boot time, whether a reboot is required, installed Debian packages, pending upgrades (apt list --upgradable), the apt repositories (without any credentials in their URLs), when apt last refreshed its package lists without errors, free disk space, the PHP-FPM configuration of every installed PHP version (php.ini, conf.d, php-fpm.conf and the pools, read from /etc/php/*/fpm; settings that can hold a password or token are sent as (hidden)) and the paths of other Craft installs on the server.

No content, environment values or secrets are ever sent, and nothing about users apart from the administrators' user IDs. Settings are sent as on or off, never their values. Collecting the report never writes: where Craft's own methods for these would (project config, queue counts, update checks), the plugin reads the database and config directly. Parts that cannot be collected (an apt timeout, an unreadable file) are listed under errors, and the rest of the report is sent anyway.

Server data is read as the site's own user. Nothing needs root.

Development

composer install
composer test       # PHPUnit
composer check-cs   # ECS
composer phpstan    # PHPStan, which also checks PHP 8.0 compatibility

scripts/capture-server-sample.sh captures what the plugin reads on a server (read only), to turn into test fixtures.

License

MIT. See LICENSE.md.