Skip to content
Permalink
Browse files

Test clustering

  • Loading branch information...
djquan committed Sep 4, 2019
1 parent 618efd0 commit e08e893ee76df9e1c47805f562d58d9f6342ed7a
@@ -57,3 +57,10 @@ config :phoenix, :stacktrace_depth, 20
config :phoenix, :plug_init_mode, :runtime

config :budgetsh, :sessions, salt: "test salt"

config :libcluster,
topologies: [
budgetsh: [
strategy: Cluster.Strategy.Epmd
]
]
@@ -1,3 +1,18 @@
use Mix.Config

config :logger, :console, level: :info

config :libcluster,
topologies: [
budgetsh: [
strategy: Cluster.Strategy.Kubernetes,
config: [
mode: :ip,
kubernetes_node_basename: "budgetsh",
kubernetes_selector: "app=budgetsh",
kubernetes_namespace: "budgetsh",
kubernetes_ip_lookup_mode: :pods,
polling_interval: 10_000
]
]
]
@@ -19,3 +19,10 @@ config :argon2_elixir,
m_cost: 8

config :budgetsh, :sessions, salt: "test salt"

config :libcluster,
topologies: [
budgetsh: [
strategy: Cluster.Strategy.Epmd
]
]
@@ -9,9 +9,8 @@ defmodule BudgetSH.Application do
def start(_type, _args) do
children = [
BudgetSH.Repo,
BudgetSHWeb.Endpoint
# Starts a worker by calling: BudgetSH.Worker.start_link(arg)
# {BudgetSH.Worker, arg},
BudgetSHWeb.Endpoint,
{Cluster.Supervisor, [Application.get_env(:libcluster, :topologies)]}
]

opts = [strategy: :one_for_one, name: BudgetSH.Supervisor]
@@ -44,7 +44,8 @@ defmodule BudgetSH.MixProject do
{:argon2_elixir, "~> 2.0"},
{:dialyxir, "~> 1.0.0-rc.6", only: [:dev], runtime: false},
{:dataloader, "~> 1.0.0"},
{:ecto_enum, "~> 1.3"}
{:ecto_enum, "~> 1.3"},
{:libcluster, "~> 3.1"}
]
end

@@ -19,6 +19,7 @@
"erlex": {:hex, :erlex, "0.2.4", "23791959df45fe8f01f388c6f7eb733cc361668cbeedd801bf491c55a029917b", [:mix], [], "hexpm"},
"gettext": {:hex, :gettext, "0.17.0", "abe21542c831887a2b16f4c94556db9c421ab301aee417b7c4fbde7fbdbe01ec", [:mix], [], "hexpm"},
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"libcluster": {:hex, :libcluster, "3.1.1", "cbab97b96141f47f2fe5563183c444bbce9282b3991ef054d69b8805546f0122", [:mix], [{:jason, "~> 1.1.2", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"},
"phoenix": {:hex, :phoenix, "1.4.9", "746d098e10741c334d88143d3c94cab1756435f94387a63441792e66ec0ee974", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.8.1 or ~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
@@ -11,7 +11,7 @@
# the one below (my_app@127.0.0.1), you need to also uncomment the
# RELEASE_DISTRIBUTION variable below.
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=<%= @release.name %>@127.0.0.1
export RELEASE_NODE=<%= @release.name %>@$MY_POD_IP

case $RELEASE_COMMAND in
start*|daemon*)
@@ -48,6 +48,10 @@ spec:
successThreshold: 1
failureThreshold: 3
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: BEAM_PORT
value: "9001"
- name: RELEASE_COOKIE

0 comments on commit e08e893

Please sign in to comment.
You can’t perform that action at this time.