thamurath

thamurath

How to use Umbrella projects properly

Hi all,

I am pretty new to Elixir. I have been reading some books and articles and now I want to work on some project to settle the concepts.

I have a project based on microservices, that I would like to replicate in Elixir.
I thought umbrella projects were a good way to go as services could be almost mapped to applications, but there is something I am not getting.

Kafka is the entry point for the application and I thought on using Kaffe as library to handle it.
I need to “consume” multiple topics with different information so different services handle the messages but, as all the apps have to use the same configuration I do not know how to configure Kaffe differently for each application.

It seems it is a common pattern to use apps instead of libraries in Elixir so, Is there any way to define different configurations for Kaffe?

There are multiple things here:

  • I feel there are things I do not get regarding Umbrella projects … What are the useful for? I have been looking for documentation regarding this type of projects but found nothing interesting.
  • Application configuration: All the applications inside an umbrella project use the same config.exs file, but each one should define its own dependencies and applications that should be up & running for them to work, but they should share the dependencies … I do not get why I cannot define the dependencies directly on the root project

I like the way umbrella projects allow me to have different applications while having just one repo and be able to deploy everything using releases, but:

  • I need more information regarding how and when to use umbrella projects
  • I do not know how to read custom configuration and how to configure an application I depend on differently for each application in an umbrella project.

Sorry for the loooong post.

Thanks in advance your time, any information will be really appreciated.

First Post!

stefanchrobot

stefanchrobot

I would suggest avoiding configuring your app via config.exs - this is a build time configuration. Granted, some libraries make it harder than others, but you should generally favour runtime configuration. Seems like Kaffe supports that with start_link/4 - pull it from ENV, not config.exs.

Given that, it seems umbrella apps might not be what you need:

Don’t drink the kool aid

Umbrella projects are a convenience to help you organize and manage multiple applications. While it provides a degree of separation between applications, those applications are not fully decoupled, as they share the same configuration and the same dependencies.

The pattern of keeping multiple applications in the same repository is known as “mono-repo”. Umbrella projects maximize this pattern by providing conveniences to compile, test and run multiple applications at once.

If you find yourself in a position where you want to use different configurations in each application for the same dependency or use different dependency versions, then it is likely your codebase has grown beyond what umbrellas can provide.

I think you’d be good with just a common lib and multiple projects.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
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
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
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 126479 1222
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement