unaware8150

unaware8150

How do you choose your mix environment for your QA/staging deployments?

Good day, folks!

I’m a long time lurker of the forum, but I decided to jump in into the community to ask a question that it seems obvious, but I find difficult to answer: Which mix environment do you use when you have QA/staging environments for your elixir application? how do you choose which mix environment to use?

In Ruby/Ruby on Rails deployments, it’s common to create a new environment configuration with the same name you want for each type of deploy: development, qa, staging, test, production and I’ve seen this pattern also in certain phoenix codebases, but it feels a bit forced for me when working with elixir, IMHO.

What I usually do is that I choose dev.exs for development deployments, test.exs to configure and run the test suite and prod.exs for QA/Staging/Production environments and then I tweak certain configs (like secrets or log levels) at the config/runtime.exs level.

What’s your approach?

Thank you all for your replies!


Please note the aim of threads like this is for you to explain things in your own words. Please see this thread for details :slight_smile: (videos/links to further reading are also welcome though!)

First 3 of 3 Posts Switch mode

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hey @unaware8150

This is the way (mostly, just tack on releases). The thing to distinguish is between “build environments” and “deployment environments”. As you say for development and testing, these are done often on people’s computers and have dedicated build environments to handle the different dependencies and tasks necessary for testing and dev.

For all deployments though, we always use prod.exs. More specifically, we have a build pipeline which builds a release artifact (this could be a simple release .tar file or a full docker image) and then we deploy that artifact in whatever deployment environments we need / want to. This means that we have identical byte for byte artifacts going into each of those environments, increasing our confidence that if the release behaves a certain way in QA / Staging, then it should do so in prod.

christhekeele

christhekeele

I like to use MIX_ENV for build concerns (debug logs in dev, mocks in test, optimizations in prod) and MIX_TARGET for deployment concerns, to differentiate between things like demo, QA, staging, prod, etc. Those normally get deployed as prod builds, but can be deployed as dev builds if extra visibility is needed.

linusdm

linusdm

Welcome @unaware8150 :waving_hand: and great first question!

— All posts loaded —

Where Next?

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement