dwyl / learn-elixir

:droplet: Learn the Elixir programming language to build functional, fast, scalable and maintainable web applications!
1.6k stars 107 forks source link

Umbrella Apps? #79

Open nelsonic opened 6 years ago

nelsonic commented 6 years ago

Elixir Umbrella - Microservices or Majestic Monolith? Georgina McFadyen - Elixir.LDN 2017 image https://youtu.be/jhZwQ1LTdUI

nelsonic commented 5 years ago

Good discussion/thread: https://elixirforum.com/t/how-do-you-use-umbrella-apps-and-why/14850

nelsonic commented 4 years ago

https://cultivatehq.com/posts/elixir-distillery-umbrella-docker Shared in https://github.com/dwyl/phoenix-chat-example/issues/34#issuecomment-566739845

nelsonic commented 2 years ago

Hi @SimonLab 👋 on Friday we verbally discussed that you were investigating Elixir Umbrella Apps. My interest in this topic is both an intellectual curiosity and (more importantly) a practical use case.

Specifically:

We want to run at at least 2 (but more likely 3+) Phoenix Apps on the same VM (e.g. EC2 or Fly.io) both to save on cost but more importantly to save on DevOps (deployment, monitoring etc.) complexity if possible.

In the short-run those 3 apps will be:

  1. Auth: https://github.com/dwyl/auth
  2. Admin: Admin interface for managing people in the App, separate as reusable by others and not "core" to our App.
  3. ATM: our to-be-built Anonymised Analytics Platform

We want to run in the same umbrella for DevOps simplicity but which needs to be its' own separate Apps for development purposes.

I was also reading up on this topic recently: https://medium.com/@cedric_30386/how-to-build-multiple-apps-in-elixir-thanks-to-umbrella-part-1-why-elixir-ce27ccb637e3

Apologies for not sharing in the thread. We really need to get better at remembering to share what we're learning. We are better than 95% of orgs/companies who either don't share anything at all or share haphazardly in ephemeral chat like Slack ... but still not where we need to be. We need to fix our learning tracking/sharing ASAP! 💭 For now, issues! 🙄

nelsonic commented 2 years ago

@SimonLab where do you feel the most appropriate place to document this is? 💭

SimonLab commented 2 years ago

I think I can create an "Umbrella" section on the Readme of this repo. We can also add a short umbrella explanation on the different Elixir projects where we use it.

I like the following descriptions:

Internal dependencies are the ones that are specific to your project. They usually don’t make sense outside the scope of your project/company/organization. Most of the time, you want to keep them private, whether due to technical, economic or business reasons.

However, if you push every application as a separate project to a Git repository, your projects may become very hard to maintain as you will spend a lot of time managing those Git repositories rather than writing your code.

For this reason, Mix supports “umbrella projects”. Umbrella projects are used to build applications that run together in a single repository. That is exactly the style we are going to explore in the next sections.

see https://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-projects.html#internal-dependencies

I can see the reason to use umbrella applications to simplify the DevOps part. This would need to be tested and make sure we won't have any blockers as:

all configuration and dependencies are shared across all projects in an umbrella, and it is not per application.

So if one application needs to be configured differently we might possibly have some issues on the devops side, again something to test and to be aware but it might be fine and not be a problem.

We need to fix our learning tracking/sharing ASAP!

:+1: I'm not sure what would be the best practices/tools for that. At the moment we create issues to share vides/articles..., however we don't have a way yet to let other know, how relevant, useful, "out of date" a resources is. We don't have either one place where we can find all these links (maybe we simply need to update the Readme)

nelsonic commented 2 years ago

@SimonLab for now I think we can deploy each app independently for speed. 🏁 But if we want to use the [auto?] scaling facilities of Fly.io at some point umbrella apps make more sense. 💭