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: distributed_test/lib/distributed_env.ex at master · jschneider1207/distributed_test · GitHub
    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

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
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 I...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
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
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement