Deploying Trellis to production server installs Bedrock in wrong directory

I am trying to learn Trellis + Bedrock + Sage by following the roots-example-project.

I successfully got the site provisioned and running on my local development environment, but am stuck now that I’m trying to provision and deploy to production.

I am pretty sure I followed all the instructions in the example project but I just can’t figure out why Bedrock is going in the wrong directory when I deploy to production.

On my dev server, the directory structure is:
-- ansible/ (trellis is in here) -- site/ (bedrock is in here)

But when I deploy to production, the directory structure in /srv/www/thesaucerecipes.com/current is:
-- ansible/ (trellis is in here) -- CHANGELOG.md -- composer.json -- composer.lock -- config -- CONTRIBUTING.md -- .env -- .gitignore -- LICENSE -- LICENSE.md -- README.md -- ruleset.xml -- site/ (this is where bedrock should be, but it's empty) -- Vagrantfile -- vendor/ -- web/ -- wp-cli.yml

As you can see, Bedrock is in the site’s root directory, not in the site subdirectory.

In group_vars/production, my wordpress_sites.yml file looks like this:

wordpress_sites:
  thesaucerecipes.com:
    site_hosts:
      - thesaucerecipes.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:isabisa/the-sauce-recipes.git
    branch: master
    subtree_path: site # relative path to your Bedrock/WP directory in your repo (above) if it is not the root (like the roots-example-project structure)
... yadda yadda yadda

Is it supposed to work like this or am I missing something?

It appears to mostly be working as it should.

The subtree_path setting which you correctly have set to site moves the contents of that directory to the root. Nginx is configured to serve up current/ so your Bedrock should be there. If it was actually in site/ it wouldn’t work.

The only thing that looks wrong is that ansible/ and site/ are still there. Do you have project_unwanted_items set anywhere?

You can see an example here: https://github.com/roots/roots-example-project.com/blob/fa41aff8e48cdad0e36805118464c2a5df7b2070/ansible/group_vars/all#L16

Thanks! Setting project_unwanted_items did the trick. I used the example you pointed me to and addded ‘site.’

project_unwanted_items: ['.git', 'ansible', 'site', 'Vagrantfile']

Just as a heads up, I cloned Trellis for this project and that setting isn’t in any of the files in group_vars/all. See here: https://github.com/roots/trellis/tree/master/group_vars/all

1 Like

We include a more bare bones default: https://github.com/roots/trellis/blob/8d272e1dbd5e04febbbbca939b4587cd253e4519/roles/deploy/defaults/main.yml#L20

Since the other items are more specific to the example project structure. But that’s pretty easy to overlook since we don’t really mention there’s configuration that exists only in the example project and not in Trellis itself which you need to copy over.

Glad it’s all working :smile:

Thanks, I really appreciate your help!