4 ms·
Deploying 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
by rubyn00bie 10y ago
Deploying 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.