5 ms·
I'm diving into Elixir now to compare it with Golang for a new web app backend I'm working on. I really enjoy the functional paradigm but from what I've seen de
by nerdywordy 10y ago
I'm diving into Elixir now to compare it with Golang for a new web app backend I'm working on. I really enjoy the functional paradigm but from what I've seen deployment can be a bit annoying. Whereas with Go you can compile and drop it easily into production.
Does anyone have experience with this?
- ch4s3 10y agoYou might want to look into edeliver https://github.com/boldpoker/edeliver https://github.com/boldpoker/edeliver
- HalcyonicStorm 10y agoDistillery is highly recommended https://github.com/bitwalker/distillery https://github.com/bitwalker/distillery
- iagooar 10y agoI totally agree. It takes a bit of trial-and-error for the first time, but works perfectly fine once you have figured it out. I recommend going with edeliver + distillery for the best experience, plus it is the recommended way of deploying Phoenix as of today.
- hamandcheese 10y agoWhere do you plan to deploy? Its easy enough to deploy to Heroku, and I imagine dockerizing an Elixir app is also a straightforward process. If, on the other hand, you are taking a more traditional approach and just deploying to a Linux box/vps there are solutions for that too (i.e. Chef, Capistrano). It should be pretty far down in the list of things that influence your choice, imo, since it's basically a solved problem.
- nerdywordy 10y agoMy company's first choice is always Azure since outside of my team we're C# head to toe. Though after skimming through a few deployment articles I might push for a Heroku deploy. 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.
- iagooar 10y agoI think that with proper deploy automation (e.g. Ansible) and the right approach (avoid hot-code updates unless your REALLY need them) you are going to get a pretty solid deploy experience, no matter what your target deploy platform is. Just throw in an HAProxy for rolling deploys and you are ready to go! If you need any specific help, feel free to contact me!
- geakstr 10y agoYes, deployment in Elixir is painfull. We use distillery and edeliver, but plan to try move to docker
- bitwalker 10y agoI build releases with distillery and deploy them with Docker, the combination has worked really nicely for my projects. Disclaimer: I'm the author of exrm and distillery, so I'm probably biased.
- iagooar 10y agoI don't see why it should be painful. What were the issues you were facing? 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).
- rubyn00bie 10y agoDeploying to production is a pain in the ass to setup the first time and has a lot of gotchas. I know, I've done it. 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.
- iagooar 10y agoI do not agree that it is a pain in the ass. It's not more or less complex than many other languages. Also, the tooling has improved a lot in the recent months and edeliver + distillery work great, even without much previous experience.
- GrinningFool 10y agoedit: my experience has been with Erlang deployments, I don't yet know what the landscape is like for Elixir - at least the first part of my comment below can be disregarded. I would assume it's similar to deploying an erlang application, but I don't know for sure. 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.
- ivarvong 10y agoWe have Elixir/Phoenix in production on Heroku (with Heroku Pipelines) using a custom buildpack [0]. It's been great. We'll probably look at Docker. We use CircleCI, and this setup script [1] was a great starting point. 0: https://github.com/HashNuke/heroku-buildpack-elixir https://github.com/HashNuke/heroku-buildpack-elixir 1: https://gist.github.com/joakimk/48ed80f1a7adb5f5ea27 https://gist.github.com/joakimk/48ed80f1a7adb5f5ea27
- bitwalker 10y agoDeploying releases has been fairly painless in my experience, but I also have had my head in Elixir and releases in general for a long time, so I may not be a great sample. You get a tarball containing everything the app needs to run, and all you do is extract it and run the boot script - other than entirely self-contained binaries like Go produces, I don't think it gets much better. Deploying without releases is probably a lot more painful though, due to the number of dependencies required, particularly web applications (Erlang, Elixir and Node). I recommend anyone deploying Elixir applications look into releases - it makes life much easier (imo).
- amsha 10y agoI'd mostly agree, and the packages you've written (ExRM and Distillery) make releases super easy to build, start, and stop. 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.
- chrisseaton 10y agoI thought BEAM was a bytecode VM so why do you need to cross compile anyway? Is the bytecode different on different architectures?
- rubiquity 10y agoReleases include the Erlang byte code and the VM as well which needs to be compiled for the platform it will run on.
- chrisseaton 10y agoBut why would you want to recompile the VM when you've just changed your program? And it looks like you can cross compile BEAM anyway. http://erlang.org/faq/implementations.html http://erlang.org/faq/implementations.html. It's just a C program isn't it so why wouldn't you be able to?
- deleted 10y ago[deleted]
- gamache 10y agoA non-autoscaling deployment is quite easy to accomplish. Build releases with Distillery[1], and deploy them with Edeliver[2]. You get zero-downtime upgrades and rollbacks for free, as well as nearly automatic server clustering. I gave a talk about this last year in New York[3]. 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 https://github.com/bitwalker/distillery [2] https://github.com/boldpoker/edeliver https://github.com/boldpoker/edeliver [3] https://www.youtube.com/watch?v=H686MDn4Lo8 https://www.youtube.com/watch?v=H686MDn4Lo8 [4] https://www.youtube.com/watch?v=mRspOj_sRgo https://www.youtube.com/watch?v=mRspOj_sRgo
- toast0 10y agoI run erlang in production; our deploy is push code, compile, l(foo) from debug shell. (push code and compile driven by Makefile). It doesn't follow the OTP deployment model, but it's easy.
- yellowapple 10y agoEven without exrm (Distillery nowadays), I've had quite a bit of success with using Docker, complete with hot patching. I come from a Linux administration background, though, so I'm a bit more open to abusing Docker's semantics in horrific ways.
- afro88 10y agoAs far as deployment goes, I've had great success with flynn.io and an Elixir buildpack. 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)