hubertlepicki

hubertlepicki

Starting up local cluster of nodes for local development

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

Marked As Solved

hubertlepicki

hubertlepicki

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.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement