web-platform-tests / wpt.fyi

web-platform-tests dashboard
https://wpt.fyi/
Other
178 stars 85 forks source link

Build wpt.fyi docker image for linux/arm64 in addition to linux/amd64 #3196

Open racheljay opened 1 year ago

racheljay commented 1 year ago

Hello! My name is Rachel and I am interested in working on this project as part of the GSoC program. I am having issues running the environment locally on a MacBook with an M2 Apple silicon chip. Here is the error I am seeing when running ./util/docker-dev/web_server.sh which fails the script:

Couldn't initialize inotify.  Are you running Linux 2.6.13 or later, and was the
CONFIG_INOTIFY option enabled when your kernel was compiled?  If so,
something mysterious has gone wrong.  Please e-mail radu.voicilas@gmail.com
and mention that you saw this message.

Running ps in the wpt.fyi container displays the following:

 $ wpt.fyi % docker exec -it wptd-dev-instance ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
user         1  0.0  0.1 149572 13780 pts/0    Ssl+ 18:41   0:00 /usr/bin/qemu-x86_64 /bin/bash /bin/bash
user      1333  0.0  0.0 146640  8028 ?        Ssl  18:41   0:00 /usr/bin/qemu-x86_64 /bin/sh sh -c gcloud beta emulators datastore start --project=wptdashboard-local --consistency=1.0 --host-port=localhost
user      1340  0.3  1.1 235004 95292 ?        Sl   18:41   0:02 /usr/bin/qemu-x86_64 /usr/bin/../lib/google-cloud-sdk/platform/bundledpythonunix/bin/python3 /usr/bin/../lib/google-cloud-sdk/platform/bundle
user      1439  0.0  0.1 148940 11032 ?        Sl   18:41   0:00 /usr/bin/qemu-x86_64 /bin/bash /bin/bash /usr/lib/google-cloud-sdk/platform/cloud-datastore-emulator/cloud_datastore_emulator start --host=lo
user      1445  1.9  4.7 5927820 385040 ?      Sl   18:41   0:11 /usr/bin/qemu-x86_64 /usr/bin/java java -cp /usr/lib/google-cloud-sdk/platform/cloud-datastore-emulator/CloudDatastore.jar com.google.cloud.d
user      1490  0.0  0.1 151276 10728 ?        Rl+  18:12   0:00 ps aux

I can see from this that the processes are all being redirected through qemu. Investigating further, I found documentation from Docker indicating the following:

However, attempts to run Intel-based containers on Apple silicon machines under emulation can crash as qemu sometimes fails to run the container. In addition, filesystem change notification APIs (inotify) do not work under qemu emulation. Even when the containers do run correctly under emulation, they will be slower and use more memory than the native equivalent.

qemu appears to be used when running a container using an image not built for the arm architecture. The wpt.fyi docker hub page shows me the image is only being built for linux/amd64.

One possible solution is for the wpt.fyi image to be built for the linux/arm64 architecture in addition to linux/amd64 so the processes within the wpt.fyi`container can run natively for those systems.

DanielRyanSmith commented 1 year ago

@racheljay were you able to find a fix for your problem here? I noticed you've contributed issue fixes and provided screenshots with working changes, so I assume you've gotten things setup in some form.

racheljay commented 1 year ago

@DanielRyanSmith I was never able to get setup on my MacBook. However, I was able to get it running on my windows machine using WSL2. If possible, I would love to be able to get it working on my laptop as well. Are there any updates for a fix?