Why is wordress_sites.yml plural?

Here’s a question for the podcast.

For trellis, why is the file called “wordpress_sites.yml” (plural)? In the readme for trellis on github, it looks like trellis and bedrock are supposed to be inside the project folder named for one website. How is it supposed to work? Is each website project folder supposed to contain its own “ansible” and “site” (bedrock) folder? Why is “wordpress_sites.yml” plural? Is it for multisite implementations?

Also, is the plan that ansible is set up to expect staging and production to be on different IP addresses (different droplets)? I was first trying to set up a subdomain on the same droplet, but I guess that involves making a new folder, which may not be the way the ansible playbooks are set up. Can you clarify?

Another somewhat related question, what would you normally track in your git repo, the project folder (“domainname.com”), or the “site” folder?

Confused.

I’ve moved this because it’s a bit too closed to be a good question to have on the podcast.

  1. wordpress_sites.yml is plural because Trellis can configure more than one site per server. Say that I have two projects for the same client and I want to develop both in the same repository. I can set up two different sites in wordpress_sites.yml to achieve this, both with different site folders. The same can be done to share server costs between clients or your own projects etc. It’s not the ideal “12 factor app” solution so use it wisely.

  2. I do tend to use different droplets for staging and production, but there’s nothing stopping you having both on the same. Just make sure that the wordpress_sites and site_hosts are different:

    # production/wordpress_sites.yml
    wordpress_sites:
      example.com:
        site_hosts:
          - example.com
    
    # staging/wordpress_sites.yml
    wordpress_sites:
      staging.example.com:
        site_hosts:
          - staging.example.com
    
  3. Always track the project folder. The server is a very important part of your application and your repository should have every it needs to run your app (using dependency management to fill in the gaps). You can read about the “12 factor app” interpretation of this here and here.

And to address your other point about folder structure, multiple sites would look like this:

project_name
  - ansible
  - site1
  - site2
1 Like