Rewriting my Protohackers repo as an umbrella app
My existing setup for my protohackers problems repo with one big application running a bunch of smaller servers each with their own domains was getting quite unwieldy.
To create a new Protohackers challenge app I had to manually create a bunch of files including tests, add yet another child to my global application supervisor, and update my fly.io config to open yet another public facing port.
That was managable when I only had two or three servers and each was self-contained in one file, but growing unwieldy as the challenges were better served by more complex applications with multiple modules.
With an umbrella app setup I can choose which application I actually want to run on fly.io at deploy time by editing the Dockerfile. My fly.io config is more simple with only port 5000 (tcp) or port 6000 (udp) forwarding to whichever application port I’m running.
To create a new application for a new challenge I only have to cd into apps and create a new app using mix.
mix new APPLICATION_NAME --sup
Thanks again to @whatyouhide for providing a great example of how to organize the repo. I haven’t ever actually used an umbrella app and I’ve found the setup to actually be quite nice.
Umbrella apps have a rather dim reputation but in this instance they work very nicely. Each app is configured using the top-level config but still isolated to its own application space. I can run all of the tests at once or only the tests for specific applications. I can still easily run all of the applications at the same time in both dev and test which is very handy since my “Mob in the Middle” integration tests actually use my “Budget Chat” application.
a8bbfa9ea25a511a69f57a5bfe73f43493def400 on sdball/protohackers