Nicd
I recently got an ARM laptop to replace my old amd64 one. This poses a problem for me. I run my production service on an amd64 VPS (Hetzner) that runs Ubuntu Server.
Thus far I’ve used a Vagrant box with Ubuntu to build a release in, and then uploaded that release to my production server, unpacked it, and restarted (it’s quite manual, yes, but I don’t release often). Now, of course, due to NIFs such as Comeonin and AppSignal, I cannot build on ARM.
How have you typically handled this? I found some earlier threads suggesting the use of Docker or building the release on GitHub (I use GitLab though):
- Is creating the Elixir release on arm Macbook M1 a problem when uploading that to an intel architecture Ubuntu server?
- How to cross-release and upgrade?
Is this still the way to go? I have tried Burrito earlier, but I could not get it to build the release correctly (problem with NIFs).
I know nowadays I could run an ARM VM with amd64 binaries inside using Rosetta 2, but I don’t know how big of a hassle it would be.
One thought was GitLab CI, I guess I could use that to build a release out of every push to some branch? Could I get it to match the Ubuntu environment closely enough so that it would work? Though, I’m on a free account so I don’t know how much processing it allows me to do.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 21 to 12- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
binaryape
I’m using Docker in buildx mode to create releases for amd64 - I wouldn’t call it fast but it’s adequate
michallepicki
Looks like there’s a better way. This didn’t work for me on Erlang/OTP 25.1.1 but seems to have worked on 25.3.2.2
michallepicki
I succeeded recently in building a release on a Apple Silicon Mac inside a UTM emulated x64 system (I used Ubuntu Server, to not waste cycles for a GUI when emulation is so slow). But for this particular service we don’t care about performance, so it was more convenient to use Docker with Erlang built from source with the JIT disabled. The
asdf/kerlflag I used in my Dockerfile was:This allows to avoid the qemu Erlang JIT issue.
derek-zhou
I always have a pc at home, powered-on, reversed ssh tunneled to one of my VPS. So I do not use my MacBook to build the release, even mine is x86.
derpycoder
I was reading how others are doing it, and here’s what I gathered.
We can use tools like SCP, S3, CROC to move our build artifacts across servers.
P.S. Still learning by experimenting with all the ways to do it.
jbriggs
I build releases for ARM systems on an x86 build server.
I take the files for the ARM system’s ERTS, place them on the build server and then reference them in the release I am building.
Here is a snippet from the mix.exs, “releases” section:
The only provisio is that building any NIFs or port programs becomes much more complicated. The only port programs I have are very stable, never needing changes, so I include compiled versions as binaries in priv.
s6o
Very very slow
I’m in a similar situation, my cloud infra is x86_64 (Ubuntu) and cannot just build on my M1 mac mini. So I also tried UTM on M1 with x86 emulation … its was pretty much unusable for builds.
So I run my builds on my 2015 intel MBP, which runs UTM (virtualization) for the same architecture. The UTM instance is running Lubuntu and my builds are way faster than on M1
Nicd
Oh, and here’s the configuration I ended up with (permalinked to the current version, so maybe check if it has changed if you come from the future): .gitlab-ci.yml · e037b3c8245f2db487a13539062de726749b6156 · CodeStats / code-stats · GitLab
Let me know if you think I could do something better!
Nicd
Thanks everyone for the answers, I hope they are also useful for any future readers that might find this thread.
I ended up building the release in GitLab CI which was surprisingly painless. I haven’t tested deploying the artifact yet, though, but it looks sensible enough when extracted. 
cjbottaro
Not only slow, but I’ve never got it to actually work for me. It always ends up crashing for some reason.
I’m in the camp of just letting your CI build the images (we use GitHub Actions).
Kind of an aside, but related… BuildKit lets you make multiarch images pretty easily, using a Kubernetes cluster to farm out the build jobs to machines of different architectures. My M1 is so fast though, that I like to do the ARM build locally though. I have a little bash script to help with this.
Build ARM locally, then use a BuildKit Kubernetes builder to build AMD64 and mash them together in to a multiarch image: