Upgrading trellis, ansible

Hi,

Maybe there is a good thread on this topic. Please link and we close this one but here is my question:

I have a trellis that is almost 5 years old. It’s runs on:
ansible 2.4.3.0
ubuntu 16.4
mariadb 10.2

I have a dev, staging and production server which I now need to upgrade without destroying any server and rebuild. It’s a webshop with a lot of data that cannot have a downtime or loose data.

One thing that I thought of is upgrading the servers with SSH first to match newer trellis roles version and the upgrade my trellis to match the live servers with it’s “checks” on ansible and deploys.

But that also feels risky, is there any procedure or guide I should follow?

Putting aside Trellis and Ansible for a second, you’d also be upgrading from Ubuntu 16 to 20 and to MariaDB 10.5; not to mention all the other packages like Nginx, PHP, etc.

I’d suggest the following:

  1. create a new branch where you upgrade Trellis; it might be easier to start with a brand new project and then port over configuration you’ve changed
  2. test this out in development
  3. create a new staging server (leaving the old one running), test and verify on it
  4. create a new production server (again, leaving the current one running), and test it

For both new staging and production servers, you can change your local DNS to point to them (or use /etc/hosts).

Then once you’ve verified everything is working you can update your DNS from the old servers to the new ones which avoids any downtime. Depending on your setup you might require some downtime to do a final sync of the database and uploads.