Ansible playbooks for setting up a LEMP stack for WordPress.
- Local development environment with Vagrant
- High-performance production servers
- One-command deploys for your Bedrock-based WordPress sites
Trellis will configure a server with the following and more:
- Ubuntu 14.04 Trusty LTS
- Nginx (with optional FastCGI micro-caching)
- PHP 7.0
- MariaDB (a drop-in MySQL replacement)
- SSL support (scores an A+ on the Qualys SSL Labs Test)
- HTTP/2 support (requires SSL)
- Composer
- WP-CLI
- sSMTP (mail delivery)
- MailHog
- Memcached
- Fail2ban
- ferm
Make sure all dependencies have been installed before moving on:
- Ansible >= 2.0.0.2
- Virtualbox >= 4.3.10
- Vagrant >= 1.5.4
- vagrant-bindfs >= 0.3.1 (Windows users may skip this)
- vagrant-hostmanager
The recommended directory structure for a Trellis project looks like:
example.com/ # → Root folder for the project
├── trellis/ # → Your clone of this repository
└── site/ # → A Bedrock-based WordPress site
└── web/
├── app/ # → WordPress content directory (themes, plugins, etc.)
└── wp/ # → WordPress core (don't touch!)
See a complete working example in the roots-example-project.com repo.
- 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
- Install the Ansible Galaxy roles:
$ cd trellis && ansible-galaxy install -r requirements.yml
Windows user? Read the Windows docs for slightly different installation instructions. VirtualBox is known to have poor performance in Windows — use VMware or see some possible solutions.
Trellis documentation is available at https://roots.io/trellis/docs/.
- Configure your WordPress sites in
group_vars/development/wordpress_sites.yml
and ingroup_vars/development/vault.yml
- Run
vagrant up
Read the local development docs for more information.
A base Ubuntu 14.04 server is required for setting up remote servers.
- Configure your WordPress sites in
group_vars/<environment>/wordpress_sites.yml
and ingroup_vars/<environment>/vault.yml
(see the Vault docs for how to encrypt files containing passwords) - Add your server IP/hostnames to
hosts/<environment>
- Specify public SSH keys for
users
ingroup_vars/all/users.yml
(see the SSH Keys docs) - Run
ansible-playbook server.yml -e env=<environment>
to provision the server
Read the remote server docs for more information.
- Add the
repo
(Git URL) of your Bedrock WordPress project in the correspondinggroup_vars/<environment>/wordpress_sites.yml
file - Set the
branch
you want to deploy - Run
./deploy.sh <environment> <site name>
- To rollback a deploy, run
ansible-playbook rollback.yml -e "site=<site name> env=<environment>"
Read the deploys docs for more information.
Contributions are welcome from everyone. We have contributing guidelines to help you get started.
Keep track of development and community news.
- Participate on the Roots Discourse
- Follow @rootswp on Twitter
- Read and subscribe to the Roots Blog
- Subscribe to the Roots Newsletter
- Listen to the Roots Radio podcast