softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.55k stars 195 forks source link

add native arm image #724

Closed realies closed 1 year ago

realies commented 2 years ago

currently, it seems like elasticmq-native runs through qemu-x86_64 on arm, could this be made into a native image? it would really benefit laptop development and battery life, since it currently takes about 10-20% cpu with a light polling client

micossow commented 2 years ago

Continuation of #473

realies commented 2 years ago

thanks @micossow, as I mentioned there, there's darwin aarch64 support over at https://github.com/graalvm/graalvm-ce-dev-builds/releases now, could m1 arm native elasticmq-native images be a thing with it?

micossow commented 2 years ago

It's probably doable, but there seem to be some limitations in the sbt plugin we use: https://github.com/sbt/sbt-native-packager See: https://github.com/softwaremill/elasticmq/issues/473#issuecomment-895764215

micossow commented 1 year ago

It should be possible to build such image now, see: https://github.com/sbt/sbt-native-packager/issues/1503 Some changes in build.sbt are probably also necessary.

fvasco commented 1 year ago

I tested the image softwaremill/elasticmq-native:1.3.14 on a Graviton AWS server, but it does not work

# docker run softwaremill/elasticmq-native:1.3.14
Unable to find image 'softwaremill/elasticmq-native:1.3.14' locally
1.3.14: Pulling from softwaremill/elasticmq-native
Digest: sha256:c251751b5d668033c69494ff37a938f977397ad3c806085e53f269bedb2c3ead
Status: Downloaded newer image for softwaremill/elasticmq-native:1.3.14
[FATAL tini (7)] exec /opt/docker/bin/elasticmq-native-server failed: Exec format error

The executable in the image is in amd64 format

file opt/docker/bin/elasticmq-native-server
opt/docker/bin/elasticmq-native-server: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=2ad8fd7fe117da1b01aea2b469d54497c42743d3, with debug_info, not stripped, too many notes (256)

Other files look for aarch64 architecture.

kderholtvisma commented 1 year ago

Will this be fixed? or is there a quick way of building this from the repo manually?

micossow commented 1 year ago

If you need docker image locally, you can run sbt "project nativeServer; clean; assembly; graalvm-native-image:packageBin; docker:publishLocal" on your ARM64 system.

To be able to create native docker images as a part of GH workflow, we need either:

diegobfernandez commented 1 year ago

GitHub released a MacOS builder which is M1 based. Could that be used for ARM64 builds?

adamw commented 1 year ago

@diegobfernandez Interesting - if we only use it for releases, it might not be that expensive (hopefully in the order of a couple of dollars)

micossow commented 1 year ago

Hello, I updated build.sbt to use buildx supported image creation, which should create proper native images for both x64 and ARM. Please test if softwaremill/elasticmq-native:1.4.5-RC1 image works on your ARM machines. If yes, I'll create a release next week.

micossow commented 1 year ago

Update: softwaremill/elasticmq-native:1.4.5-RC2 has a fix for UI.

micossow commented 1 year ago

Fixed in https://github.com/softwaremill/elasticmq/releases/tag/v1.4.6