One Trellis Box - Multiple Sites on Individual VPS

I’ve seen this question asked a little around the discourse but am yet to find any solid knowledge on how to do it correctly.

The Problem
I don’t want to run multiple Trellis instances for each of my sites. It gets super messy and previously led to terrible performance for me locally.

I have set up multiple working Development sites, but am now hoping to figure out deployment so each of the sites can sit on their own individual droplet/VPS.

How do I set up my hosts - staging/production file?

Thanks in advance.

Apologies if I’m misunderstanding: are you looking to set up multiple sites on a single Trellis box, or set up one Trellis box per site?

If you’re looking to set up multiple sites per box:

This is briefly covered in the Trellis docs.

You’d write your config for Trellis in wordpress_sites.yml for whichever environment you’re deploying to:

wordpress_sites:
  site1.com:
    site_hosts:
[etc]
  site2.com
    site_hosts:
[etc]

It even works if you have a Multisite install alongside a regular install, though the provision step on the multisite install can be a little wonky.

I’ve currently got two personal sites on one DO droplet (the smallest, 512mb one), and one of the sites is a Multisite; I’ve not noticed any perceptible performance hits locally or on the Droplet.

1 Like

If I want each of the individual sites in wordpress_sites to be deployed to their own VPS. How do you propose I set up up my hosts/production file?

That’s quite an unusual requirement, I imagine most people would consider those sites different projects. Unless you want the development server to have them all on one VM/Trellis, but in production you want them split across multiple servers? I’m just spitballing here, but using git submodules (pet love of mine) for the sites and trellis might solve that case.

The above topic seems pretty relevant for you too, though I’ve never tried a config like the one mentioned.

1 Like