Starting up local cluster of nodes for local development

Tags: #<Tag:0x00007f11420c1c50> #<Tag:0x00007f11420c1a70>


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:

  1. 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? :slight_smile:

  2. 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:
    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?


I would recommend something like Terraform ( and a cloud computing provider to fire up actual infrastructure. The same scripts could work in a development environment as they might in a production deployment.


Ok, so the solution to the problem above is not to use umbrella project for distributed Elixir application at all.

Instead, use stand alone applications, script it up with custom startup scripts for development.