I’m playing with designing a multi-tenant SaaS pet project using the Control Plane / Application Plane model. There will probably be two main web apps (control and application planes) in Elixir/Phoenix. The control plane will run on a single node (private network, not accessible from the internet, separate DB), while the application plane will be multi-node (accessible from the internet, separate DB).
The question I have is how to enable communication between these two planes/apps. Most examples I’ve found focus on microservice architectures based on HTTP APIs. Others suggest message queues or event buses. Given the strengths of BEAM, I’m wondering:
What are the options BEAM-native or preferred mechanisms for loosely coupled communication between two Elixir applications?
Looking forward to insights from anyone who has tackled something similar!
What are the options BEAM-native or preferred mechanisms for loosely coupled communication between two Elixir applications?
The only thing i can think of is messages between processes through distributed Erlang. But as soon as you connect your control plane node to the application nodes/cluster they will have full access to your control plane node.
If they’re not clustered, you’re outside of the BEAM native umbrella aren’t you? Then you can choose between HTTP, Websockets, grpc, etc.
I’ve used Phoenix channels to do multiple client to server connection using Slipstream. I wanted to know when they’re connected and channels provided the tools for that.
Thank you for the ideas. I´m going to do my homework and investigate the Phoenix channels option. I’ll deploy in AWS, so SQS may be the best option to keep them completely decoupled.
As @schneebyte points out, you absolutely do NOT want your control plane node joining the cluster of the application nodes; the BEAM VM excels at many things but refined access controls is not one of them – that new node will have full access. From your description it seems you don’t want that so indeed go with SQS or any other external and decoupled message-passing solution.