Roots Discourse

Is Trellis able to deploy multiple sites on to one VPS?

I’m researching Bedrock+Sage+Trellis workflow for WordPress development, and I have a question about remote server deployment.

Let’s say I have multiple websites developed locally on my computer using Trellis, and I’d like to deploy only one of the websites at a time to the same server. Is that possible with Trellis?

If so, how do I set up this kind of server? Are there any tutorials?

Thanks.

You can set up multiple sites for a Trellis server like so:

# group_vars/production/wordpress_sites.yml
wordpress_sites:
  example.com:
    site_hosts:
      - canonical: example.com
    local_path: ../example.com # path targeting local Bedrock site directory (relative to Ansible root)
    admin_email: admin@example.come
    multisite:
      enabled: false
    ssl:
      enabled: false
    cache:
      enabled: false
  another.com:
    site_hosts:
      - canonical: another.com
    local_path: ../another.com # path targeting local Bedrock site directory (relative to Ansible root)
    admin_email: admin@another.com
    multisite:
      enabled: false
    ssl:
      enabled: false
    cache:
      enabled: false

This is described in the docs:

When using Trellis for multiple sites note that:

  1. You do need to provision when you add a site to a server.
  2. Deploys are specific to a site.

A final note: though it is possible to host multiple sites on a server, it is recommended that you stick to one site per server since that increases the security (less doors in) and improves performance (no need to share). I strongly recommend this if your sites are for separate clients, since this reduces the fallout if something goes wrong.

2 Likes