navaneeth

navaneeth

How to communicate to a Elixir app from another Elixir app?

I have 2 long running Elixir applications. I have another phoenix application which acts like a dashboard for these 2 applications.

In the dashboard, I wanted to show the running status of these 2 applications. This is just to figure out all the components in the system are up and running.

From this dashboard, I also wanted to trigger some actions on these applications. To achieve this, I am thinking about doing the following:

  1. Each application exposes a HTTP API (planning to use plug)
  2. Dashboard does HTTP requests to these APIs and display the status accordingly
  3. This way, actions can also be triggered on the remote process.

There are many advantages for this design. This is simple to implement, the processes that the dashboard wants to monitor can be in separate machines, etc.

I am wondering, is this the best approach to follow. Or is there a different approach which can be followed.

Thanks

Most Liked

Crowdhailer

Crowdhailer

Creator of Raxx

that would be my go to. however as you mention each app is on a separate machine a http api would not be a bad idea. particularly if those services need to expose a http api to other clients anyway.

Crowdhailer

Crowdhailer

Creator of Raxx

If you put both applications in a single umbrella application then you won’t have to communicate over an HTTP API. You could just send erlang messages for communication.

navaneeth

navaneeth

Thanks.

It is already in an umbrella project. If I understood you correctly, this what you are saying,

  1. There are 3 projects, A,B,dashboard
  2. A is started on machine1 with a node name a. This also starts a supervised process with a name registered globally status-handler.
  3. B is started on machine2 with a node name b. This also starts a supervised process with a name registered globally status-handler.
  4. Dashboard is started on machine3 with a node name dashboard
  5. When dashboard starts, it runs Node.connect to a and b to form the cluster
  6. Dashboard sends message to status-handler running on each connected node

Did I get that right?

Thanks for your help.

Where Next?

Popular in Questions Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
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
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
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 Postg...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement