Here's the thing, I have an umbrella project, with a dozen of OTP apps inside. Currently it's been deployed to single server. We want to deploy it to multiple nodes and turn this thing to a distributed organism.
While the deployment part seems to be pretty neatly handled by distillery, we'd also like to replicate the production environment as closely as possible locally. This means, we'd like to start the same number of nodes when in development, make sure our global name registrations work and we have things neatly decoupled. This all, while not loosing some of the productivity advantages, like Phoenix code reloader, or assets bundler.
Ideally, I'd go to my
umbrella_root/, run a single mix command and it'd bring up the whole system, with N nodes, and M applications running on them.
How would you get this done?
I see two options:
Use distillery locally. Write a shell script that builds a distillery :dev release. In theory, I think combination of
dev_mode=true and a custom watcher for file changes should pick it up, compile, symling the beam files to release directory and this should allow Phoenix auto reload to work. Then, one would need to do the same with assets, start a custom watcher that'd watch, compile assets with bruch and symlink as needed. @bitwalker has this ever been done with distillery?
Write a Mix task, that would start N nodes in the cluster, start appropriate applications on each node. This task would have similar code to: https://github.com/sschneider1207/distributed_test/blob/master/lib/distributed_env.ex
which is a library that starts N nodes, loads applications there and runs tests in parallel this way.
1 or 2? Or maybe you have better ideas altogether?