-
Notifications
You must be signed in to change notification settings - Fork 420
Add basic support for Apple Silicon #852
Add basic support for Apple Silicon #852
Conversation
Thanks for the pull request, @bradenmacdonald! I've created OSPR-6205 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
ac6d59e
to
6a2783b
Compare
As mentioned on the Open edX forum we are also affected by this issue in Tutor: overhangio/tutor#510 I'm curious to learn what solution will be found for the devstack. In particular, switching to Mariadb seems like a pretty radical choice, given that incompatibilies exist: https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/ (full disclaimer: I'm terrible at understanding mysql but I find this list of incompatibilities long and scary) |
@bradenmacdonald Thank you for your contribution. Is this ready for our review? |
Just to be clear, this is only for development, and only for people with ARM systems, and I consider it a temporary solution even for that. I'll certainly update this if I encounter any issues. |
@natabene It's ready for review yes. I expect there may be some discussion about it, this may or may not be the best direction to go in. But as far as the code goes, I think this is complete. |
Today I tried building ARM64 images of
Somehow the task Download digicert intermediate Certificate is failing with a segfault.
Some debugging points to the error is occurring in |
|
||
mysql57: | ||
#image: mysql:5.7 doesn't support linux/arm64/v8 | ||
image: mariadb:10.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you are using platform: linux/amd64
in other places in this PR. Have you tried doing that with mysql57, if so, how did it go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't try it, so I'm not sure. Based on my experience with the other images, I suspect it would work fine, but all the database queries would be a bit slower, degrading overall performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth, the MySQL 8 images published by Oracle support arm64/v8: https://hub.docker.com/r/mysql/mysql-server/tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you for creating this PR. From first glace, it mostly looks good. I added few question in review.
Also, would you either/or modify the README with a note about this or write an ADR about this addition.
redis: | ||
# image: redis:2.8 is ancient and doesn't support linux/arm64/v8 | ||
image: redis:5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much were you able to test this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't yet done extensive tests. Only basic things like logging into the LMS, using the django admin, and running parts of the test suite. However, so far I haven't encountered any issues.
OS_ARCH := $(shell uname -p) | ||
ifeq ($(OS_ARCH),arm) | ||
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-arm64v8.yml | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this should be opt-in. I can't think of why someone with apple silicon would not want to do this, but putting this comment here in case someone reading this can think of a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the result is pretty slow. But it works, and it's definitely better than not having a devstack at all on M1 Mac.
I am dissatisfied with the performance though, which is why I've now tried building a native ARM image for edxapp instead. If I could get that working, I'd definitely change the PR to use that approach instead. I hit a roadblock, which I think is due to the old version of ansible being used.
Sure, I just want to spend a bit more time testing this first, and seeing if I can explore an alternative approach. |
xqueue_consumer: | ||
platform: linux/amd64 | ||
|
||
# edX Microfrontends all use node:12 which has linux/arm64/v8 builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the MFEs have an issue too; optipng-bin
fails to compile on M1 (see imagemin/optipng-bin#117), which then breaks the build since it's called later in the pipeline.
As suggested in the issue above, one can work around this for now by setting CPPFLAGS=-DPNG_ARM_NEON_OPT=0
. I can confirm that this works if added as an environment variable to the MFE services.
@bradenmacdonald Thanks again for doing this work. For now, it looks like this is still in-progress. Please ping me when you'd like further review. |
I'm going to close this PR, and recommend that anyone who wants to develop on an ARM64 device use Tutor devstack instead. See discussion at overhangio/tutor#510 (comment) Rationale:
|
@bradenmacdonald Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
@bradenmacdonald we are taking another look into M1 support in devstack. Preliminary support on this branch/PR if you're still interested #920 |
@johnnagro Thanks for the heads up. Does that branch run edx-platform in an arm64 container or under x86 emulation? I had been able to get the latter working but not the former. |
@bradenmacdonald it uses/creates arm containers. we are in the early stages of testing. |
This PR changes the Makefile to automatically detect if the developer is using an ARM system like Apple's M1 notebooks. It will then adjust the docker-compose file so that devstack can run.
Without this PR, attempting to run devstack on an ARM mac will display the error
no matching manifest for linux/arm64/v8 in the manifest list entries
Does it work?
Yes but slowly.
What I have confirmed works:
I am still in the process of testing this out and setting up my devstack so I will update this with more information.
How it works
node
containers,mongo
,memcached
)mysql:5.7
→mariadb:10.4
,redis:2.8
→redis:5
)edxops
that currently don't support ARM. These ones are just configured to run asx86_64
(amd64
) images with qemu emulation. This works fine but is slow.How can I test this?
You need to use either an M1 Mac, an ARM linux system like a Raspberry Pi, or an ARM virtual machine (e.g. use UTM to run arm64 linux on an Intel Mac).