What is the best way of running a Phoenix server in cluster mode in AWS ECS?
It seems to me like a common problem. I plan to use a libcluster library, but I’m wondering if Phoenix provides anything out of the box.
Also I’m not a devOps, so I don’t completely understand why libcluster offers UDP multicast to 126.96.36.199 for a Gossip strategy… All I found so far are blog posts about creating a lambda that registers new nodes in a cluster, or using some patterns in naming EC2 instances, etc. Any recommendations?
Here’s my config block:
config :clove, :cluster_topology,
# EnvMap is just System.get_env or raise
# Should match what's in vm.args / distillery
I then pass in
aws:cloudformation:stack-id as the ec2 tag name, which is the same for all ec2 instances in the cluster.
Now, there’s an important caveat that I use 1-1 mapping between ec2 instance and running application instance. So, I’m assuming that this will work if it’s 1-many, but I can’t guarantee that.
See ClusterEC2.Strategy.Tags — libcluster_ec2 v0.6.0 for the strategy