Deploying with Trellis in a multi-developer environment

Hi everyone.

Iā€™m currently working on implementing a Wordpress DTAP process in my organization. Iā€™m counting on Trellis to do a lot of the heavy lifting. One problem Iā€™m running into thinking about all this is managing multiple developers.

We usually make pretty light Wordpress installations, and run multiple sites on one VPS. I want to create a Trellis set-up for my team where most of our default settings are already filled in for them, with the sites we managed added to the appropriate config files. Trellis would be hosted in its own private Bitbucket repo.

Each Wordpress site would be a Bedrock install and would also be hosted in their own private Bitbucket repoā€™s.

Now, we almost never have a situation where all developers are working on a single website. I donā€™t want to require the developers to have all Wordpress installations on their local development environment at all times, but I do want to manage all of these installations with a single Trellis installation. So Iā€™m wondering: what happens if I deploy a Trellis managed Wordpress site to a VPS, when I do not have all of the Wordpress installations listed in the Trellis config files currently on that machine? Does this break them on staging/production? Do they get deleted because they are not their? Do I run into errors?

Does anyone else have any suggestions on how to manage multiple developers using multiple Wordpress installations on a single Trellis installation?

Thanks for your answers.

Kind regards,
Nick

Hi,

@nickrttn did u ever find a solution for that?

Iā€™m also scratching my head about a suitable workflow for Team Members.

The initial Situation:

  • 1 Trellis clone with multiple Wordpress Sites configured (wordpress_sites.yml & vault.yml).
  • Multiple Bedrock/Theme clones (every project in its own private Repo).

Every Team Member clones the trellis fork and their necessary projects.

Thats the issue. What if you want the following setup:

| Person 1 |
-- trellis (fancysite, coolsite, awesomesite configured)
-- fancysite.dev
-- coolsite.dev
-- awesomesite.dev

And now we have Person2 who is allowed to work on 2 projects.
But if he checks out the "global" trellis fork there are clearly 3 Wordpress configurations inside. 

| Person2 |
-- trellis (fancysite, coolsite, **awesomesite  configured**)
-- fancysite.dev
-- coolsite.dev
  • Now every Team member has to update its wordpress_sites.yml & vault.yml to see
    if the configuration is correct. There is nothing wrong with it but annyoing in practice.

The next thing is the Database. I know there are a lot threads about DB synching and workflow.
But for the most time you need to get the actual Database to another Team Member. So
the workflow is that Person 1 Creates the initial DB, makes some changes and should
allow Person 2 to use this initial Database.

I donā€™t know if I oversee that but couldnā€™t you predefine a Database on provision?
Everytime Person 2 gets an project he needs to

  • provision the wordpress project
  • then he login to mysql and deletes all tables and
  • imports the initial DB from Person1

Thats a pretty big effortā€¦

Regards Kevin

1 Like

Hi, I just wanted to say Iā€™m also looking for a way to make this working. Right now Iā€™m looking into how to get Trellis to skip none existent site folders instead of erroring out. They shouldnā€™t be included since Nginx fails to start if a sync folder doesnā€™t exist.

The database will be the bottleneck in this setup but for us itā€™s easier to just send over a database to other developers or have a single master dump available during development (and removed from the repo when site is ā€œdoneā€).

Iā€™ll update this thread with our solution if and when we get this working. Love to hear your ideas and different approaches!

Hi @kregenrek and @stefanlindberg,

We ended up setting an Intel NUC with Ubuntu as sort of our ā€˜provision masterā€™. We use it for provisioning sites. Deployments, as far as I have experienced, donā€™t need all the sites on your local development box, so we can git clone and deploy single Wordpress sites just fine. I havenā€™t put any effort in database migrations, we just use All-in-One WP Migration for that, as it has an easy interface. One thing to pay attention to is rewriting the URLs in the DB between exports en imports. We often work with real content in our development environment, as our clients donā€™t usually have that much content weā€™re going to run into edge cases. We usually fill it and after that, it doesnā€™t change much. We use the same NUC for upgrading plugins and WP core.

I think this is the least effort, simplest way for us to do things.

2 Likes

makes sense. Itā€™s easy enough to set up a new dev environment. I was giving this a shot last night I thought I had a cleaver solution where I would loop through the wordpress_sites before and remove the ones not found.

wordpress_sites.each_pair do |name, site|
  if !File.directory?(File.expand_path(site['local_path'], ANSIBLE_PATH))
    wordpress_sites.delete(name)
  end
end
print wordpress_sites

This seemed to work but when the wordpress-setup role runs the sites (which folder doesnā€™t exist are still in the item varā€¦)

Itā€™s easy enough to set up a new vagrant box and Trellis project so I will keep one for deploys (with all webs) and a separate one for development (where each developer can have different sites).

Thanks for sharing your thoughts.

2 Likes