Update the Kinsta Must Use plugins when deploying with Trellis

Hi, I’m using Trellis to deploy my site to Kinsta and it works flawlessly apart from one part. I can’t seem to get it to download the latest version of Kinsta’s required plugins. My composer.json file has the correct entry in repositories:


    {
      "type": "package",
      "package": {
        "name": "kinsta/kinsta-mu-plugins",
        "type": "wordpress-muplugin",
        "version": "3.4.0",
        "dist": {
          "url": "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip",
          "type": "zip"
        }
      }
    }

As per the Composer docs, the correct way to update a type: package entry like this is to manually bump the version number. When I clear my composer cache and run composer update, it correctly updates composer.lock and grabs a fresh copy of the zip from the server (it doesn’t actually know what version it is, it just assumes it’s new because the version number changed).

Then I commit & push composer.lock to my staging branch, and run trellis deploy staging site.com. I can see composer.lock is updated on my staging site, but the Kinsta MU plugin files have not changed.

Why would it work locally but not during the deploy command? Am I missing something?

I’ve asked Kinsta Support but the answer is unclear. ChatGPT suggested I delete the old files before deploying but that might break the site. Thanks for your help!

"version": "3.4.0"
//...
"url": "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip"

The culprit is that:

  1. the zip url isn’t pointing to version 3.4.0 (the url isn’t pinned a specific version)
  2. version isn’t updated correctly (you don’t know which version the zip actually contains)

Composer assumes versions (tags / commits) are immuable. Composer assumes the url forever points to that specific version as well.

Therefore, bumping the version only doesn’t guarantee Composer to re-download the url because Composer caches the zip aggressively, either in Composer’s cache-dir or re-use from project’s vendor-dir (in our case: /web/app/mu-plugins).

Although you can force Trellis to purge Composer caches using deploy hooks, the better solution is to set up Composer repositories properly.

For most cases, turning the zip into a git repo is the easiest solution.

See:

1 Like