simon

simon

General Architectural Advice For A Ported Application

I’m looking for some general, high-level architectural advice and opinions because I want to port a system over to Elixir which is currently written in Node (data processing server) and the meteor JavaScript framework (web interface). Sorry that this is such a long post!

I have a number of devices which send data to a server via TCP. We also have data coming in over HTTP which comes from things like an SMS service, webhooks from MailGun, etc. Incoming data is stored in a database after it has been validated and processed. At the moment this is all done on servers running Node.

There is also a web application which allows users to log in and view data as well as allowing administrative users to set up and manage devices, etc. This is currently a Meteor-based system.

We also have a basic API so that an iOS app can interact with the system and the API is part of the Meteor application (it was 50/50 as to whether it should be part of the Node system but credential authentication was easier if it was part of the Meteor application).

In Elixir I think that I will need the following but this is where I need some advice before I head too far down the wrong path:

  • A database application which is an Ecto ‘layer’. It will contain schemas and data management functions and essentially be an API for everything else to use to centralise database access.
  • An Absinthe GraphQL application which will be used to allow external systems to interact with the system. For example, the iOS application will use this as and we could also allow third parties to use it to retrieve data for reporting purposes, etc.
  • An incoming data application which will use Cowboy to handle HTTP data for things like the incoming SMS data and webhooks.
  • Incoming data applications which will use Ranch to create TCP servers for incoming device data. Rather than having a single server as I did i the Node application it would make life easier to have several of these, one per device type so that I can simplify parsing data from different device types rather than having to determine the type of incoming data first and then parsing it accordingly.
  • A Phoenix application which will be the web application for viewing data, managing devices, etc.

I’m sure that some of these could be rationalised and merged (a single Phoenix application could, I think, encapsulate Ecto, Absinthe and the Cowboy functionality) but I want to be able to scale functional areas separately. In the current system, mainly for redundancy, we have two servers running the Node data processing code which sit behind a load balancer and we have two servers running the Meteor application, again sitting behind a load balancer. We have separated the data processing from the web application because the volume of devices reporting in will always grow much faster than the number of operators using the web application so we want to be able to add more data processing servers without having the overhead of having to add more web application servers.

At the moment my thoughts are to have incoming data processing handled on a server which runs an application which supervises an instance of the Cowboy application and instances of the Ranch applications The Cowboy application and the Ranch applications would all use the Ecto application for database access.

The web application server would be a Phoenix application which use the Ecto application for database access.

The API application server would be an Absinthe application which also uses the Ecto application for database access. I’d like to separate this from the Phoenix application, again for scalability but also so that if the Phoenix server(s) went down there would still be access via the iOS app (and vice versa). Am I right in thinking that Absinthe doesn’t need Phoenix and can use Plug instead?

Does that all sound reasonable or is there a better way to structure things?

Can I separate my Ecto application from Phoenix and Absinthe in the way I’m thinking I can?

I really just want to be as sure as I can that I’m not starting off down the wrong path.

Most Liked

simon

simon

To help others who might find it useful, my searching skills were obviously lacking because I’ve just come across another forum post about this sort of thing which gives some great advice and opinions.

Where Next?

Popular in Questions Top

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
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
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
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
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
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
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
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
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
hariharasudhan94
I would like to know what is the best IDE for elixir development?
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
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
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
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement