vitaminwater

vitaminwater

Umbrella project: applications inter communications, direct function call or message passing?

I’m working on a project that involves a phoenix frontend, an ecto backend, and scrappers.

The project is generated with phoenix 1.3 umbrella generator. So the frontend directly calls functions in the backend, and has the backend present in its deps, with in_umbrella option. Which I can understand as being a good solution as long as they are both on the same node.

Now I’m adding my scrappers, they should be able to interact with the backend, but it is not going to be on the same node. I need my scrappers to be able to move on different nodes, for example in the case when their IP address gets banned.

So if I understand right, I can’t add the backend in the scrappers’ deps, or it would start the backend app in the scrappers nodes. (Actually I’m not even sure that would be a problem…)

I wondering if I’m meant to create a GenServer in the backend that would act as some sort of a proxy for the nodes that can’t directly call its functions ? (and then add the backend in the deps, with the apps: false option)

Which also poses the question in the case where you’d like to have both phoenix frontend and backend on different nodes ?

Most Liked

vitaminwater

vitaminwater

Thanks for the article Qqwy.

My question is more like: “If i’m forced to split my apps across nodes, what is the best to do in my case ?”

And my case is as follows:

I have 3 apps in an umbrella project.

- backend
- backend_web
- scrapper_ikea

I know that I should be able to split scrapper_ikea on separate nodes, mostly to have multiple instances in parallel with different IPs.

So now I’m wondering if I should have {:backend, in_umbrella: true} in the scrapper_ikea app ?
If understand correctly this would start the backend app too, which (as of now) is only my Ecto repo, doesn’t seem like too much of a problem to have multiple repos instances running on multiple nodes, right ?

Another option would be to have {:backend, in_umbrella: true, app: false} in the scrapper_ikea app ?
Then the backend app is not launched, but if I got it right means I’m not going to be able to interact with the database, and I’d only be able to call functions as long as they don’t rely on a particular process being present.
Which leads me to thinking, maybe I should have a GenServer launched with the backend application, that is only there to proxy calls to the repo, for use by the scrapper instances.
This way, I’d still be able to interact with the repo from the scrapper apps, but only through the GenServer API, which is kind of strange, as I’d have to depend on an app where most code is not usable… so maybe make a fourth app, only there to have this glue/proxy code ?
As you can see I’m quite deeply confused as to how to do all this.

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
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
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
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
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
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

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
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
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
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
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
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 27727 240
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement