Today I Learned - Controlling startup of in_umbrella dependencies in Elixir 1.9 releases

Today I learned something useful about managing dependent application startup in umbella apps in Elixir 1.9 mix release.

I have an umbrella application containing two sibling applications, AppMain and AppDerivative. I want to deploy these two applications in two different locations, with AppDerivative depending on AppMain but not starting AppMain.

However when I built a release for AppDerivative with AppMain as a dependecy, AppDerivative was started with all other application dependencies. So, I want AppDerivative to have access to AppMain, but run without starting AppMain.

To accomplish this with Elixir 1.9 release I had to configure the releases section of the parent umbrella app mix.exs like so


defmodule UmbrellaApp do
  use Mix.Project

  def project do
    [
      releases: [
        app_main: [
          applications: [app_main: :permanent]
        ],
        app_derivative: [
          applications: [app_derivative: :permanent, app_main: :load]
        ]
      ]
    ]      
  end
end

So I now have access to useful code like AppMain.lpad/2 from the AppDerivative application without starting AppMain.

11 Likes