- Elixir Cluster
How to deploy & cluster Elixir on Hop
Using libcluster with the libcluster_hop strategy, you can easily create a clustered Elixir application on Hop. All nodes (containers) will be connected to each other.
We have created a demo application that you can deploy to Hop to see how it works. It’s a simple Elixir application that uses the
libcluster_hop strategy and exposes a simple HTTP API which lets you see the nodes connected to each other.
Deploying the demo
- Fork elixir_cluster on GitHub.
- Obtain a project token for your Hop project. libcluster uses this to fetch the list of nodes in the cluster using the Hop API. Make sure to select the
Manage Deploymentspermission when creating it.
- Create a new Hop deployment on the Console and select the GitHub repository you just forked.
- Set the following environment variables before deploying:
|The project token you obtained in step 2|
Deployand wait for the build to finish.
- To expose your application to the web, create a Gateway and point it to port
That’s it! You’re now able to scale your Elixir cluster and containers will automatically discover and connect to each other.