Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Running WP CLI in bulk across WP apps, or running them remotely?

    WordPress (Developer)
    2
    3
    146
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d19dotca
      d19dotca last edited by

      Hello,

      I'm using MainWP for managing my sites remotely and it works well in most cases, however there's been the odd time where for various reasons I had wanted to run some WP CLI commands either in bulk or at least remotely... was just curious if anyone has accomplished something like that before. Currently MainWP doesn't allow for remotely executing WP CLI commands (though I filed a feature request for them so maybe that'll be added in the distant future).

      Example: I want to run wp media regenerate --yes (https://developer.wordpress.org/cli/commands/media/regenerate/) across all my websites using WP CLI to regenerate all thumbnails and their sizes.

      --
      Dustin Dauncey
      www.d19.ca

      martinkbs 1 Reply Last reply Reply Quote 1
      • martinkbs
        martinkbs @d19dotca last edited by

        Hi @d19dotca,

        Yes, it is possible, and with n8n it is easy.

        You just need to have SSH access to each website you want to manage to run the WP-CLI command you want. In Cloudron, since there is no external SSH access to the application, you have to identify the container ID that corresponds to the website, in order to run a docker exec.

        docker exec CONTAINERID wp media regenerate --yes
        

        In this example workflow from n8n you can see how you can do all the actions you want, executing them manually, through a cron or with the trigger you want.

        e1f09c71-0b3b-4a4d-8e4d-2e6111bff774-image.png

        1940f91c-f5a2-49be-b64b-f4464a50c002-image.png

        d19dotca 1 Reply Last reply Reply Quote 5
        • d19dotca
          d19dotca @martinkbs last edited by

          @martinkbs Ah very interesting! I'll have to look deeper into that option. Pretty cool looking. Thanks for the idea. 🙂

          --
          Dustin Dauncey
          www.d19.ca

          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          Powered by NodeBB