# Multiple sites: trellis/ subfolder

**URL:** https://discourse.roots.io/t/multiple-sites-trellis-subfolder/8923
**Category:** trellis
**Created:** 2017-02-26T18:28:54Z
**Posts:** 15

## Post 1 by @strarsis — 2017-02-26T18:28:54Z

I have multiple WordPress Bedrock sites, each in a project folder with site/ and trellis/ subfolder.  
For provisioning the server, I would run the server.yml playbook.  
Now there is a trellis/ folder for each site and they may differ in version (changes in trellis github repository).

How well are the ansible deployment and provision steps separated?  
Can I just run the deployment ansible playbook of a site - what is with differences between the ansible roles/files that were used for provisioning the server and what is now used for deploying (this particular site, trellis/ sub-folder)?

---

## Post 2 by @swalkinshaw — 2017-02-26T20:58:06Z

Are they on the same server or does each one have its own server?

Our “default” example set up is just that. If you want multiple sites you can always use a single Trellis project to managed multiple sites. It depends on your set up though.

---

## Post 3 by @strarsis — 2017-02-26T21:13:29Z

The sites are on the same server, but their files are managed in separate repositories (each with separate trellis/ folder for their individual site specific config).

---

## Post 4 by @swalkinshaw — 2017-02-27T23:58:10Z

You can just consolidate into a single Trellis “install”. Make a parent folder that looks like:

```
- parent_folder/
    - trellis/
    - site1/
    - site2/
```

---

## Post 5 by @strarsis — 2017-02-28T00:01:25Z

Can then individual sites still be managed in separate git repositories?

---

## Post 6 by @swalkinshaw — 2017-02-28T00:36:46Z

Sure, if you want. Trellis just needs reference to the repos in two places:

1. Remotely, which is fine
2. Locally as well, so you can reference relative/absolute paths on your local disk to the cloned projects

---

## Post 7 by @strarsis — 2017-03-03T14:30:43Z

This is very nice because now I can keep trellis as a true cloned repository from GitHub and fetch and merge changes from it, also ensuring the same ansible files are used among all apps being deployed.

---

## Post 8 by @andrew40 — 2017-03-05T21:22:31Z

How would you set up the wordpress\_sites.yml to enable this as this is the part that confuses me slightly?

Because I would like to do this for staging sites i.e. just use one server and then seperate servers for each live site.

It might also be beneficial and cost effective the multiple very small sites both staging and live with multiple sites on them initially.

---

## Post 9 by @swalkinshaw — 2017-03-05T22:18:20Z

Can you show what you tried? Or what you would try? LIke I said before, the “sites” can live anywhere, they just need Git remotes and local paths to point to them.

---

## Post 10 by @andrew40 — 2017-03-06T22:29:12Z

I will have a bash, I just wondered what the correct procedure would be to do this.

I can understand that the server.yml would set up the server with all the necessary software and I’m ok with that and using successfully so far.

I can understand the deploy.yml file will deploy said theme and codebase and restart nginx for any particular dev project i have running locally from a git base.

What i need to do if i understand this correctly, is run another deploy from another local dev site to that same server. What I am unsure of is will nginx recognise the second site and will it be setup correctly on that server to handle the second site without having to run another server.yml, which will probably destroy the first site…

My idea is to run a single droplet just for staging sites as they will not be getting much load, and maybe another single droplet for production sites that are very small in size and traffic, thus saving costs etc and management time.

Its just an idea, i did addrsss it pretty poorly here [Trellis with Nginx Virtual Hosts on a single Digital Ocean Droplet](https://discourse.roots.io/t/trellis-with-nginx-virtual-hosts-on-a-single-digital-ocean-droplet/8357/4) but @ben said it wasn’t a very good idea but I’m unsure why?

---

## Post 11 by @fullyint — 2017-03-06T22:52:40Z

Here’s an [example `wordpress_sites`](https://discourse.roots.io/t/how-to-create-subdomain-on-digital-ocean-correctly/4695/5) set up with multiple sites (some config formats out-of-date).

If/when you add a new site to `wordpress_sites`, you would need to run `server.yml` just for the `letsencrypt` role (if you’re using Let’s Encrypt) and the `wordpress-setup` role. The `wordpress-setup` creates an nginx conf for your new site. You could add `--tags letsencrypt` or `--tags wordpress` to your command to run only these roles. Then you would need to run `deploy.sh` or `deploy.yml` to deploy the new site.

Running `server.yml` or `deploy.yml` will never destroy any sites on the server.

Explore these threads (and their links) for ideas on multiple sites with one Trellis:

> [@Recommended Setup for Multiple Sites](https://discourse.roots.io/t/recommended-setup-for-multiple-sites/5618):
>
> Finally got a roots site (trellis, bedrock, and sage) working successfully on my local machine in ~/Sites/example.com/ which includes /trellis/ and /site/ and pushed to DO server. But now trying to determine the best structure for future sites. For each new roots site, would I complete the same process such as: ~/Sites/example1.com/ [trellis] / [site] ~/Sites/example2.com/ [trellis] / [site] ~/Sites/example3.com/ [trellis] / [site] Assuming this is the recommended option, but since that wil…

[https://discourse.roots.io/t/best-practice-for-multiple-sites-on-multiple-servers/5385](https://discourse.roots.io/t/best-practice-for-multiple-sites-on-multiple-servers/5385)  
[https://discourse.roots.io/t/one-trellis-box-multiple-sites-on-individual-vps/7784](https://discourse.roots.io/t/one-trellis-box-multiple-sites-on-individual-vps/7784)  
[https://discourse.roots.io/t/one-do-droplet-per-trellis-bedrock-project/4712](https://discourse.roots.io/t/one-do-droplet-per-trellis-bedrock-project/4712)

---

## Post 12 by @andrew40 — 2017-03-06T23:00:17Z

Perfect, i’ll have look at this and see how i get on.

I’m assuming I can do this in the staging env setup and then deploy the production ones to seperate servers if needs be.

If I understand correctly if i need to add a new site to existing DO droplet i would run server.yml then deploy the new site to that server.

---

## Post 13 by @Ivan_Svaljek — 2017-11-22T16:44:47Z

How about single trellis / single VPS / multiple sites? How do we handle mail.yml settings for each site?

---

## Post 14 by @partounian — 2018-02-02T15:19:53Z

SMTP plugin is one way, I’d need to check the code for a trellis.

---

## Post 15 by @jajouka — 2018-04-08T20:44:16Z

can i have multiple sites on a single trellis install that share plugins ?
