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

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Tee
can someone please explain to me how Enum.reduce works with maps
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
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
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
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
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
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

We're in Beta

About us Mission Statement