I have two Phoenix web app in an umbrella project: admin and front. I will probably add another web app blog soon.
I added :front app as a dependency in the :admin app so I can generate urls to the “Front website”. This work fine as long as I start the Phoenix server ever:
only from the admin app root
only from the front app root
or from the umbrella project root
In the last case both apps are available in the browser at http://localhost:4000/ and http://localhost:4001/. If I try to start the apps separetely, the last I try to start will fail with the following error:
03:48:13.459 [error] Failed to start Ranch listener Front.Endpoint.HTTP in :ranch_tcp:listen([cacerts: :…, key: :…, cert: :…, port: 4000]) for reason :eaddrinuse (address already in use)
So I vaguely understand that there is something like a listening conflict on a port?
But when starting the server from the umbrella perpective, put in simple words, why is it working?
And more importantly should I be aware of a potential issue in the future? I mean as long as it’s ok for me not to deploy the apps separately.
You say that one app depends on the other, so if you start that app, it will also try to start the other. Though if you have the other already up and running in another BEAM instance, then of course that port will already be in use.
It should be enough to start the app that depends on the other, to access both applications, or to start from the umbrella.