Local Development Setup

Development is handled by Vagrant in Trellis. Our Vagrantfile automatically uses the Ansible provisioner to run the dev.yml playbook and you'll get a virtual machine running your WordPress site.

  1. Configure your site(s) based on the WordPress Sites docs and read the development specific ones.
  2. Make sure you've edited both group_vars/development/wordpress_sites.yml and group_vars/development/vault.yml.
  3. Optionally configure the IP address at the top of the vagrant.default.yml to allow for multiple boxes to be run concurrently (default is 192.168.50.5).
  4. Run vagrant up (from your trellis directory, usually the trellis/ subdirectory of your project).

Then let Vagrant and Ansible do their thing. After roughly 5-10 minutes you'll have a server running and a WordPress site automatically installed and configured.

To access the VM, run vagrant ssh. Sites can be found at /srv/www/<site name>. See the Vagrant docs for more commands.

Note that each WP site you configured is synced between your local machine (the host) and the Vagrant VM. Any changes made on your host will be synced to the VM.

Mounting an encrypted folder is not possible with Trellis due to an issue with NFS.

Windows users have a slightly different workflow. See the Windows docs.

WordPress installation

Trellis installs WordPress on your first vagrant up with admin as the default user. You can override this by defining admin_user, as noted in the WordPress sites options.

Re-provisioning

Re-provisioning is always assumed to be a safe operation. When you make changes to your Trellis configuration, you should provision the VM again to apply the changes:

vagrant reload --provision

You can also provision with specific tags to only run the relevant roles:

SKIP_GALAXY=true ANSIBLE_TAGS=wordpress vagrant reload --provision

Notes on the commands:

  • SKIP_GALAXY saves some time because you already have those roles installed
  • ANSIBLE_TAGS runs only the relevant roles
  • reload is to ensure that vagrant has synced up the two bedrock site directories
  • --provision is so that it runs the dev.yml playbook and its roles tagged wordpress

We’re available for hire!

Get started

Ready to checkout?