Developing plugin locally

@yaaax

The Vagrant docs on synced folders is the most fundamental resource.

When I wrote the quoted post a couple year ago, I linked the model snippet people could use in customizing their Vagrantfile to add an extra sync folder. However, as of roots/trellis#828, Trellis enables you to set up additional vagrant_synced_folders more conveniently.

You could override the empty list of vagrant_synced_folders in the Trellis core file vagrant.default.yml by creating the following vagrant.local.yml in your trellis directory:

# vagrant.local.yml

vagrant_synced_folders:
- local_path: /Users/philip/myplugin
  destination: /srv/www/example.com/current/web/app/plugins/myplugin
  create: false
  type: nfs
  bindfs: true
  mount_options: []
  bindfs_options:
    u: 'vagrant'
    g: 'www-data'
    o: 'nonempty'

The Vagrantfile would load that config info here and create the corresponding vagrant_synced_folders here. You’ll have to look at this code and the sync options details to decide your sync config. If you are using macOS High Sierra, perhaps you’ll need these extra mount_options.

Edit. You probably wouldn’t have the plugin already in the bedrock directory, and if you did, it would already be synced. To make the example more realistic, I edited the plugin’s local_path to be outside the bedrock directory.

  vagrant_synced_folders:
- - local_path: ../site/web/app/plugins/myplugin
+ - local_path: /Users/philip/myplugin
    destination: /srv/www/example.com/current/web/app/plugins/myplugin
2 Likes