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

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

andreasronge
What happens if you design tools for LLMs instead of letting LLM use human tools ? Wrote a blog on why and what that enables. As I see ...
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
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews