Skip to content

OTP Labs is a demo application built with Elixir and OTP to show how to integrate Distributed Elixir on Kubernetes with Horde and LibCluster.

License

Notifications You must be signed in to change notification settings

pahagon/otp-labs

Repository files navigation

OTP Labs

OTP Labs is a demo application built with Elixir and OTP to show how to integrate Distributed Elixir on Kubernetes with Horde and LibCluster.

This project ties up:

  • Elixir Application with:
    • Libcluster Supervisor.
    • Horde Supervisor and Registry.
    • Node Observer. GenServer that make Horde Cluster update when node goes up or down.
  • Libcluster config:
    • You can choose libcluster strategy(gossip or local epmd) from environment var.
    • You can add more libcluster strategies.
  • Dockerfile:
    • Create an app image using linux alphine.
  • Kubernete Deployment and Service file:
    • Deployment file:
      • Creates pods with app image, exports pod_ip, namespace and cluster_strategy (default: gossip).
      • Exports epmd port.
    • Service file:
      • Creates a cluster.
      • Exports empd port to all nodes.
  • Elixir Release config:
    • Project sname configured using the following pattern @release.name@POD_A_RECORD.$NAMESPACE.pod.cluster.local.
  • Makefile with tasks:
    • Run locally single-node.
    • Run locally multi-node.
    • Build docker image.
    • Run locally on docker.
    • Load docker image on minikube.
    • Create deployment and service on minikube
    • Remove docker image from docker, remove deployment and services from minikube

Setup local environment on Ubuntu

There is ansible recipe that helps setup local environment.

First, you should intall ansible ;)

$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible -v 2.9.6

Use this setup in your project

Create a project with all this things using otp-labs project template.

Real world example

The distributed application meal planner called Umamify

References

About

OTP Labs is a demo application built with Elixir and OTP to show how to integrate Distributed Elixir on Kubernetes with Horde and LibCluster.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published