How to manage multiple Phoenix app configurations?

I have multiple Phoenix apps and a MainProxy app. Each Phoenix app comes with their own configuration and database. The MainProxy app is basically an app that proxies requests to right Phoenix endpoint. All apps live in their own repo.

  1. Is there a way to manage Phoenix app configurations without having to redeclare all its configurations in MainProxy app?
  2. How to manage conflicting Phoenix app configurations? For example, each Phoenix app has its own Tailwind config.

Config is global to the VM running, so you eventually need to merge config of all applications you intend to run in a single VM. That’s also the reason why umbrella mix projects got rid of app level configuration, because it simply cannot exist that way at runtime.

1 Like

That makes sense. In that case, how do people normally use main_proxy? What’s their setup like?

I must be missing something, but what would be wrong with building N+1 releases, where N is a number of apps? Each release would have each own Erlang VM started.

Then MainProxy would not need any config but routing, and apps’ configs would have been completely separated.

The only concern would be threads per each app, but unless we are talking highload here, it should not be a problem.

Can I assume you’re saying nginx or similar is used to proxy requests to multiple Erlang VM nodes?

I’m using main_proxy to proxy requests to Phoenix endpoints on a single Erlang VM node.

Not anywhere near highload. So, I want the apps to be on a single machine.

Yes, that would work too, AFAICT.

If you try to run more than a few non-trivial applications in one release, then merging configuration is not your biggest problem. Soon, you will hit version incompatibility between 2 apps. You’d better go with multiple releases like others have suggested.

If you run a few applications mostly written by you, and maybe one 3rd party application, then the setup of one merged release is a good solution and will save you memory. I’d assume merging configuration is not hard to do in this situation.

1 Like