Installing Plugins with Trellis and Bedrock

In the past, I was using just bedrock and I know that I’d goto the directory and run a ‘composer install’ after updating the composer.json file with the packagist link.

Using trellis, what would be the workflow?
I figured it was in a script within Trellis to run ‘composer install’

I tried a ‘vagrant up’ and ‘vagrant provision’ on a previous virtualbox instance assuming it would be part of the provision scripting but the plugin hasn’t installed and the composer.lock file looks the same. Do I need to ‘composer install’ locally to install the plugin? I must be missing something…

I would just run composer install in the Bedrock folder. Composer should be run on a vagrant provision:, but it would obviously be faster if you just run Composer directly.

Worked - thank you :slight_smile:

To recap…

Installing Plugins via Trellis would look like:

  1. vagrant ssh into the dev box
  2. Browse to the composer.json location
  3. Run composer install

I also tried running ./ development - However, this would not allow a deploy to the development environment. Do the staging/production deploy scripts run a composer install?

If so, would it make sense to build out the deploy ability for development environment in Trellis to mirror the same processes for users (so the deploy process is the same across environments?) I realize it isn’t technically a ‘deploy,’ but maybe the development deploy just runs the composer part of the deploy process?

You can run composer outside of the VM. Just run it in your project folder. Since this folder is synced inside the VM automatically, plugins will be installed there too.

1 Like

Yep it does! You shouldn’t have to ssh into remote servers at all.

If you want to use WP-CLI, say to activate the plugins once you’ve added them via composer, then you will need to ssh into the VM. Otherwise, just run your composer commands as usual in the site folder.