jfrolich
Did anyone successfully set up ECS using distributed Elixir? I am tackling this right now.
I am especially interested how to connect the nodes. I was thinking it might make sense to write a custom libcluster strategy that fetches the current ip’s connected to the Application Load Balancer. ECS also offers service discovery using DNS, so that might also be a solution (this creates an A record for each node) and there seems to be a DNS strategy already in libcluster.
As far as I know these are the things to be addressed:
- Setting the node name to:
<APPNAME>@<PRIVATE IP> - Exposing the Port Mapper Daemon port in the VPC and docker image (4369)
- Exposing the intra-erlang communication ports (configurable using inet_dist_listen_min, inet_dist_listen_max) in the VPC and the docker image
- Service discovery (setting up communication between nodes) using a libcluster strategy
Setting the hostname to include the private IP can be done by using curl http://169.254.169.254/latest/meta-data/local-ipv4, not sure yet how to best inject this as a env variable.
Perhaps anyone already has figured some of this out on ECS/EC2? Help really appreciated! Planning to document the results so it’s easier for other to get this up and running. I already have some experience building a very small docker image using releases and multi-stage builds.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Most Liked- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
quolpr
Btw, now ECS support DNS service discovery out of the box.
I just used libcluster/lib/strategy/dns_poll.ex at master · bitwalker/libcluster · GitHub and it works well.
My vm.args:
My start.sh:
The DNS name can be taken from service details page. Usually it is
my-service-name.local. Use it asqueryforCluster.Strategy.DNSPollstrategydrewble
I struggled with this for a week and eventually got it working. The information in this thread is enough to point in the right direction, but there is a big gap between the right direction and a successful deployment.
I’ve written up a fresh guide on deploying distributed Elixir to ECS Fargate tasks with Service Discovery and libcluster’s DNS Polling strategy. Hope it helps save someone some time!
schrockwell
You have hit on the major points. For the hostname, I can offer a concrete example. In the script that starts my application:
Then in
rel/vm.argsyou can set the node name using the env var:Last Post!
acrolink
Does the same applies for Elastic Beanstalk with applications deployed using Docker?