Trellis, Bedrock, Git, and deploying to shared hosting

Hello,
At present my team and I use VVV for local development and an ad-hoc git clone/wp-cli process for deployment to our clients’ hosting accounts the vast majority of which are shared hosting accounts.

Currently our GitHub repos contain only the site files, starting at the WordPress top level. This makes initial deployment of a site pretty straight forward with just a git clone.

I see the biggest advantage of using Trellis over VVV for our situation as follows:

Our Git repo will have everything a developer needs to take over a project. Just clone, cd trellis, vagrant up and you’re ready to work. This beats the pants off our VVV process for taking over a project which involves creating a local site in VVV and then cloning/importing database and media library, etc.

But!

Because the vast majority of our clients’ sites are in shared hosting environments, we can’t implement Trellis’ great deploy options. And because with Trellis our GitHub repos will no longer be just the root of the website, we can’t just git clone for deployment either (note: I’m not suggesting this is a good method, just that it works for us right now).

So is there a good option for deployment of just the site/web directory to a shared hosting account given our situation?

I hope I have explained the situation clearly, but in the likely event that I have not please tell me where I can be more clear.

Thank you!

There’s a ton of options for more generalized deploys which apply here.

  1. You could still use customized Trellis deploys. It’s not supported for shared hosts, but it can work. Just takes a lot more manual work to match up and define settings, and some customizations. Trellis already supports deploying a “sub-folder” of a repo with its repo_subtree_path option. This involves running git archive <sub-folder> (not exact command).

  2. Any deploy tool like Capistrano, Rocketeer, etc. https://github.com/roots/bedrock-capistrano exists as well from us.

  3. A deploy service like http://deploybot.com/.

There’s nothing too special about a Trellis (or Bedrock-like) WordPress project. You just need a method to deploy the sub-folder of a git repo and to run some commands like composer install.

So basically we deploy the /web/ folder with i.e. deploybot and run composer install?

You deploy the whole site folder. Composer exists in the folder that contains web.

Ok.
I commit site (root bedrock) to bitbucket, then I deploy via deploybot.
My problem now is, that when I commit to bitbucket almost all the files are ignored.
Or is this workflow completely wrong?

When you run composer install during the deploy process, all of those ignored files will be downloaded on the server via Composer.

I’m just watching the Capitrano screencast I bought earlier and do still not figure out how the correct workflow should look like.

  • I setup bedrock, cloned sage and created a new theme; all fine here (everything locally)
  • Now I commit the whole site to bitbucket
  • When I deploy via Deploybot and run composer install at the end, from where gets composer the files if they are not in the repository?

From Packagist and WPackagist.

https://wpackagist.org/

Ah, so the theme is on his own repository and then added as part of the deployment process?

No, the theme is kept in your Git repository as seen in https://github.com/roots/roots-example-project.com

We usually recommend building the theme assets locally with gulp --production and then copying the dist folder over to the remote server.

But do I commit everything into the Git repo? the whole site folder?

Did you look at https://github.com/roots/roots-example-project.com?