This repository is an example of how to integrate and use the following projects together:
For more background, see this blog post.
This project is a complete working example that's deployed on a Digital Ocean 512MB droplet.
You can view it at http://roots-example-project.com/.
This project can be cloned and re-configured to fit your needs but we highly suggest you follow in the instructions below to create your own. This will guarantee you have the latest version of Bedrock, Trellis, Sage, and Soil in case this example falls behind a little.
Here's how this example project was created:
- Create a new project directory:
$ mkdir example.com && cd example.com
- Clone Trellis:
$ git clone --depth=1 git@github.com:roots/trellis.git && rm -rf trellis/.git
- Clone Bedrock:
$ git clone --depth=1 git@github.com:roots/bedrock.git site && rm -rf site/.git
- Clone Sage:
$ git clone --depth=1 git@github.com:roots/sage.git site/web/app/themes/sage && rm -rf site/web/app/themes/sage/.git
After that your folder structure is complete and you're ready to configure the individual components.
Bedrock doesn't need any additional configuration by default. There's only one custom option set in this example: WP_DEFAULT_THEME
.
- In
site/config/application.php
adddefine('WP_DEFAULT_THEME', 'sage');
Trellis' instructions apply here, but more specifically:
- Make sure you have the requirements all installed
- Install the Ansible Galaxy roles:
$ cd trellis && ansible-galaxy install -r requirements.yml
- Configure your
wordpress_sites
- see the Local Development Setup docs
If you also want staging/production servers, create those manually at this point.
- Add their hostnames/IPs to
ansible/hosts/<environment>
- Configure their
wordpress_sites
just like #3 above and follow the Remote Server Setup docs - Define your SSH
keys
to give users the ability to deploy, see the SSH Keys docs
- Run
vagrant up
- Provision server:
ansible-playbook server.yml -e env=<environment>
- Deploy your site:
./deploy.sh <environment> <site name>
Some notes on names used throughout this project:
- You're encouraged to rename Sage to your theme name. Just remember to rename references to it everywhere.
- Any time you see a name like "example.com", "example.dev", "roots-example-project.com", etc, it should be renamed to your project name.
<environment>
is a placeholder to be replaced bystaging
orproduction
(for example).
- Install Sage's requirements
- SSH into VM:
$ vagrant ssh
- Add the Soil plugin:
$ cd /srv/www/roots-example-project.com/current && composer require roots/soil dev-master
(note: non-development use requires a license that you can purchase on the Roots site) - Activate Soil:
$ wp plugin activate soil
- Configure Sage and customize the theme as usual. At a minimum, do this on your host/local machine:
$ cd web/app/themes/sage
$ npm install
$ bower install
$ gulp