-
-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trellis and Apple Silicon #1253
Comments
I haven't looked into this enough yet, but my interpretation of the current state of things is:
I think the key point is that Trellis is coupled to x86 more so than VirtualBox itself. Trellis already supports other Vagrant providers which some people use. There's two biggest questions:
I personally don't really know the implications of running difference architectures in dev/prod yet. So even if Trellis found a way to migrate to Docker... there's still a lot of potential problems and big open questions. My stance for now is nothing will change for a while. Anyone running M1 chips is unfortunately out of luck running for Trellis for at least the short-term and almost certainly for the medium-term too. |
1 sounds a bit farther away, but 2 looks like a necessity already for anyone with ARM macs. @swalkinshaw Scott, as for short-term, do you have weeks or rather months in mind? |
If you want to run ARM in development now then I'd try and find another Vagrant provider that supports it. VirtualBox isn't the only choice so Trellis doesn't really need to do anything to support that (as far as I know). |
A bit over my head, but I would like to try it. Would you suggest replacing virtualbox with docker? I remember seeing a couple of years ago a docker feed on discourse, but not sure if it gave any solid fruits in the end. |
From what I can see, there is no working provider at the moment. Docker is on standby waiting for upstream updates from Go and others with no ETA, Parallels is still in development with no ETA either, VMware is committed as well, but completely silent about roadmap. So there is no possibility to try out the 2nd option for the time being. But it would be wise to at least leave a note for any silicon users stating that the Trellis framework is not compatible with Apple M1 laptops until at least some of the Vagrant providers start rolling out arm tailored versions. |
Ah, yeah sorry I wasn't sure what the status of Parallels and VMware was yet. I had just read they had betas or were working on it. But yes we definitely need to document this limitation somewhere. |
Seems like great progress is being made! https://www.xda-developers.com/apple-silicon-mac-boot-windows-10-and-linux-virtualization/ |
So developers who bought new Macbook Pro with M1 are currently not supported by Trellis? Docker seems to be working on M1, but Trellis is not compatible with Docker. Maby Trellis should really consider Docker as other provider than VirtualBox? |
@Pls I think Docker is a bit different solution to the question as it basically replaces trellis instead of just creating a vm. But you can try out docker approach. You can find more information here: https://roots.io/docs/bedrock/master/local-development/#additional-resources. |
I thought about Rosetta 2 since it allows some apps not made for the M1 chip to actually run, but unfortunately they don't support virtual machines.
Leaving it as a reference for anyone stumbling here. |
Just got a new iMac with the M1 chip, would love to know what the gameplan is for making it compatible with the Roots suite. Is it just a waiting game at this point? |
Has anyone attempted Trellis on ARM in development on the M1? Parallels should support that. https://www.parallels.com/blogs/parallels-desktop-m1/ |
|
I've been looking into this a bit more lately, and here's what I've found. New M1 chipsThe new M1 Pro and M1 Max CPUs don't change anything virtualization wise unfortunately. They are the same as the original M1 in that regard. VirtualboxThere has been absolutely no movement on Virtualbox offering ARM support and I highly doubt there ever will be. It defeats the purpose of VirtualBox which is very tied, by design, to x86. Other virtualization solutionsWhile Trellis defaults to VirtualBox (since it's open source and free), it's always supported other providers like VMWare and Parallels. ParallelsAs mentioned above, Parallels does have support for M1 macs but only for ARM based operating systems. VMwareLikewise, VMware Fusion now supports ARM-based Linux distributions just like Parallels. Others
One issue with all of these is integrating them with Vagrant. docker has by far the most mature Vagrant integration with a 1st-party provider. Lima and UTM have none so far. Parity between Intel & ARMThe best bet at this point is running Virtualbox on Intel Macs and some other ARM-based virtualization solution on M1 chips. This isn't 100% ideal since it's likely your production server will be running x86 for the foreseeable future; however, I'm not sure it matters in reality. While there are difference between x86 and ARM, it likely does not matter for the purposes of running a web server with WordPress. PHP should be PHP; Nginx should be Nginx, etc. It's a small trade-off we'll have to make and be okay with in the end. ConclusionThis space is changing every day and it's hard to keep track. There's a lot of solutions which are like 50-80% of the way there, but not 100% unfortunately. Right now the most promising solution is:
Of course Docker's default design is not compatible with Trellis because docker images/containers don't like to run multiple services and lack an initd system. This has previously been discussed, but I did find a useful base docker image which solves most of these problems: https://medium.com/nerd-for-tech/developing-on-apple-m1-silicon-with-virtual-environments-4f5f0765fd2f I've been testing this out on an x86 Mac, and I've run into a few problems (NFS and networking related), but are hopefully solvable. If anyone wants to help test out any of the other Vagrant providers or VM solutions, please let me know or post your results. It's also helpful for people to post updates about these various projects if they come across them. Further reading: |
Help wantedIf you have an M1 Mac and have Parallels or VMware, you can help by trying out an ARM based Ubuntu box. Since Trellis already supports Parallels and VMware fusion, it's possible to try using an ARM-based Ubuntu vagrant image and get Trellis working "as is". The main Ubuntu vagrant box we use is |
Ok! I got this to work with parallels on an M1 Pro macbook pro. I'm not the smartest person here so I'm going to lay out some steps in hopes of helping others like me. The machine provisions without errors, but I have not extensively tested beyond this. **note I believe parallels pro is needed which is what my trial is for this test. The basic version does not provide the cli tools. https://www.parallels.com/products/desktop/pro/#compare Following swalkinshaw's extensive legwork, using the chef/bento vagrant box on parallels is the only one I could get working. I tried using VMware fusion but I think more work needs to be done to get that working. Jeffnoxon already has a vagrant box compatible with parallels up on the vagrant cloud (https://app.vagrantup.com/jeffnoxon/boxes/ubuntu-20.04-arm64). I'm not sure if it's safe to just reference this box or if something more formal needs to be done. I added that box to the vagrant.default.yml
I also needed to make a slight change in the maria-db role. roles > mariadb > defaults > main.yml -- change the arch from amd64 to arm64
after that, vagrant up using the parallels provider (make sure you install the parallels vagrant provider plugin (https://parallels.github.io/vagrant-parallels/docs/installation/)
And success! https://prnt.sc/1xujta1. Loading the site at example.test works and everything appears good. Obviously this will only work for a development environment. I have not tested provisioning a staging / production server on arm64... one step at a time. I can now at least continue developing in glorious real all day battery land and I'll just copy the files to an x86 based machine for the rest of the workflow until I can get more experience with the rest of it. I'll follow up here with any issues as I find them. |
@jgarib awesome, thank you so much! I'm not that surprised that this "just" worked. Ubuntu should be Ubuntu, so it makes sense it worked once you got that up and running. re the I'll grep the source again, but assuming MariaDB is the only place with a hardcoded architecture, we can use Ansible's @jgarib did Nginx not fail with the same issue? It has |
No issue with nginx, though you're right.. you'd think it would fail the same as mariadb. Here is the output of the nginx section of the provisioning with arch=amd64 still set. I can run a quick test with the same change to verify it still works if you'd like? |
I'm pretty sure we can just remove the deb arch options entirely. It defaults to the arch that |
Sorry this is all on the virtual machine side (in Ubuntu) |
This is working on the x86 side for me and I'm assuming it will work for M1s. #1318 |
Confirmed working on ARM side. So once that is merged the only change needed to use trellis in a development environment on an M1 mac is:
Thanks much Scott! |
🎉 yep, but I can probably update the |
Just chiming in to say that I've got Trellis working on an M1 Mac Mini by following these instructions with Parallels Pro. |
Is it possible to set a default provider in the vagrant.default.yml file or anywhere else? It's not ideal to have to type the provider flag every time I provision a machine, though not the end of the world. |
Trellis’s Vagrantfile tries to auto select a provider in this order:
if multiple providers are installed, first one will be used. Alternatively, you can overrides it via the See: https://www.vagrantup.com/docs/providers/basic_usage#default-provider |
Yeah if you only have Parallels installed it should be the default? Is that not what's happening? If you have an M1 mac then you definitely shouldn't have VirtualBox installed since it won't work anyway. |
Out of curiosity, what did you encounter? |
I actually abandoned it after that last issue and got Parallels working fine 🤷♂️ |
After trying both, I ended up shelling out for Parallels for a year. There were too many issues with VMWare, namely:
|
Should have published this sooner, but Roots joined the Parallels affiliate program. So if people do have to purchase Parallels, you can support us by doing it through this link: https://prf.hn/l/KzkNLZB Note: just make sure to select your proper country/currency. |
I've finally published some docs on the Apple Silicon situation and Parallels: https://docs.roots.io/trellis/master/vagrant/ I'll keep this issue open for discussion and any updates. |
Following the docs for Parallels with an M1, I get this error:
I've installed the vagrant-parallels plugin and made the changes to the vagrant.default.yml file:
The only thing I really deviated from was the Vagrant version because I have 2.2.19 installed on my Mac. Has anyone else encountered this? I have Parallels trial version running. |
Sorry, y'all! I had to delete the .vagrant folder and try again. Going to backdate Vagrant now... |
@mmoga-uf how are you backdating Vagrant? I've been attempting with Brew, but haven't had any luck. |
I may have been missing some important point, but I actually kept Vagrant 2.2.19 and then made this change hashicorp/vagrant#12583 (comment). I got Trellis/Bedrock/Sage all working locally, but then had to bail before doing anything remotely because I work at a RHEL LAMP institution. 😥 |
This may be a bit far afield but… I wonder if the virtualization changes announced at WWDC 2022 will pave the way for some new alternatives. Here's an Apple demo video showing how some Swift code can be used to set up a Linux VM (jump to 15:13 to see the setup of Linux on Mac). Here's something similar but in writing. From this blog post:
(I'm also interested in the open source options… @mikaelwedemeyer I wonder if you had any luck with |
I briefly read about those macOS Ventura changes too but honestly was a bit confused. So it might improve compatibility for these cases, but performance would still suffer since it's under emulation (unless I'm mistaken). So ultimately still running ARM-based OS's would give the best performance. |
@swalkinshaw it sounds like the performance impact might not be so bad… I'm only just reading up on it now but it seems like to some extent they're able translate the machine instructions and store the translation, so the second run is faster. Also my understanding is they're offloading some or all of that to the GPU.
But yeah I haven't seen much of a technical analysis for Ventura so … I suppose safest bet for now is to use ARM-based OS like you say. BTW I have mad some progress with the Trellis + Vagrant + Docker setup using the tips above (which uses ARM-based Linux) - #1253 (comment) |
Today, while spinning up a new project I had to change the vagrant default to: vagrant_box: 'jeffnoxon/ubuntu-20.04-arm64' The 1.0.1 release of the arm box wasn't booting so removing the >= from the version definition got me going. I'll look into it more later, unless anyone here has already run into similar issue and wants to chime in. |
Yeah there's an issue with the new vagrant box version, and only version 1.0.0 works without issue It seems to be network related, and I assume it's either due to the creator exporting the VM without configuring a new MAC address for virtual network cards or related to some of the other changes with parallel tools which are included in v1.0.1 I think this only becomes problematic when you have multiple boxes, due to the mac addresses of the boxes being the same this seems to break parallels due to the same DHCP address being assigned on the required parallels shared network. Once you hit this issue you have to destroy all your machines, do a hard system restart and rebuild - so it's a bit of a pain Will see if I can raise with the creator |
Good info. Thanks! Thankfully all my previous boxes (at least the three I've run since) are OK and avoided any collateral damage... at least so far. |
@j-funk you noted the networking issue with Docker - #1253 (comment) After hitting that myself and digging in a bit, it seems like it might be due to the firewall settings Trellis includes (via |
I'm glad I wasn't going crazy. I noticed this happening and it is huge pain for me. I have multiple boxes running for multiple sites and this has been giving me nightmares. Hopefully it gets fixed. |
While Trellis has supported Apple Silicon for a while now, it still required two manual changes (Vagrant box + MailHog). Thanks for everyone's feedback and help 🚀 |
@swalkinshaw it seems As |
Ah, yeah apologies @jkananen I need to do a new Trellis release which I'll do when I'm back from vacation. In the meantime you can always use |
Anyone had a chance to try Virtualbox ARM version yet? -> https://download.virtualbox.org/virtualbox/7.0.4/VirtualBox-7.0.4_BETA4-154605-macOSArm64.dmg |
Doesn't work yet.
|
We just released VM integration into trellis-cli powered by Lima 🎉 See https://roots.io/introducing-lima-to-trellis-for-faster-local-development/ for more details and roots/trellis-cli#346 for some documentation. This has many benefits over Vagrant + VirtualBox/Parallels:
|
This is awesome. Thanks for sharing. I'll start testing this in the next couple of weeks. |
I am trying to follow along here and get some projects booted up on my new m2 macbook but run into this error which is not very detailed and I've hit a wall. Any ideas how to get passed this? ==> default: Booting VM...
I've updated my vagrantfile as suggested and have destroyed and attempted to launch over and over with no success.
|
Summary
Apple Silicon is here, VirtualBox support is far away (if ever) – what is the road going forward?
Motivation
Apple have started to ship their first arm based macs to customers and as many of us developers are sitting on macOS systems I'm curious if you've considered how the road forward will look? As I understand VirtualBox support seem far away, Docker is more probable. I love working with the Roots stack when doing WP work, would be nice to be able to do so in the future.
Some links with discussion around M1 based macs.
https://forums.virtualbox.org/viewtopic.php?f=8&t=98742
https://www.docker.com/blog/apple-silicon-m1-chips-and-docker/
https://localwp.com/community/t/local-on-apple-silicon-macs/22834/14
The text was updated successfully, but these errors were encountered: