smon

smon

How to add an app specific releases.exs configuration in umbrella project?

I am currently writing my first umbrella project. One of my apps is an API and I use a basic releases.exs to set its HOST domain using an environment variable:

import Config

config :my_api,
  host_url: System.fetch_env!("HOST")

The downside: Now all other release builds expect a HOST variable, which is unnecessary. What is the recommended pattern for this? I want to enforce the check in my API app, so currently I just add an unused HOST variable for all the other apps.

Any suggestions?

Marked As Solved

LostKobrakai

LostKobrakai

From the docs of mix release:

You can change the path to the runtime configuration file by setting :runtime_config_path inside each release configuration. This path is resolved at build time as the given configuration file is always copied to inside the release:

releases: [
  demo: [
    runtime_config_path: ...
  ]
]

You could therefore maintain multiple configs if one doesn’t suite your needs.

Also Liked

trisolaran

trisolaran

Thanks for the clarification.

My view is that if you need multiple apps that have to be started independently with different environments, then an umbrella app is probably not the right idea :slight_smile:

I think there are different use cases for umbrella apps, but to me the typical one is when you have a number of apps depending on each other and that have to be started as a whole. In this case it makes sense and it’s more convenient to have a single configuration and a single environment to start the whole application bundle (by a similar token, when you install a hex package the application in the package also shares the same configuration with your main app).

Creating an umbrella app and then splitting the start-up and configuration logic feels like an anti-pattern to me - probably better to split the apps into multiple stand-alone ones which you can then start independently.

smon

smon

I get what you mean, maybe some background:

In my case the apps are closely coupled in the sense that, code wise, they are all using one central “core”-app that is also in the umbrella. I want to ensure that all apps are kept aligned with each other, running their tests on the same “core” app code.

Originally, I had only one app that managed everything (-> one single supervision tree). But I want the API app, for example, to run really stable, and be completely independent of data aggregators that harvest external resource over the net and are more prone to errors.

So I moved to an umbrella project (-> API has now its own supervision tree).

I could of course move further and split everything up into separate repositories, but then I have more hassle keeping everything aligned and tested. I’d rather have one separate runtime configuration for the time being. :wink:

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127089 1222
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement