Those "Composer and WP-CLI commands"

After finally running “trellis up” for the first time there’s a reference on the screen and in the docs:

From the terminal:

Composer and WP-CLI commands need to be run on the virtual machine
for any post-provision modifications.

From the docs:

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.

It is unclear what these commands are, if they are only if you make modifications (to what?) or if it is just a “hey don’t forget to run anything you might possibly have done in your yaml that needs to be run now!” message.

If I made no non-simple and documented changes, do I need to run something? Or not?

1 Like

It’s telling you that if you need to run any Composer or WP-CLI commands as part of your development process you should run them from inside your virtual machine because the virtual machine is the environment in which those commands have their correct context.

Composer is installing and managing PHP packages that will need to run in your development, staging, and production environments, and when it runs it gathers information from the environment about how it should run, how and where packages go, etc. If you run it on your host, instead of inside your VM, it might get the wrong information about those things and make “bad” decisions.

WP-CLI needs access to your WordPress installation and database in order to do 90% of the interesting things that it does, and it will have a difficult time accessing those things from your host. (You can actually do it, using aliases, but IMO it’s often easier to just run it inside the VM.)

The “modifications” it’s referring to are just anything those tools might do. For instance if you wanted to install a package (Composer) or scaffold a plugin (WP-CLI).

1 Like

Thank you! Makes perfect sense now that you say it. I was confused likely because I’m absolutely clear about the fact that it’s a shared file system and separate runtime. The last sentence in the docs should have been my hint as to the previous context.

This topic was automatically closed after 42 days. New replies are no longer allowed.