Introducing Lima to Trellis for Faster Local Development

With Lima, is there a way to use synced folders, like vagrant_synced_folders in vagrant.default.yml?

I assume you mean additional folders other than the site dir? Lima offers it, but the trellis-cli config doesn’t give a way to customize them yet.

Thanks Scott. Correct, I do mean additional folders. I was expecting this to be complex, but after taking another look, manually adding an additional sync folder is simply:

  • limactl edit <instance> will open vi editor for the actual config file (I got mixed up editing the auto generated config file in .trellis/lima/yoursite.yml which has no effect).
  • add a shared folder under mounts and save.

Worked like a charm for me.

1 Like

Awesome! I do want to support more features eventually. But regardless, we should document editing the Lima config (and clear up the dual config confusion that you ran into).

What is your use case for extra synced folders?

My additional synced folder is just a really big folder full of .PDFs that I’m continually adding to and updating. And then I manually push these files to the web server via FTP. My Wordpress site then links to the .PDFs, and has some PHP functionality that depends on this folder. That’s the short answer. In my case, it wouldn’t be feasible to store and manage these .PDFs in the WP media library.

I have another situation (project is still on vagrant, but still applies) where the synced folder is a collection of ancient HTML web pages from the early 2000’s, and it’s nice to keep that separate from the Wordpress ecosystem and just link to it.

Then in both cases, I use the Trellis nginx includes to make these additional folders accessible via HTTP.

1 Like

That’s a very specific use case :sweat_smile: I was wondering if there was a common example I hadn’t thought of but I still do want to make customizing easier.

Instead of having to add these Lima config features separately, I might just add a field like lima_config which will pass through anything directly.

Howdy.
I have a new MacBook M2 chip based machine and working on getting Lima setup on an existing project.

Running trellis vm up appears to work properly with this message:
“Your Trellis VM is ready to use!”

I am able to run trellis vm shell and gain access.

Next I run yarn bud dev and I am provided with my proxy and server urls.

The proxy url takes me to a “Site can’t be reached” page and the server url takes me a page with this message:
“Error occurred while trying to proxy: localhost:3000/”

I have your same processor and your same problems, were you able to find a fix?

Not really. It works 100% of the time after a restart now, but it never works without the restart. I’m pretty much resigned to waiting a while to adopt Trellis on the silicone machines. Still works great on my intel machine though!

Sorry I couldn’t be more helpful.

Thanks for the reply.

At the moment I always have “exit with error” in one of these steps:
TASK [common : Update apt packages]
TASK [common : Checking essentials]

I’ll try after a restart of the Mac…

FWIW, Parallels and Vagrant with Trellis works pretty well for me — there’s the occasional issue usually caused by something upstream that has to be fixed, like a buggy Vagrant version

I too run into issues fairly frequently with Lima and sometimes a reboot works

1 Like

Thanks for the heads up! Unfortunately regarding the silicon machines I’m looking for a solution for an agency, and Parallels would cost like $800 a year for the number of seats needed. Technically feasible but I’d rather not pitch that when our current system is totally open source. I’m sure it’ll get figured out at some point though!

Same situation here, Parallels has a cost that I would like my agency to avoid, I hope the Lima solution becomes stable soon.

1 Like

Can you share how you configured Lima with the sync script? I’m dealing with that currently.

I’m a bit late to the party but… please don’t mind me asking, haven’t you considered Lando?

It’s super simple (and relatively well working) solution based on Docker containers, literally 3-5 min setup that has been working perfectly for all my latest projects - regardless the complexity, even Laravel based API-s communicating with WP sites locally, node applications, etc - everything based on Lando.

Only thing… I haven’t tried it on Windows, where it relies on WSL that I haven’t had the best experience with, then again, I don’t consider Windows as good OS for web development… unless one is programming in C(stuff) or .NET - neither of witch are really related to Roots stack anyway.

Lando works gr8! But… :slight_smile: you cant provision lando with trellis as far i know.
What Lima provides is a way to get the “exact” same server you would on staging and production.

Sidenote:
Maybe you can add a provision command to landos build step or do it via trellis but im not sure.
But then going pure docker and docker-compose or even podman would be a better alternative.

1 Like

with this said roots new radicle adds Lando as an alternative for local development.

1 Like

Not sure if it helps in any way, but I discovered that the reason that I needed to restart before starting a new Lima server on silicon machines is that the process only works when no other Lima servers are running. So now in order to get it to work I can do so by just stopping all of the other servers instead of restarting the whole machine. Still not ideal but a little faster I guess.

1 Like

Yes I had the same issue but seems. Issue seems to be when the host machine goes to sleep port forwarding stops working. I was able to solve this buy doing a factory reset on the lima instance so that lima updates the network configs. So far I haven’t had an issue since.

1 Like

Did you figure this out? I had the same question.