Apple M1, Docker arm64 emulation

AI-generated summary

The discussion is about Apple M1 and Docker arm64 emulation. Walker_Blackwell is trying to test Discourse/Docker locally on M1 and wants to know how to specify the platform in the launcher rebuild app sequence.

Falco mentions that Discourse doesn’t work on arm64 yet, but they are actively working on it. The team has some members running it on M1, but it requires a branch of libv8, which is a transitive dependency coming from miniracer.

sam suggests using the docker args param launcher, and david recommends using the DOCKER_DEFAULT_PLATFORM environment variable to specify the architecture.

The discussion also touches on the performance of M1 Macs for development. Falco mentions that it’s incredible for single-core Rails work, but slower than x86_64 offerings in multicore or disk IO. david shares his experience with running Discourse on an M1 MacBook Pro, and fzngagan asks if the M1 MacBook Air is good enough for Discourse development.

david confirms that the M1 MacBook Air is suitable for development and mentions that there’s little performance difference between it and the M1 MacBook Pro. He also links to an article on the Rails forum with tips and tricks for developing Rails applications on Apple Silicon.

The discussion concludes with Justin_Vega mentioning that Docker for Mac now supports Apple Silicon, and Walker_Blackwell thanks him for the update.

Where do I specify --platform linux/arm64 in the ./launcher rebuild app sequence?

I need to test Discourse/Docker locally on M1.

Would be great to set this until such point as ARM build is fully implemented.

best regards,
Walker

Discourse doesn’t work on arm64 at the moment, so there is no switch in launcher for it.

We are actively working on it, and we have quite a few members of our team running it on M1 already, but it still requires a branch of libv8, which is a transitive dependency coming from miniracer.

Thanks Rafael.

You all rock.

best,
Walker

You could try the docker args param launcher has, it may work

How’s it looking in dev performance wise?

Incredible performance for single core Rails work, like Topic Create or Topic view. Still a lot slower than any recent x86_64 offering in multicore or anything that touches disk IO.

I see. Thanks for this info. I think the software support for M1 will take some time to get right but future is looking bright.

It sounds notorious but it makes me a little happy that my recently bought device isn’t obsolete all of a sudden. :wink:

If that doesn’t work, you can use the DOCKER_DEFAULT_PLATFORM environment variable. I currently have:

export DOCKER_DEFAULT_PLATFORM=linux/amd64

in my zsh profile. When using Docker I pretty much always want the architecture to match production systems.

Compared to previous generation MacBooks it’s a big improvement, even though the filesystem performance issues still exist. A high-end linux desktop is still going to beat it though.

For example, I can run bin/turbo_rspec on core in about 2m50s (M1 Macbook pro, with Discourse, Redis & Postgres running natively). Team members on high-end linux desktops can do that in about 1 minute.

whats the roadmap for this to be enabled as stable?

We need a new mini racer / v8 gem to be released, no eta yet, we are testing alpha versions at the moment

@sam and how are tests going? Im highly interested in M1-compatible version.

Its not that bad timing… there are people (developers) out there who dont even come close to this…

For development of Discourse on M1, you can find some info over on the Rails forum: Tips and tricks for developing Rails applications on Apple Silicon - rubyonrails-talk - Ruby on Rails Discussions. A few of us on the team are using this day-to-day, and it works.

I would not recommend trying to run a production Discourse server on M1 though.

if so, than why do not release it to GA?

I would not recommend trying to run a production Discourse server on M1 though.

Why not?

@david

Its absolutely lovely. I’m lost for words on how to thank you for this. Great job.

Also, is the M1 macbook air good enough for discourse dev?

I suppose so :slight_smile:

Its absolutely lovely. I’m lost for words on how to thank you for this. Great job.

I suppose spreading word about Discourse would be enough…

I don’t follow… all of this is public, you can follow those instructions yourself and get things going.

Our production install instructions are intended for running on an AMD64 linux host. You might be able to get it running on other OS/architectures using the tips in this topic, but there are no guarantees.

Absolutely. I have the Pro, but we also have people using M1 MacBook Airs and Mac Minis. There seems to be very little performance difference between them in our development benchmarks.

where? in official public repo?

In the article I linked:

We didn’t make any changes to Discourse that are in some private development branch, if that’s what you’re wondering. You can get Discourse to work on an M1 system by installing the ARM64 versions of dependencies we use, which is in the guide posted above by David.

We would all like the official repo to work with the new hardware right :wink: and not some code hidden in the closet.