# Local Development
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.
- Configure your site(s) based on the WordPress Sites docs and read the development specific ones.
- Make sure you've edited both
- Optionally configure the IP address at the top of the
vagrant.default.ymlto allow for multiple boxes to be run concurrently (default is
vagrant up(from your trellis directory, usually the
trellis/subdirectory of your project).
vagrant up will fail if you are using encrypted folders/hard drives
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 to your host will be synced to the VM.
Composer and WP-CLI commands need to be run on the virtual machine for any post-provision modifications. Front-end build tools should be run from your host machine and not the Vagrant 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 getting started 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 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 provision
You can also provision with specific tags to only run the relevant roles:
$ SKIP_GALAXY=true ANSIBLE_TAGS=wordpress vagrant provision
Notes on the commands:
SKIP_GALAXYsaves some time because you already have those roles installed
ANSIBLE_TAGSruns only the relevant roles
--provisionis so that it runs the
dev.ymlplaybook and its roles tagged
If you added a new WordPress site (or manually added new synced directories to Vagrant), you'll need to reload the VM as well:
$ vagrant reload --provision