Building a starter site / template

Hi there,

I am looking to build a template site that has some plugins pre-installed and configure, some ansible roles (for example, backup) pre-configured and that has some placeholders to kick-start site building. (I’m not using Sage.)

Does anyone have such a workflow? What would be the best way to go about this?

Thank you!

I’m curious what other people are doing as well. There’s probably a number of ways to go about this. For me, I create separate Git branches for both Trellis and Bedrock.

I customize Trellis the way I want, such as filling in the blanks for group_vars, adding packages to galaxy.yml, and other misc. fixes.

Same deal for for Bedrock, but instead customize composer.json, adding any constants to config/application (such as keys for premium plugins) and I’ve included my own Wordpress starter theme.

Then I can pull in the latest commits for either and rebase my customization commits on top. I use my own branches to start any new project. Not sure what the “best” way is, but this works well for me.


Thank you! I’ve come to rely a lot on trellis-cli, do you have any idea how I’d adjust your workflow to that? I don’t believe I should be creating branches of trellis-cli

Also, do you pre-bake certain things into your starter website that would require a database export/import? For example, I’d like to have some settings already prepared on some of the plugins, I’d like to create some basic elements etc. Do you do that or is every wordpress install in your scenario completely fresh (except for the plugins and some server settings)?

There is no need to change anything with Trellis-CLI. I don’t change anything within regular Trellis that would prevent it from working with Trellis-CLI. I stick with the basics outlined in regular Trellis documentation, such as filling in blanks within group_vars, adding a packages to galaxy.yml, and using nginx includes.

Your second question is a good one, it’s an ongoing challenge with Wordpress. For me, I define any plugin settings within my code so it can be included in Git. I avoid the database as all costs. Plugins that make this easy are Advanced Custom Fields and Admin Columns Pro. For something like custom post types, I don’t use a plugin at all and code them in my theme. It sounds like this might be more about which plugins you are using and their capabilities vs. Trellis and Bedrock.

1 Like

For the second question, I use roots’ own sync script: I keep my starter site with plugin config and some basic elements (header, footer) in my builder of choice in one development VM. Then after I create a new project, I set the new VM as the staging environment in the sync script and wp-cli (both on the starter site VM). Once both machines are spun up, they sync and I can take it from there.

For the first question: What I do right now is keep a list of all the changes I make after spinning up a vanilla wordpress installation with trellis-cli: composer.json, group_vars, some ansible roles. I go through these on new projects before syncing the database. I wonder, however, how I can automate this part. It seems there is no way to tell trellis-cli to grab parts of the fresh installation it creates not from trellis github but from my own github repository. Or am I overlooking something?

Or am I overcomplicating this?

Could I just follow this guide, delete the .git directory, change passwords in the vault and re-encrypt, switch out my starter site and new site in group_vars, init a new git repository, re-provision, re-deploy and continue from there?

I think the quote above makes sense. I’m not 100% sure about the rest. The way I do this is:

  1. Create a new folder
  2. Git clone Bedrock (or a custom branch)
  3. Git clone Trellis (or a custom branch)
  4. Fill in any variables unique to the project (like domain names and vault secrets)
  5. Run trellis vm start in the trellis directory above

That’s usually where I stop, but it sounds like you would do one extra step:

  1. Run sync script pull data from your template VM into your new VM