Skip to content

Commit

Permalink
Add Libcluster.
Browse files Browse the repository at this point in the history
  • Loading branch information
olefav committed Jun 27, 2019
1 parent 5ae0164 commit 4466b66
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
30 changes: 30 additions & 0 deletions lib/cluster_demo/application.ex
@@ -0,0 +1,30 @@
defmodule ClusterDemo.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false

use Application

def start(_type, _args) do
# List all child processes to be supervised
children = [
# Starts a worker by calling: ClusterDemo.Worker.start_link(arg)
# {ClusterDemo.Worker, arg}
{Cluster.Supervisor,
[
[
swarm_dns_poll: [
strategy: Cluster.Strategy.DNSPoll,
config: [query: "tasks.t_cluster_demo", node_basename: "cluster_demo"]
]
]
]
}
]

# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: ClusterDemo.Supervisor]
Supervisor.start_link(children, opts)
end
end
6 changes: 4 additions & 2 deletions mix.exs
Expand Up @@ -14,14 +14,16 @@ defmodule ClusterDemo.MixProject do
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
extra_applications: [:logger],
mod: {ClusterDemo.Application, []}
]
end

# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:distillery, "~> 2.0"}
{:distillery, "~> 2.0"},
{:libcluster, "~> 3.1"}
]
end
end
2 changes: 2 additions & 0 deletions mix.lock
@@ -1,4 +1,6 @@
%{
"artificery": {:hex, :artificery, "0.4.2", "3ded6e29e13113af52811c72f414d1e88f711410cac1b619ab3a2666bbd7efd4", [:mix], [], "hexpm"},
"distillery": {:hex, :distillery, "2.1.0", "5f31c7771923c12dbb79dcd8d01c5913b07222f134c327e7ab026acdabae985b", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm"},
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"libcluster": {:hex, :libcluster, "3.1.0", "461083b6c05ad117fadebb5e8986445d3045dbd1183b20d4865190aeb7873781", [:mix], [{:jason, "~> 1.1.2", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
}

0 comments on commit 4466b66

Please sign in to comment.