Introducing Lima to Trellis for Faster Local Development

Are you referring to Sage/Bud’s dev server and hot reloading? Are you manually refreshing after 3-4 seconds or are you saying that’s how long it takes for the injection to complete after a build is triggered by saving a file?

For me personally, theme builds happen instantly and no longer give me any kind of trouble with delays since there isn’t NFS file syncing issues like with Vagrant.

It would be helpful to make a new topic with more details to troubleshoot that specifically so that this topic can stay more relevant to any Trellis specific issues.

1 Like

While starting Lima: trellis vm start on existing environment, you could get:

WARNING: This project has not been initialized with trellis-cli and may not work as expected.

You may see this warning if you are using trellis-cli on an existing project (previously created without the CLI).
To ensure you have the required dependencies, initialize the project with the following command:

  $ trellis init

If you want to manage dependencies yourself manually, you can ignore this warning.
To disable this automated check, set the 'virtualenv_integration' configuration setting to 'false'.

Ok, I went through the docs: Trellis CLI | Trellis Docs | Roots and created a cli.yml:

# trellis/.trellis/cli.yml

check_for_updates: true
load_plugins: true
open:
  site: "http://exanple.test"
  admin: "http://exanple.test/wp/wp-admin"
virtualenv_integration: false

As well, tried setting ENV variable:
But with no luck, and I continue receiving a Warning message.
All other Trellis CLI commands (outside trellis vm) are working fine without a Warning.

Any ideas about what might be wrong there?

I can reproduce that bug on any command, so I don’t think it’s limited to vm start? I’ll fix it though, thanks for reporting here. This is probably better suited for a GitHub issue though for bugs like this in the future.

Oh, I actually could get the same Warnings while working with vault commands in CLI.
Yep, it’s not limited to vm.
Thanks for confirming!

I could create a GitHub issue for that. But I’m not sure which repo is better for this: trellis or trellis-cli?

I’ve already fixed it Fix virtualenv_integration config setting by swalkinshaw · Pull Request #384 · roots/trellis-cli · GitHub :smile:

It will be in the next release soon

v1.11.0 is out and it contains a lot of improvements and bug fixes related to Lima. Thanks for the feedback everyone.

2 Likes

I’m having trouble accessing logs due to Vagrant being set as user. What do I have to change to get the correct user?

trellis logs --goaccess development
Running command => ssh vagrant@mindstomedia.test tail -f /srv/www/mindstomedia.ca/logs/*[^gz]?
vagrant@mindstomedia.test: Permission denied (publickey)

I don’t seem to be able to find a clear answer on Lima docs or anywhere else, what is the minimum required OS for Lima?

I am due for a new Macbook next week, but just for a chance to play with Lima in the meantime, I am on OS Catalina still, any idea if it works fine on this version?

Scott points out here that the MacOS virtualization framework is only in MacOS Ventura and later.

Thanks! I’ll wait until I have the new Macbook and try then.

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…