geodesic icon indicating copy to clipboard operation
geodesic copied to clipboard

Apple M1 (arm64) Support

Open dudymas opened this issue 3 years ago β€’ 3 comments

See https://github.com/cloudposse/geodesic/issues/719#issuecomment-1005836850

per https://www.docker.com/blog/multi-platform-docker-builds/ , let's get geodesic on arm

This would allow apple silicon/m1 chipsets to run geodesic without emulation!

Slack Community

Describe the Feature

Using multi-stage dockerfile features, introduce an arm build mode.

Use Case

I have an m1 mac, and atm qemu struggles with several bugs on non-arm64 dockerfiles

Describe Ideal Solution

Most tools should still be supported. There may be some that will have to wait while other folks update libraries or replace deprecated dependencies (i.e. terraform's hashicorp/template is archived and deprecated, and thus doesn't support darwin_arm64. It should be replaces with newer terraform templating providers.)

Alternatives Considered

Running with qemu emulation hasn't worked. And many of the hacks people provide require substituting a stable qemu environment for an unstable and rather experimental one. I've found it to be even buggier, slower, and very inefficient.

Additional Context

It's not expected to be a 100% solution, but if at least atmos is working, a lot of the rest of the tooling can follow soon!

dudymas avatar Jun 27 '21 20:06 dudymas

@dudymas I understand the need, but simply compiling the Dockerfile for M1 will not be sufficient. Geodesic bundles dozens (hundreds?) of executable binaries and we would have to have M1 versions of all of them available to install. Plus we would need to build (compile and link) Python3 for M1, and right now we would have to do that with qemu, so if qemu is having problems, it likely won't work.

I will leave this feature request open, but expect it will be more than a year before a sufficient infrastructure is in place to enable Geodesic to be delivered for arm64.

Nuru avatar Jul 08 '21 03:07 Nuru

Apple M1 Support

We've confirmed that Geodesic works on recent versions of OSX on the M1 running as amd64 (not arm64). Docker auto-detects this by default, but otherwise, it’s possible to pass --platform linux/amd64 to docker to force the platform.

osterman avatar Jan 05 '22 15:01 osterman

FYI to set the --platform or any additional docker argument, use the following environment variable.

export GEODESIC_DOCKER_EXTRA_ARGS="--platform linux/amd64"

The poor performance of Geodesic on M1 is not specific to Geodesic, but rather a known issue with Docker for Mac. Things to try from @Nuru

  • Check (enable) Preferences -> General -> use gRPC FUSE for file sharing
  • Check (enable) Preferences -> Experimental Features -> Use the new Virtualization Framework
  • Use VMware Fusion to run a Debian VM, and run Geodesic from within the Debian VM

From @mcalhoun you can see improvements via

  • Check (enable) Preferences -> Experimental Features > Enable VirtioFS accelerated directory sharing

nitrocode avatar Aug 25 '22 17:08 nitrocode

Let me add my 2 cents to this discussion and share with you my PR with a Dockerfile that I managed to built on my Mac m1. Took me 2 evenings to figure things out and put it together so even if it looks more like a proof of concept it may be a good start for further development. It looks hacky but it works πŸ˜‰

Happy to get your feedback how it can be improved.

PiotrPalkaSpotOn avatar Sep 28 '22 15:09 PiotrPalkaSpotOn

I also needed to add DOCKER_BUILD_FLAGS to the Makefile, but ended up moving both out to my ~/.bash_profile so it supported other devices too.

export GEODESIC_DOCKER_EXTRA_ARGS="--platform linux/arm64"
export DOCKER_BUILD_FLAGS="--platform linux/arm64"

johncblandii avatar Dec 14 '22 18:12 johncblandii

Coming upon a realization that just building an arm64 geodesic image is not enough as the packages are still built for x86 architecture I was able to fix it (by providing ARCH env variable and an update to one package). I build the proper arm64 image and I can see the performance improvement is huge (about 30%). atmos terraform plan... execution that I use the most went down from 2m30s to 1m30s which is significant taking into consideration that I have tens of executions daily (happy to share more metrics if needed).

As I couldn't verify if all packages work properly I can't say it's a complete setup.

I'm also aware how big chunk of work it is on your side to support geodesic arm64 the right way. Since we're using geodesic debian-based as a base image for our custom container I can see the x86 packages are stored in Cloudsmith Debian repo with no arm64 equivalent so far. Also, not all maintainers are having arm64 packages in their Github Releases which makes things even more complicated. I've checked some packages and their x86 versions work in arm64 container. I can't say if it's efficient.

Anyway, knowing the load of work that has to be done I don't expect geodesic to officially support arm64 soon but it's worth to explore as more Macs with Apple Silicon processor gain developers' attention.

PiotrPalkaSpotOn avatar Dec 22 '22 17:12 PiotrPalkaSpotOn

arm64 support is included, starting with Geodesic version 2.0.0

Nuru avatar Mar 24 '23 22:03 Nuru