Hi folks,
Our agency has over 100 websites based on Trellis and hosted on DigitalOcean. We’re consistently running into a situation where we want each new website to be on the latest version of Trellis (for a number of reasons).
We run into issues where clients will come back to us for website updates and we’ll have to clone down an older Trellis site that has a bunch of differences from the newest version of Trellis. Our take has been to upgrade these websites manually by cloning down the newest version of Trellis and then manually pull all plugins, uploads, etc over to the new Trellis build.
We also typically upgrade to the newest version of WordPress and upgrade all plugins to the newest versions at this time.
Lastly, we create a new DO Droplet, reprovision, deploy and then update the DNS for each of these sites.
In summary, there’s a lot of manual maintenance involved here with maintaining Trellis sites long-term and we’re looking to write a script that will automate all of this for us. Below you will find our objectives that we’re looking to accomplish in a PHP Script (please let us know if we should not use PHP). I’m hoping that the community can provide us with feedback on any of the things that we are going to be attempting to accomplish.
Additionally, we haven’t yet selected a developer to build this for us, so if you’re interested in being hired to do so, please let me know. We’re planning on opensourcing this entire thing once it’s built.
Maintaining and Updating WordPress/Trellis Sites
Upgrade Trellis
- Git pull of existing private repp
- Create a .zip backup of the current production files and database (stored on Digitalocean Spaces)
- Pull all images from Production
- Update the WordPress YMLs with the necessary settings (automatically copying over anything that seems necessary)
- Need to look at other deploy script sections in “trellis” directory in old project and copy over any custom stuff to the new one, This would have to be flagged and then manually migrated in these instances. The flagged sites should create a ticket in Jira.
Update WordPress and all plugins
- Spin-up a local instance using the new dev YML? (vagrant up)
- Vagrant SSH into the machine and run WP-CLI to:
- Update WordPress and all plugins
- Detect any errors that have been thrown for all pages (by parsing the sitemap.xml pages)
- Attempt to resolve these automatically if they are deprecated functions - by replacing those instances of code with the updated/compliant functions. We’re assuming that this will require a decent amount of trial and error and will result in a library of conditions that might be able to be checked against. From there, we will, when receiving an error on upgrade, check this library for an automated resolution.
- If an automated resolution isn’t possible, a ticket will be created in Jira with the project name, and error message.
Update Production
- DO Snapshot old server
- Database dump
- Put current website in offline mode (in whatever way is best to handle this)
- Update production server to the newest compatible version of Ubuntu
- Clean server contents back to that of a fresh Droplet (we don’t want to create a new Droplet as this will require the DNS to be updated to a new IP address. We don’t want this because we don’t always manage the DNS ourselves and our clients would have to update this IP – removing the ability for us to automate this entire process)
- Provision server
- Commit & Deploy
- SCP/rsync all images
- Import database dump
Looking for general feedback on whether or not:
- This is possible
- We’re missing something
- There’s a better (or existing) way to approach this
- You’re a developer that’s interesting in being paid to build this.