Hey folks, asked this on Slack and may have gotten an answer there, but I’m a screen reader user and Slack is a bit of an accessibility nightmare. So I may have missed it.
We’re currently refactoring a monolithic Phoenix app into an umbrella. The impetus is that we need two closely-coupled web apps. One runs online and is available over the open internet. The other runs in a VM appliance, on-prem. Ultimately they’ll share lots of common code, but the on-prem version won’t include a number of features that only make sense on the open internet, and will also use a different storage layer that can more effectively handle failed upgrades without needing a database rollback. Currently we have apps/web for the web interface, apps/vm for the VM appliance, and apps/shared for code that I manage to share between the two. Eventually I’d like to keep as much in apps/shared as possible, but there’s unfortunately a bit more duplication than I’d like right now.
One issue I’m hitting is with multiple web apps in a single project. I have apps/vm and apps/web. In local development, I can cd apps/vm && mix phx.server
. But I’m having trouble running cd apps/web && mix phx.server
, because apps/web has many more dependencies. In particular:
$mix phx.server
...
== Compilation error in file lib/web/controllers/auth_controller.ex ==
** (MatchError) no match of right hand side value: :error
lib/ueberauth.ex:368: Ueberauth.get_providers/2
lib/ueberauth.ex:239: Ueberauth.init/1
(plug) lib/plug/builder.ex:304: Plug.Builder.init_module_plug/4
(plug) lib/plug/builder.ex:288: anonymous fn/5 in Plug.Builder.compile/3
(elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
(plug) lib/plug/builder.ex:286: Plug.Builder.compile/3
(phoenix) expanding macro: Phoenix.Controller.Pipeline.__before_compile__/1
lib/web/controllers/auth_controller.ex:1: Web.AuthController (module)
That’s a brand new error. My non-umbrella app didn’t throw this, and running mix phx.server
from the top-level directory doesn’t either, but then I don’t necessarily know which web app is running or how to reach one and not the other. It only seems to surface when I run the web app from its directory. Ueberauth providers are listed in config/, and that file may not be findable if I run the app from within its directory.
So in this instance where I’m trying to build two web apps from the same umbrella project, is it possible to run a single app at a time? Or do I have to assign them different ports? Hoping I can run only a single app, since our full web app relies on bunches of services I’m not running locally, and I’d have to bring up the full development environment just so it’d have something to connect to and not use.
Thanks.