How to manage multiple projects and keep up-to-date versions of Roots

Couldnā€™t fit an entire title for the question(s) I have. I can edit a better one later for future reference if anyone comes up with a better one. This is sort of a series of questions I have concerning best practice, setup, workflow, and deployment. Iā€™m using Sage/Bedrock right now on a personal project and Iā€™m liking it a lot. Iā€™m considering using the Roots workflow on future client projects but donā€™t have any idea how to manage multiple projects in a sane manner. Iā€™m coming from a MAMP workflow but have dabbled with Vagrant and understand it for the most part. Iā€™m a front-end dev also so some of the stuff I find in the Roots/Sage/Bedrock docs can be intimidating at times. I plan on deploying these client sites to a WP-Engine install so that adds some limitations to a full circle Roots workflow/install, but here are some questions I have that Iā€™ll try to categorize:

Setup

  1. Whatā€™s the most efficient way to mange multiple projects on my local computer? Right now I have a personal project with the ā€˜bedrock-ansibleā€™ and ā€˜siteā€™ folders in the root of it. Should I have a default folder with a bunch of projects within that that also contain the ā€˜bedrockā€™ and ā€˜siteā€™ folders? Iā€™m used to the MAMP folder structure i.e., a folder ā€“ ā€˜htdocsā€™ ā€“ and all project folders inside of it.

Development

  1. Do I have to run vagrant up everytime I want to jump back on a project or is Vagrant always running in the background, like MAMP is? On my personal project Iā€™ve noticed that sometimes when I come back to my computer and run gulp watch nothing happens. Right now I have to exit that command andcd to the folder that holds the Vagrantfile and vagrant up then cd back to my theme folder and gulp watch again. Any workaround for this, or am I doing something wrong?

  2. Whatā€™s the best way to develop with the Sage theme? I copied the Sage/Bedrock example from Github, renamed the theme folder and started developing from there. How should I be updating my entire Sage project when new commits and updates are made to Sage while keeping my theme changes intact?

Deployment

  1. Like I mentioned earlier I plan on deploying to WP-Engine so their will be limitations to my deployment process and folder structure if Iā€™m understanding everything correctly. Has anyone had any experience with a Sage/Bedrock project and WPE?
1 Like

Iā€™ve been working hard these past few days to migrate away from WPEngine, moving to DigitalOcean, so I canā€™t help you there, but as to the dev questions:

The VirtualBox Vagrant images should stay running so long as you donā€™t restart the computer, but the last time I checked, you couldnā€™t run multiple ones at the same time without editing the ip address during setup, and I was never sure how to do that. So my workflow is to cd into the directory of the site Iā€™m not working on, vagrant suspend, then cd into the folder I am working on, vagrant up.

You could create a bash script that does it all for you, maybe take some variables to begin (site to suspend, site to launch), and save yourself some typing.

As to developing with Sage, I still find this hard to deal with, I think at a certain stage, you just need to let go of keeping it inline with the repo, and make it work for you. Anyone else have input?

1 Like

I highly suggest you read this thread, where I ask about running multiple projects.

Setup
It doesnā€™t matter where on your computer you place your sites. It is not like with MAMP where you have to place projects inside a specific htdocs folder in order for them to work with the webserver. After getting help in the thread I linked above, Iā€™ve setup a structure where I have one trellis (a.k.a. bedrock-ansible) installation with multiple sites which I want hosted on the same Digital Ocean droplet. It looks something like this;

    - My project-folder
    .Vagrantfile
      /trellis
      /bedrock1
      /bedrock2
      .. and so on

Where all of the bedrock folders are git clones of the bedrock-repo. Each time you add a new site you will need to add it to your group_vars/ files as a new object inside wordpress-sites and then run vagrant reload --provision. Notice that the .Vagrantfile has to be moved up to the root of the project, as done in the roots-example-repo. I then created one git repo in the root folder which has everything except /trellis and .Vagrantfile in .gitignore. I also create a new git repo inside of each bedrock folder, as this is needed for deploys via Trellis.

Development

  1. As @evanfuture says ā€“ as long as you havenā€™t restarted your computer or ran vagrant halt or vagrant suspend you shouldnā€™t have to run vagrant up.
  2. Sage is a starter theme and you donā€™t actually need to keep it aligned with the original repo, but if you wanted to follow along you could add the roots repo as another remote called upstream using git remote add upstream git@github.com:roots/sage.git. This might be a bit tricky if you use the setup I use, since each of your sage folders will be inside one of the bedrock repos, but @swalkinshaw has eluded that it could be done. Search stack overflow.

Deployment

  1. No experience of WP-Engine. I totally recommend DigitalOcean however, and Iā€™m not really sure why you would use WP-Engine as Trellis configs everything for you. To be honest, Iā€™m not really sure that a Trellis based setup would be able to deploy to WP-engine as I guess they donā€™t supply vanilla Ubuntu 14.04 servers.
5 Likes

Thanks, let me know how your migration goes. Iā€™m thinking about doing the same sometime in the near future. Just donā€™t know how demanding it will be.

To be honest, Iā€™m not really sure that a Trellis based setup would be able to deploy to WP-engine as I guess they donā€™t supply vanilla Ubuntu 14.04 servers

The problem with deploying from a Bedrock site to WP Engine is with Bedrockā€™s directory structureā€¦WP Engine uses the default WP directory setup. I think I remember someone created a bash script that will reorganize the folders to WordPressā€™s default setup.

Yea I saw that. I might give it a try or just make the switch DO. The thing is Iā€™ve never set up a server, but from I read itā€™s pretty easy to setup a DO droplet. I build lots of Woocommerce sites and like to always keep security and performance in mind when building a site. WPE does a good job at doing all of that on the server side for me. I prefer to stay away from most server side stuff but if DO is pretty easy and if it can eliminate unnecessary cost for future clients then Iā€™m in.

A single site migration was very simple, though it required a database-synching plugin which is outside the scope of Trellis. Iā€™d say the whole process only took me half an hour once I worked out the kinks. Thank goodness too, as I had five sites to transfer over.

Iā€™m working through a more complicated migration at the moment, where I have on Trellis install/server managing five sites. Thatā€™s so I can keep them all on one DO droplet and save money. The setup required a bit more fiddling, but Iā€™m finally at the deploy stage, and its going well so far. PM me if you need any advice along the way.

2 Likes

While DO might be ā€œeasyā€ becoming the admin of the server is not, especially when youā€™re managing ecommerce sites with SSL + security + PCI and liability issues. Though Iā€™d say if you want to learn itā€™s definitely worth it.

2 Likes