Add new environment in Trellis for WordPress deployments in 5 steps
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:
- 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)
- 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>]
- 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.
- provision the new environment (ansible-playbook server.yml -e env=<new environment name>)
- deploy the site(s) to the new environment
Now on to my new test environment 🙂