A short overview of Umbrella Apps

Erik Nilsen

@enilsen16

What I am going to Talk About

  • Microservices and my thoughts
  • Talk about how other languages can be used for a similar approach
  • Umbrella Apps and look at a few examples

Microservices

  • Lightweight
  • Combined together serve a larger goal
  • Allows multiple languages to work together

Great!... Oh...

  • 1500+ Microservices in prod
  • Created a bad culture...
  • Unsure what they do
  • Things like logging became extremely difficult
  • Teams had to rely on others documentation

Well what are the other options?

  • Monoliths
    • Facebook takes a similar approach
  • Break apps into multiple pieces but run on a central server
    • Django
    • Rails

Umbrella Apps

  • Run tests in multiple apps
  • Run the entire app as one or each piece individually
  • Logically split up multiple apps, but keep them under one git repo

 

 

Elixir Guides Reference

Examples

├── .gitignore
├── .iex.exs
├── .travis.yml
├── LICENSE.md
├── Procfile
├── README.md
├── _build
│   └── dev
├── app.json
├── apps
│   ├── auth
│   ├── backoffice
│   ├── bank
│   ├── bank_web
│   ├── master_proxy
│   ├── messenger
│   └── money
├── compile
├── config
│   └── config.exs
├── docs
│   ├── diagram.png
│   └── main.md
├── elixir_buildpack.config
├── mix.exs
├── mix.lock
├── phoenix_static_buildpack.config
└── script
    └── diagram.exs
  • Two Web Apps
    • Bank Web
    • Backoffice
  • Logic Specific Apps
    • Money
    • Messenger
    • Bank
  • Deployment App
    • Master Proxy

Approach

Phoenix 1.3 Umbrella

  • Wanted a similar approach
  • Going to multiple web applications
  • Break entire DB into its own app
  • Needed to work either together or individually
  • Also needed to work on heroku

What we wanted

Nifty

  • Master proxy also calls multiple web apps
  • Avoids circular dependencies
├── .gitignore
├── .travis.yml
├── Procfile
├── README.md
├── _build
│   ├── dev
│   └── test
├── apps
│   ├── agent_web
│   ├── auth
│   ├── company_web
│   ├── hook
│   ├── master_proxy
│   └── nifty_db
├── compile
├── config
│   └── config.exs
├── elixir_buildpack.config
├── erl_crash.dump
├── mix.exs
├── mix.lock
└── phoenix_static_buildpack.config

Avoid starting an app multiple times

  def start(_type, _args) do
    import Supervisor.Spec

    # Define workers and child supervisors to be supervised
    children = [
      # Start the endpoint when the application starts
      supervisor(AgentWeb.Web.Endpoint, []),
      # Start your own worker by calling: AgentWeb.Worker.start_link(arg1, arg2, arg3)
      # worker(AgentWeb.Worker, [arg1, arg2, arg3]),
    ]

    repo = if :erlang.whereis(NiftyDB.Repo) == :undefined, do: [supervisor(NiftyDB.Repo, [])], else: []
    # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: AgentWeb.Supervisor]
    Supervisor.start_link(children ++ repo ++ guardian_db, opts)
  end

Exploration Ideas

  • Try an umbrella app where BEAM starts multiple apps from different languages
    • Python
    • Ruby
    • Rust?

Umbrella Apps Don't Solve all Your Problems

You still need to architect correctly :)

Questions?

Short Overview of Umbrella Apps

By enilsen16

Short Overview of Umbrella Apps

  • 821