Bakeware: Compile any Elixir application into a single binary
github.com
github.com
I'm currently learning Elixir and the biggest initial hurdle was how to actually create an application. Most tutorials teach you through iex but rarely how to actually write a running program or library.
Things like "mix run" wouldn't work until I created an app with mix new, then I had to visit the rabbit hole of genservers and supervisors, etc...
It's a little complex for beginners and could use some polishing. I can't say that I truly understand it still.
My feedback was "hum, that's kind of a turn off for someone trying to learn the language/tech no?"
I think the community has been looking for something for a while now and is iterating (too?) quickly. There was erlang releases, there was distillery, now it's elixir releases. There are different ways of configuring in production. It goes a little too fast to keep up with to be honest.
In fact, releases and post-deploy ops are pretty well documented: https://hexdocs.pm/mix/Mix.Tasks.Release.html
Phoenix also has an example multi-stage Dockerfile which is fine for 99% use cases: https://hexdocs.pm/phoenix/releases.html
...in 2020 I deployed to bare metal servers. Mix released a gzip to S3 and pulled the artifact down, systemctl restart dnautics_service.
You're making me feel like some sort of dinosaur.
There's no one size fits all.
rsync --rsync-path=/usr/bin/openrsync -r --delete config lib mix.exs mix.lock priv server:my_project
ssh server "tmux respawn-window -t my_project:1 -k"
It's only weird if it doesn't work, right?
I thought deploying would be a pain. It was really painless: a matter of cloning on the home server, running ‘mix release’ and pointing a systemd unit to the start script it generated.
It was a pleasant surprise, especially coming from the Django world where anything deployment related would be a day’s work.
Are there disadvantages to this process?
With static linking you become responsible for:
- tracking down the dependencies used during a build
- track where the binary is deployed
- follow publishing of vulnerabilities affecting the libraries you used
- either backport security fixes, rebuild and deploy the binary or deploy a newer version hoping it does not break anything
You can do that by shipping the object files with the binary, or on request, or providing the sources of your application under a closed license, or under any FOSS license.