andre1sk

andre1sk

Seams there are not that many large production deployments so would be good to start learning what the best practises are?
how do you run migrations?
how do you handle deploying to multiple servers?
how do you roll back?

Showing Posts 1 to 5

OvermindDL1

OvermindDL1

The way we do it at my job is create a release (via exrm), we have a special config build on the build server that connects to the prod database, backs it up, migrates it up, then copies the release over and applies it (ordering is a bit different), and we only have one server for web hosting, if it goes down we have bigger issues here anyway so we would not care (even then we would not care that much except during certain times of the year).

Only rolled back once, it was manually done.

AstonJ

AstonJ

I haven’t deployed any Elixir apps myself yet but there are a couple of stickies in this section that might be of help:

And this is a popular thread about where to deploy:

hazardfn

hazardfn

We use distillery to create a basic release, from that we build an RPM and push it to a repo. For everything else we use ansible to manage - that includes configs, migrations etc. The group_vars / host_vars functionality of ansible is perfect for deployment to multiple servers and environments.

Rollbacks are also handled with ansible, by specifying a version number as a variable.

tfwright

tfwright

I just finished setting up my first production Elixir deploy :confetti_ball: so I thought I’d share my approach in case it’s helpful to other beginners, especially those coming from the Ruby world, where there is a widely dominant pattern developed in Capistrano, Mina etc.

Basically I wanted something similarly simple, but more flexible. For context, this is not a mission critical application so I had some room to experiment. I knew I wanted to go with ansible, but mainly because I already had experience with it and I’ve been satisfied. I haven’t properly compared it to other tools though. But its deploy_helper module made it really easy! The result was an extremely small playbook:

Some notes:

  • Requires user with sudo access
  • Uses somewhat awkward script for env management, but I wanted to keep my production env vars in a separate file and this seemed like the easiest way
  • Erlang/Elixir managed with asdf. There were some minor gotchas around setting the PATH properly so these settings were respected by the ansible session
  • Requires a migrate task to use with bin/my_app eval as described here
  • Uses systemd to manage app process

Overall it is not the robust approach and I’m sure I’ll be making improvements. It doesn’t handle server provisioning or separate build environments or anything like that, but it seems to work well as a starting point if you just want to get your app deployed in production to linode etc instance.

jchrist

jchrist

This is super useful, thank you! I use Ansible on pretty much a daily basis and I didn’t know about deploy_helper before.

I found that building a release in new_release_path during each deploy takes quite some time though, so I switched to cloning into shared_path, building the release there, then copying the release (from _build/prod/rel) into new_release_path. I’m also lazy so I just run mix ecto.migrate --all instead of a custom release task. :smiley:

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews