diff --git a/lib/philomena/application.ex b/lib/philomena/application.ex index bf44f0c1..198a3f2f 100644 --- a/lib/philomena/application.ex +++ b/lib/philomena/application.ex @@ -11,6 +11,9 @@ defmodule Philomena.Application do # Connect to cluster nodes {Cluster.Supervisor, [[philomena: [strategy: Cluster.Strategy.ErlangHosts]]]}, + # Session storage + Philomena.MnesiaClusterSupervisor, + # Start the Ecto repository Philomena.Repo, @@ -22,10 +25,6 @@ defmodule Philomena.Application do Philomena.Servers.PiczelChannelUpdater, Philomena.Servers.Config, - # Session storage - {Pow.Store.Backend.MnesiaCache, extra_db_nodes: Node.list()}, - Pow.Store.Backend.MnesiaCache.Unsplit, - {Redix, name: :redix, host: Application.get_env(:philomena, :redis_host)}, {Phoenix.PubSub, [name: Philomena.PubSub, adapter: Phoenix.PubSub.PG2]}, diff --git a/lib/philomena/mnesia_cluster_supervisor.ex b/lib/philomena/mnesia_cluster_supervisor.ex new file mode 100644 index 00000000..50328122 --- /dev/null +++ b/lib/philomena/mnesia_cluster_supervisor.ex @@ -0,0 +1,17 @@ +defmodule Philomena.MnesiaClusterSupervisor do + use Supervisor + + def start_link(init_arg) do + Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__) + end + + @impl true + def init(_init_arg) do + children = [ + {Pow.Store.Backend.MnesiaCache, extra_db_nodes: Node.list()}, + Pow.Store.Backend.MnesiaCache.Unsplit + ] + + Supervisor.init(children, strategy: :one_for_one) + end +end