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/ is:
-- ansible/ (trellis is in here) -- -- composer.json -- composer.lock -- config -- -- .env -- .gitignore -- LICENSE -- -- -- 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:

    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    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:

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:

1 Like

We include a more bare bones default:

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!