roots / trellis-cli

A CLI to manage Trellis projects
https://roots.io/trellis/
MIT License
167 stars 25 forks source link

Refactor Lima config management #449

Closed swalkinshaw closed 3 months ago

swalkinshaw commented 3 months ago

Fixes #421

Changes how the CLI generates and manages Lima VM configs to make changes like mounted directories be accurately reflected in Lima.

trellis-cli used to generate a config for Lima in .trellis/lima/{name}.yml which was used for the initial creation of the VM. However, even when providing a config to limactl create, Lima creates a separate config in its managed directory ($HOME/.lima/{name}/lima.yaml).

This meant that any subsequent config changes in Trellis might only be persisted to the CLI's managed config (in .trellis), which would do nothing, instead of Lima's config.

For example, if you added a new site to Trellis (or changed the path to an existing one), you'd either have to delete the VM entirely and start over, or manually make the changes to Lima's config.

This PR removes the old CLI managed config entirely and instead updates Lima's config directly (the one in $HOME/.lima). This means one less file to manage and a single source of truth which will allow proper VM udpates.

Now if you change any wordpress sites in development, stopping and restarting the VM will apply the new config changes.