Roots Discourse

Noob question for dealing with multiple staging projects all deploying to same IP

If you have a droplet at DO and wish to deploy multiple projects to the same IP and each project is a separate repo do you need to run ansible-playbook -i hosts/production server.yml for each project? It’s required for host files and DB but wondering if such a setup actual works without messing the other sites already present.

Idea is that I have a general domain like foobar.com. Each time a new project is started I can target a new subdomain for staging env. and then maybe a dedicated ip for the production site. This allows a single droplet to house all the staging sites.

Since each site is a separate repo I was unsure if this would work. Each time I had to deploy I would have to run the playbook to get the new subdomain setup which would then mess with existing?

I have this all working for single projects with separated droplets at DO but wanted to compact the staging to a single droplet for all staging sites.

If you have a clone of Trellis for each project, then yes you’d have to run that command from each project. I’m not even sure if that would work though… If you want to have multiple sites on a server then definitely only use 1 version/clone of Trellis. The actual Bedrock/WP projects could be separate repos though.

Makes sense.

Another question, if I wanted to quickly dump a site onto a Digital Ocean but I don’t have a domain setup yet can you just assign the IP as the domain and it works as should?

Yep. Or you can use a fake domain and just add the IP/domain to your hosts file.

1 Like

Is this generally the best practice recommendation, to keep Trellis and its configs in a separate repo from /site (or whatever)?

I can definitely see the advantage, like setting up multiple sites on a single host as you’ve explained here.

I guess it makes aesthetic sense, too; keeping actual project files separate from the scaffolding that makes it work and deploy.

The only disadvantage I see is a silly one: I can’t have my developers clone a single repo and then vagrant up to start working.

Our “official” recommendation is found in our example repo: https://github.com/roots/roots-example-project.com