mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-31 19:36:44 +01:00
add cluster init per pow-auth/pow_site#10
This commit is contained in:
parent
243e13613d
commit
60d75a9a4f
2 changed files with 20 additions and 4 deletions
|
@ -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]},
|
||||
|
||||
|
|
17
lib/philomena/mnesia_cluster_supervisor.ex
Normal file
17
lib/philomena/mnesia_cluster_supervisor.ex
Normal file
|
@ -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
|
Loading…
Reference in a new issue