Skip to content
NEWError doctor and Watchtower: failed n8n runs explained in plain words, and emailed to you. See what is new

Library / Code, Git & Developer Tools

Code, Git & Developer Tools

Update and roll back WordPress plugins and themes via SSH with Groq analysis

When you run it, it automates developer work with Groq and OpenAI / ChatGPT using Groq, SMTP Email, SSH.

What it does

## Update WordPress plugins and themes via SSH with automatic rollback Plugin updates break WordPress sites. This workflow updates every plugin and theme one at a time, checks the site after each update and rolls back automatically if something breaks. ### Who's it for Freelancers, agencies and site owners who manage WordPress sites with SSH access and want safe, unattended updates. ### How it works 1. Every Monday at 4 AM (or manually), the workflow connects via SSH, backs up the database and lists all available updates. If the site is already broken, it stops without changing anything. 2. For each plugin and theme: back up the folder, update it with WP-CLI, then check HTTP status, the WordPress error page, WordPress boot and new PHP fatal errors in the debug log. 3. If a check fails, the backup is restored and the site is verified again. Rolled-back items get one more attempt at the end. 4. Groq analyzes every failure and suggests a next step. 5. You receive an HTML email report. If a rollback fails, an emergency email goes out instead. ### How to set up 1. Copy selfheal.sh from the GitHub repository (link below) to ~/wp-selfheal/selfheal.sh on your server. 2. Open Configuration and set siteUrl, wpPath and the mail addresses. 3. Add your SSH (private key) credential to all 6 SSH nodes, plus SMTP and Groq. 4. Run it manually against a staging site first, then activate it. ### Requirements - SSH access with WP-CLI, PHP-CLI, curl and tar on the server - SMTP account - Groq API key (free tier works) ### How to customize the workflow - Change checkPaths to test more pages after each update. - Adjust keepDays and maxAttempts, or the schedule in Every Monday 4 AM. - Swap the Groq node for any other chat model. Full documentation: https://github.com/Christianzimpel/n8n-wp-self-healing-update-agent

The steps

  1. Manual start
  2. Configuration
  3. Prepare (DB backup, debug log, update list)
  4. Parse preparation
  5. Preparation result
  6. Update list
  7. Finish round
  8. Retries left?
  9. Process updates one by one
  10. Clean up
  11. Prepare analysis
  12. Failures to analyze?
  13. AI log analysis
  14. Groq

31 steps in total.

Similar automations