Roots Discourse

Use Trellis only for remote server handling and an alternative for local development

Hello everyone,

this year will mark our sixth year using Trellis and it literally changed our lives (and agency) and helped us improve our customer retention so that at the moment I have 18 VMs (one of them holding 16 sites).

As you can imagine (and other users actually pointed out) they take a lot of space on my MacBook.

Sadly destroying and rebuilding VMs on demand is not feasible, I was on the Docker lookout but when it comes to provision and configure remote servers Trellis still takes the cake.

I get and understand that Dev/Prod Parity is a must have but is it so much of a bad idea to:

  • Start the project as a “normal” Trellis/Bedrock/Sage enviroment to test everything up
  • After an initial setup and testing of Trellis-managed features (such as hooks and Nginx redirects) destroy the VM
  • Switch to a Local Development alternative such as Valet / Lando / Local finding a way to route them to the site folder in the Trellis project and manage database and uploads synchronization – this way I could keep working on the Bedrock / Sage folders using Trellis for deployment while having another platform to develop locally.
  • In case of additional changes to the Trellis-managed features move everything over to the VM, test everything and deploy + provision the remote servers

I’m looking to try this out on a smaller project we’re about to start: the cons I’m encountering in this is the missing dev/prod parity and the overall complexity of setting up custom routings / switching over the data but managing the VMs toll on my hard drive has become almost a weekly issue.

Thank you!

1 Like

Why? If you have scripts to dump your DB and import that dump when building an image, what makes this not feasible?

:+1: Lots of folks on here that are using Trellis but not using it for local development, or at least not 100% of the time

You mentioned Valet, and I just wanted to share that there’s an existing driver setup by @danielroe that would support the recommended Trellis structure: GitHub - danielroe/trellis-valet-driver: A driver for Laravel Valet that supports the default Trellis install.

Years ago I setup things this way at an agency with lots of clients where devs were struggling with all the different VM’s and the time for local provisioning. The differences in dev/prod parity can bite you in the ass, but for most sites in an agency environment it’s probably fine.

2 Likes

Although moving DB dumps around may be a bit time consuming that could be solved through some automation rebuilding the VMs would longer times and if that happens too often it’s an issue.

Thank you @benword . That driver setup looks really interesting, I’ll test it right away this evening.

By the way since we have some clients that require almost a day-by-day care / development I could keep those on their VMs and switch the smaller / less recurrent ones on a Valet setting.

An alternative was to move all them to a single VM but I’m not too fond of that either.

I’ll let everyone know as soon as I test that.

Thank you!