nduitz

nduitz

Elixir-desktop as part of a cluster?

Hey Folks,

I was very excited to learn about elixir-desktop. Thanks for your work :slight_smile:

So I was wondering if elixir-desktop could be used to more easily implement a webapp that also runs on desktop and has some offline functionality.

Normally you would have a stack like this:

  • Server Backend (e.g. Phoenix)
  • Web Frontend (e.g. Phoenix)
  • Electron App (e.g. React)

To connect the Electron app you would be required to implement an API and the syncing process would be rather obnoxious.

My question is regarding clustering. Maybe I have some mistaken thinking regarding the concepts.

The way I see it you could have one code base with certain parts conditionally starting based on wether the code is running on a sever or a desktop client.

Now the question:
Could you join the desktop app to your distributed elixir cluster as soon as it is online? Would you need some sort of wireguard setup (this is where I lack experience) between the clients and the server to ensure the connection?
As soon as your client is joined you could act on live data and sync any changes the client has been made offline.

If that could be possible I see a lot of potential in a setup like that :slight_smile:

Thanks,
Nick

Most Liked

tj0

tj0

I think you might be looking for “local-first” software. Many of these are based on CRDT replication. An elixir based one is https://electric-sql.com/

Also, a recent talk:

dominicletz

dominicletz

Creator of Elixir Desktop

Hey @tj0, author of elixir-desktop here. “local-frist” was also my initial read your the question:

For a local first application there are many ways to sync data with others but two obvious ones are:

  1. Star topology with a single server somewhere
  2. Peer-To-Peer mesh topology without any centralized servers

Using standard Elixir tooling (and elixir-desktop) it is really easy to archive 1. - You can have your local copy of the data that is needed when the client is not connected in a local SQLite database, this is also what the desktop-example-app is doing and then when you’re connected you can call your server API to fetch new data or upload data.

For 2. which is definitely more involved we (my company) developed an elixir library that allows creating end-to-end encrypted connections between any two peers on the internet. GitHub - diodechain/diode_client_ex: Elixir SDK for the diode network · GitHub it’s pretty low level and exposes raw :ssl streams. So I can’t really recommend this for high productivity at the moment.

CRDTs are probably the future here, especially for mesh networks but from the top of my head I’m not aware of a library that I could point you to there.

Hope this helps a bit,
Cheers!

LostKobrakai

LostKobrakai

In theory this is surely possible. It’s TCP connections between nodes.

In practise clustering is not build for that usecase. Most importantly there’s no security boundries between clustered nodes. But also Node naming can become tricky with various networks involved. By default beam clustering uses a full mesh, so all the desktop apps would want to connect to each other as well (just just to servers).

Where Next?

Popular in Questions Top

tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
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
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
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
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

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 48475 226
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
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
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
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
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
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement