Add new environment in Trellis for WordPress deployments in 5 steps

We use the Bedrock setup from Roots.io for the structure of our WordPress sites. For provisioning and deploying we use Trellis from Roots.io

Out of the box Trellis comes with a development, staging and production environment. I could not find how to add an environment in their docs (maybe it is there, but I could not find it). In my case I needed a test environment.

So here are the five steps which worked for me:

  1. copy the entire folder group_vars/staging (or production) to group_vars/<new environment name> and change all .yml files to reflect what is needed on the new environment (in my case I only changed vault.yml and wordpress_sites.yml)
  2. copy file hosts/staging (or production) to hosts/<new environment name> and change the IP adresses and the [staging] group name to [<new environment name>]
  3. now for every site you want on have on the new environment, copy the file config/staging.php (or production.php) to config/<new environment name>.php and change if needed. This last step was what took me the longest time to figure out.
  4. provision the new environment (ansible-playbook server.yml -e env=<new environment name>)
  5. deploy the site(s) to the new environment

Now on to my new test environment 🙂

You may also like...