Skip to content

Trellis Docs

Installation

What is Trellis?

Trellis is a tool to create WordPress web servers and deploy WordPress sites.

Trellis lets you create and manage servers that are production ready, performance optimized and based on best practices that are continuously improved. Trellis is self-hosting done right since you benefit from the community and experience of Roots.

Why use Trellis?

You’ll get a complete WordPress server running all the software you need configured according to the best practices that are fully customizable.

Trellis features

Ansible

Trellis is powered by Ansible for configuration management. You don’t have to use brittle and confusing Bash scripts or worry about commands you found to copy and paste.

You get the benefit of Ansible documentation, its extensive library of modules and plugins, and the community ecosystem of Galaxy roles.

Local development

Trellis comes with Vagrant support for local development environments that run on isolated virtual machines. This means you don't have to worry about polluting your local OS with software that might break or conflict with other tools you use.

However, using Vagrant is optional and you're free to use other local dev tools as well, or even none at all.

Customizable

While Trellis gives you everything for a standard WordPress server out of the box, it's completely customizable as well. This is what makes Trellis different from managed hosting or even tools like SpinupWP that automatically setup WordPress servers.

Thanks to Ansible's YAML based configuration, Trellis is "infrastructure as code" so you can easily see exactly what Trellis installs on your server and customize if you want.

Portable without vendor-lock in

Trellis servers can be run on any hosting platform; traditional dedicated server hosting or cloud platforms. All Trellis needs is a server running a plain Ubuntu operating system.

This means you can easily migrate hosting providers making your infrastructure much more flexible and portable. You can even "disconnect" your server from Trellis if you want and just manage your server manually. Trellis isn't required to keep your server running (but we do recommend it!).

Cost effective

Managed WP hosting can make your life easier, but it can also be extremely expensive and is often overkill for simpler WordPress sites.

Trellis lets you run performant sites on extremely cheap servers ($5-10/month) and even supports running multiple sites on a single server for more efficiency.

Community backed

Since Trellis is open-source, we get the leverage of Roots and our community to continuously improve the defaults over time. We are constantly learning better settings and defaults for WordPress servers, and then we apply them to Trellis.

Development and production parity

Unlike many other solutions for WordPress server hosting, Trellis aims to have parity between your development and production environments. Trellis comes setup to run locally with Vagrant so you can test your WordPress sites with full confidence that they'll work once you deploy to production.

CLI

Trellis has its own CLI that makes managing your local and remote servers much easier. It also enables powerful CI/CD workflows like our setup-trellis-cli GitHub action for continuous deploys.

Zero-downtime deploys

Trellis has atomic, zero-downtime deploys built-in that are completely configurable with a powerful hook system. You can deploy and rollback releases with a single command thanks to trellis-cli too.

Software installed

Trellis provisions a base Ubuntu 20.04 server by installing and configuring the following software:

  • PHP 8.0+
  • Nginx (including HTTP2/ and optional FastCGI micro-caching)
  • MariaDB (a drop-in MySQL replacement)
  • SSL support (scores an A+ on the Qualys SSL Server Test)
  • Let's Encrypt for free SSL certificates
  • Composer
  • WP-CLI
  • sSMTP (mail delivery)
  • Memcached
  • Fail2ban and ferm

In addition to configuring common services like ntp, sshd, etc.

Requirements

Trellis relies on a few other software tools. Make sure all dependencies have been installed before moving on:

Local development requirements

If you want to use Trellis' built-in Vagrant integration, you'll need the following as well:

Note for Windows users

All commands must be run from WSL (Windows Subsystem for Linux).

Install trellis-cli

Install trellis-cli via Homebrew:

Create a project

To create a new project, first, pick a descriptive name (and use it in place of the default example.com). We recommend the domain of the site for convenience.

Or to explicitly set the site name and host, use the following:

After you've created a project, the folder structure for a Trellis project will look like this:

Assuming you used the CLI, you'll also have your first WordPress site automatically configured based on the project folder (or name and host provided).

Check out the following files to see the basic site configuration:

  • trellis/group_vars/development/wordpress_sites.yml
  • trellis/group_vars/production/wordpress_sites.yml

What's next?

Now that you have a project created and the basics configured, you can explore the following steps:

Contributors

Last updated

Support Roots

Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.

Sponsor Roots on GitHub

Getting Started