by nerdywordy · 9y ago · 0 comments
Does anyone have experience with this?
A deployment that can autoscale is harder to accomplish, but still not impossible. AFAICT, most people doing this are building releases with Distillery, wrapping those releases in a Docker image, then using the deployment and orchestration tools of their choice. Monica Hirst gave a talk about doing this with AWS CodeDeploy last year at Empire City Elixir as well[4].
[1] https://github.com/bitwalker/distillery
[2] https://github.com/boldpoker/edeliver
The main benefit of Go, I think, is that it can cross-compile builds. Erlang and Elixir don't have any way to do that, so if you develop on Mac and deploy on Linux you'll need to build your release in a VM or on a build server running Linux.
It is getting better but right now the few things I can recommend the most are:
• learn what an "OTP release" actually is and what it means. This alone will save you days of your life.
• do rolling restarts, doing live upgrades is difficult and not necessary for the vast majority of applications.
• read the prod.exs config, there's a commented out setting you'll need to enable. I forget the name of it, but it's on my github "tehprofessor" with the repo "flying with Phoenix" (its probably outdated in many ways but that setting is essential).
• remember the application is compiled and then run, so you really won't get any runtime configuration (likes Rails' environments).
• Docker can alleviate build pain a bit, as it stabilizes your environment-- I don't use it myself but it makes building a bit more pleasant from what others have told me.
• you'll very likely need to include all the applications, including ones listed in your dependencies (it's a pain in the ass), in your mix.exs applications list if you're using exrm.
... it's been a couple months as I've been on a coding hiatus for health reasons (and a broken arm) but I believe most of the above should still be very true.
That said and even with all the bitching I've had about it, I still love Elixir and Erlang. Though I've been moving more to pure Erlang as time goes on (FWIW).
Edit: clarity and note about loving me some elixir/erlang.
I think the second part is still possible, since if it can be done for Erlang it can be done for Elixir.
-- Original post --
I haven't found production deployments to be particularly painful, I'd be interested to hear what kind of troubles you've run into.
Runtime configuration is definitely possible - you can deploy configuration files with your application and determine which one you want to load. It's not built-in, but it's a few lines of code to do it manually. You can also always use environment variables, which is arguably a better approach.
0: https://github.com/HashNuke/heroku-buildpack-elixir 1: https://gist.github.com/joakimk/48ed80f1a7adb5f5ea27
It should be pretty far down in the list of things that influence your choice, imo, since it's basically a solved problem.
I can honestly say I've not been this excited about a language in quite a while. Working with Go is pretty straightforward... but it's a complete bore. The more I dig into Elixir the more I desire to use it full-time.
If you need any specific help, feel free to contact me!
Disclaimer: I'm the author of exrm and distillery, so I'm probably biased.
I found that besides hot-code updates, there is not as much magic as one could think, and once you "grasp" the idea of a build machine, it should be pretty straigt-forward. Throw in an HAProxy for rolling deploys and you have a sweet zero-downtime solution!
Feel free to contact me if you need someone to help out (from some free general tips and tricks to supporting your team as a consultant).
Flynn is amazingly easy to deploy. It provisions DO/AWS/Azure then bootstraps a single node or cluster literally at the push of a button. Then you just add it to your repo and push (provided the buildpack is already set up)