/crellis

Ansible playbooks for a Craft CMS LEMP stack (roots/trellis port)

Primary LanguageJinjaMIT LicenseMIT

Crellis

Build Status Follow Roots

Ansible-powered LEMP stack for Craft 3.
Fork of Trellis, an Ansible-powered LEMP stack for WordPress

Website    Documentation    Releases    Community

Sponsors

Trellis (Crellis' upstream) is an open source project and completely free to use. If you've benefited from our projects and would like to support our future endeavors, please consider sponsoring Roots.

KM Digital Carrot WordPress.com Worksite Safety Copia Digital Freave

Overview

Crellis is a collection of Ansible playbooks for setting up a LEMP stack for Craft 3.

  • Local development environment with Vagrant
  • High-performance production servers
  • Zero-downtime deploys for your Craft sites

Getting Started

Crellis will configure a server with the following and more:

  • Ubuntu 22.04 Jammy 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
  • sSMTP (mail delivery)
  • MailHog
  • Memcached
  • Fail2ban and ferm

Documentation

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

Requirements

Make sure all dependencies have been installed before moving on:

Windows user? Read the Windows getting started docs for slightly different installation instructions.

Installation

The recommended directory structure for a Crellis project looks like:

example.com/      # → Root folder for the project
├── crellis/      # → Your clone of this repository
└── site/         # → A Craft site ([Craft's directory structure](https://docs.craftcms.com/v3/directory-structure.html))
  1. Create a new project directory:
$ mkdir example.com && cd example.com
  1. Install Crellis:
$ git clone --depth=1 git@github.com:newtonne/crellis.git && rm -rf crellis/.git
  1. Install Craft into the site directory:
$ composer create-project craftcms/craft site

Local development setup

  1. Configure your Craft sites in group_vars/development/craft_sites.yml and in group_vars/development/vault.yml
  2. Ensure you're in the crellis directory: cd crellis
  3. Run vagrant up

Read the local development docs for more information.

Remote server setup (staging/production)

A base Ubuntu 22.04 server (18.04 and 20.04 also supported) is required for setting up remote servers.

  1. Configure your Craft sites in group_vars/<environment>/craft_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)

For remote servers, installing Ansible locally is an additional requirement. See the docs for more information.

Provision the server:

$ ansible-playbook server.yml -e env=<environment>

Read the remote server docs for more information.

Deploying to remote servers

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

Deploy a site:

$ ./bin/deploy.sh <environment> <site>

Rollback a deploy:

$ ansible-playbook rollback.yml -e "site=<site> env=<environment>"

Read the deploys docs for more information.

Also, see the Trellis installation documentation.

Stay Connected