# LibclusterGCE
[![Build Status](](
[![ version](](

This is a Google Compute Engine (GCE) clustering strategy for [libcluster]( 
It currently supports identifying nodes based on compute engine labels.

## Installation

Add `:libcluster_gce` to your project's mix dependencies.

def deps do
    {:libcluster_gce, "~> 0.0.1"}

## Deployment Assumptions

Clustering will only apply to nodes that are accessible via the [GCP internal DNS](
If this doesn't fit your deployment strategy, please open a Github issue describing your deployment configuration.

## Configuration

To cluster an application running in Google Compute Engine, define a topology for `libcluster`.

# config.exs
config :libcluster,
  topologies: [
    my_app: [
      strategy: ClusterGCE.Strategy.Labels,
      config: [
        project: "my-project",
        labels: %{
          "env" => "prod"

Make sure a cluster supervisor is part of your application.

defmodule MyApp.App do
  use Application

  def start(_type, _args) do
    topologies = Application.get_env(:libcluster, :topologies)

    children = [
      {Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]},
      # ...
    Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)

Update your release's `vm.args` file to include the following lines.

## Name of the node

## Limit distributed erlang ports to a single port
-kernel inet_dist_listen_min 9999
-kernel inet_dist_listen_max 9999

Run your application with the environment variable `REPLACE_OS_VARS=true` and forward the following tcp ports:

- `4369 # epmd`
- `9999 # erlang distribution`

## Thanks

Shout out to [@alexgaribay]( for the hard work in [libcluster_gae](

## Authors

* Alex Kwiatkowski -

## License

`libcluster_gce` is released under the [MIT license](./