Elixir Deployment Options

Using ExRM releases, I’ve found it’s really not a big deal; deploy a .tar.gz file, stop your app, unpack it, start your app. While I know hot upgrades are possible as well, I haven’t worried about it yet - so far it’s not been worth the effort for my use cases.

A huge advantage is that I don’t need any dependencies installed on the server - everything is in the release package. I have to generate the release on a similar type of machine as the intended server, of course, but that’s no issue as my laptop, desktop and the servers are all running Linux anyway. If it weren’t like that, I’d probably have Jenkins do the release packaging on a build server - probably will do that soon anyway, for convenience.

The guide for using ExRM with Phoenix is pretty nice:
http://www.phoenixframework.org/docs/advanced-deployment

One little nagging detail that can be tricky to get into your workflow w/ releases is Ecto migrations; mix doesn’t exist in the deployed release. There are good ways to handle that yourself though, by using the exposed functionality within Ecto:

Of course, you can always run the migrations from our dev machine, but that might be trickier to integrate into an automated release flow if you’re trying for that.

5 Likes