/trellis

WordPress LEMP stack with PHP 8.0, Composer, WP-CLI and more

Primary LanguageJinjaMIT LicenseMIT

Trellis

MIT License Release Build Status Follow Roots

Ansible-powered LEMP stack for WordPress
Built with ❤️

Official Website | Documentation | Change Log

Supporting

Trellis is an open source project and completely free to use.

However, the amount of effort needed to maintain and develop new features and products within the Roots ecosystem is not sustainable without proper financial backing. If you have the capability, please consider donating using the links below:

Sponsor on GitHub Sponsor on Patreon Donate via PayPal

Overview

Ansible playbooks for setting up a LEMP stack for WordPress.

  • Local development environment with Vagrant
  • High-performance production servers
  • Zero-downtime deploys for your Bedrock-based WordPress sites
  • trellis-cli for easier management

What's included

Trellis will configure a server with the following and more:

  • Ubuntu 20.04 Focal LTS
  • Nginx (with optional FastCGI micro-caching)
  • PHP 8.0
  • MariaDB (a drop-in MySQL replacement)
  • SSL support (scores an A+ on the Qualys SSL Labs Test)
  • Let's Encrypt for free SSL certificates
  • HTTP/2 support (requires SSL)
  • Composer
  • WP-CLI
  • sSMTP (mail delivery)
  • MailHog
  • Memcached
  • Fail2ban and ferm

Documentation

Full documentation is available at https://docs.roots.io/trellis/master/installation/.

Requirements

See the full installation docs for requirements and our getting started pages for more OS specific instructions.

Installation

Create a new project:

$ trellis new example.com

Local development setup

  1. Review the automatically created site in group_vars/development/wordpress_sites.yml
  2. Customize settings if necessary

Start the Vagrant virtual machine:

$ trellis up

Read the local development docs for more information.

Remote server setup (staging/production)

A base Ubuntu 18.04 (Bionic) or Ubuntu 20.04 (Focal LTS) server is required for setting up remote servers.

  1. Configure your WordPress sites in group_vars/<environment>/wordpress_sites.yml and in group_vars/<environment>/vault.yml (see the Vault docs for how to encrypt files containing passwords)
  2. Add your server IP/hostnames to hosts/<environment>
  3. Specify public SSH keys for users in group_vars/all/users.yml (see the SSH Keys docs)

Provision the server:

$ trellis provision production

Or take advantage of its Digital Ocean support to create a Droplet and provision it in a single command:

$ trellis droplet create production

Read the remote server docs for more information.

Deploying to remote servers

  1. Add the repo (Git URL) of your Bedrock WordPress project in the corresponding group_vars/<environment>/wordpress_sites.yml file
  2. Set the branch you want to deploy (defaults to master)

Deploy a site:

$ trellis deploy <environment> <site>

Rollback a deploy:

$ trellis rollback <environment> <site>

Read the deploys docs for more information.

Migrating existing projects to trellis-cli:

Assuming you're using the standard project structure, you just need to make the project trellis-cli compatible by initializing it:

$ trellis init

Contributing

Contributions are welcome from everyone. We have contributing guidelines to help you get started.

Trellis sponsors

Help support our open-source development efforts by becoming a patron.

Kinsta KM Digital Carrot C21 Redwood Realty WordPress.com Pantheon

Community

Keep track of development and community news.