Search by

muckiware / mucki-safe-agent-plugin

tfreyda

MuckiSafe Agent plugin for Shopware 6 - agent control plane for MuckiSafe host actions

Package info

github.com/muckiware/MuckiSafeAgentPlugin

Type:shopware-platform-plugin

pkg:composer/muckiware/mucki-safe-agent-plugin

Statistics

Installs: 30

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.1 2026-11-30 17:52 UTC

README

Composer package: muckiware/mucki-safe-agent-plugin

Optional Shopware 6 plugin that provides the agent control plane for MuckiSafe: provisioning and supervision of host agents, declarative actions and parameter schemas, Facility repository hooks, backup runs, job queue, agent API, wakeup files and its own administration, ACL and audit.

MuckiFacilityPlugin stays the general backup plugin — all agent functionality lives here. The PHP plugin and the Go agent (agent/) share this repository but are built and released separately; Shopware installations never need a Go toolchain.

  • Configuring a service (policy and actions, with a worked example): docs/configuration-guide.md
  • Design document: docs/design.md
  • Normative implementation contract: docs/implementation-plan.md
  • Staged production rollout and controlled rollback: docs/rollout-runbook.md

Facility dependency

Requirement Enforced by
Plugin activation requires an installed, active MuckiFacilityPlugin >= 0.11.0 (the version shipping the neutral BackupFinishedEvent) Shopware requirement validation on the composer requirement muckiware/facility-plugin: ^0.11 plus the FacilityDependencyGuard inside MuckiSafeAgentPlugin::activate()
Facility must not be removed while this plugin is installed Composer dependency graph (composer remove muckiware/facility-plugin fails)
Facility must be deactivated/uninstalled after this plugin Shopware refuses deactivation/uninstallation of Facility while this plugin is active (FRAMEWORK__PLUGIN_HAS_DEPENDANTS)

Documented lifecycle: deactivate/uninstall MuckiSafeAgentPlugin first, then MuckiFacilityPlugin. Reverse the order to install.

Fail-closed state facility_unavailable

If Facility ends up inactive despite the protections above (for example through a direct database change), the agent administration, API and subscribers fail closed into the state facility_unavailable (FacilityDependencyGuard::STATE_FACILITY_UNAVAILABLE): no new jobs are created, a health error is shown, existing jobs are never deleted.

// Service tag-free usage — the guard is registered as its class name.
$guard = $container->get(\MuckiSafeAgentPlugin\Service\Plugin\FacilityDependencyGuard::class);

if (!$guard->isFacilityAvailable()) {
    // fail closed — see FacilityDependencyException::getReason() for details
    $guard->assertFacilityActive(); // throws FacilityDependencyException
}

Requirements

  • PHP ~8.3.0 || ~8.4.0 || ~8.5.0 with ext-sodium
  • Shopware ~6.6.10.14 || ~6.7.6
  • muckiware/facility-plugin ^0.11

Tests

composer validate --strict
composer test:unit         # tests/Unit — mocked Shopware classes, no kernel, no database
composer test              # unit + integration (integration needs an installed Shopware, see below)

Unit tests run without a Shopware installation when the plugin has a plugin-local vendor directory (composer install inside the plugin), or against the vendor directory of a surrounding Shopware checkout (phpunit --testsuite Unit --configuration=custom/plugins/MuckiSafeAgentPlugin/phpunit.xml.dist from the Shopware root).

Integration test harness

DAL, migration, route and boot tests run only inside an installed Shopware instance. The harness provisions it reproducibly:

tests/Integration/run-shopware.sh --shopware v6.6.10.32 --mysql 8.0
tests/Integration/run-shopware.sh --shopware v6.7.16.1 --mysql 8.4

It starts MySQL 8.0/8.4, checks out shopware/production at the supported tag, places MuckiFacilityPlugin (tag from MUWA_TEST_FACILITY_REF, default v0.11.0) and this plugin checkout under custom/plugins/, runs composer install, system:install, plugin:refresh, plugin:install --activate for both plugins and finally PHPUnit from the Shopware root with this plugin's configuration.

Execution modes (selected automatically):

  • native — php + composer on PATH (CI runner). MySQL either from a docker container started by the harness (ports 3380 / 3384) or from a pre-provisioned endpoint via TEST_DATABASE_URL.
  • ddev — no host PHP (development Mac): the inner phase runs inside the DDEV web container via ddev exec; MySQL runs as a host docker container reachable through host.docker.internal.

Environment contract (identical in tests/bootstrap.php, tests/Integration/run-shopware.sh and the CI workflow php-tests.yml):

Variable Meaning Default
TEST_DATABASE_URL mysql://user:***@host:port/database for the integration kernel and system:install generated by the harness
MUWA_TEST_WORKSPACE working directory for the harness checkouts /tmp/muwa-integration
MUWA_TEST_FACILITY_REF MuckiFacilityPlugin tag used by the harness v0.11.0
MUWA_TEST_KEEP_MYSQL 1 = keep the MySQL container running between runs unset

--fresh discards the cached Shopware workspace and rebuilds it from scratch.

Releases

Merging main into release (regular merge, no squash) releases plugin and agent with the version from composer.json:

Tag Workflow Release assets
vX.Y.Z plugin-release.yml MuckiSafeAgentPlugin-vX.Y.Z.zip (+ .sha256), Packagist, MuckiSafe dispatch
agent-vX.Y.Z agent-release.yml mucki-agent-X.Y.Z-linux.tar.gz (+ .sha256): static amd64/arm64 binaries, install.sh, uninstall.sh, systemd unit, example config and policy

Both are started by create-release.yml. An agent release can also be built on its own by pushing an agent-vX.Y.Z tag or via "Run workflow" on agent-release.yml with an existing tag.

License

MIT — see LICENSE.