fix: Add mnesia cache support
This commit is contained in:
		
							parent
							
								
									6bf71b16e5
								
							
						
					
					
						commit
						64a8499a3f
					
				
					 6 changed files with 26 additions and 5 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -33,6 +33,9 @@ node_modules | |||
| # this depending on your deployment strategy. | ||||
| /priv/static/ | ||||
| 
 | ||||
| # Mnesia DBs | ||||
| apps/*/priv/mnesia/ | ||||
| 
 | ||||
| # Lock file for Brew, since the versions aren't really stable & isolated anyway | ||||
| Brewfile.lock.json | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										17
									
								
								apps/core/lib/auth/mnesia_cluster_supervisor.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								apps/core/lib/auth/mnesia_cluster_supervisor.ex
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| defmodule Legendary.Auth.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 | ||||
|  | @ -10,6 +10,7 @@ defmodule Legendary.Core.Application do | |||
| 
 | ||||
|     children = [ | ||||
|       {Cluster.Supervisor, [topologies, [name: Legendary.Core.ClusterSupervisor]]}, | ||||
|       Legendary.Auth.MnesiaClusterSupervisor, | ||||
|       # Start the Ecto repository | ||||
|       Legendary.Core.Repo, | ||||
|       # Start the Telemetry supervisor | ||||
|  |  | |||
|  | @ -120,7 +120,7 @@ defmodule Legendary.Core.MixProject do | |||
|   def application do | ||||
|     [ | ||||
|       mod: {Legendary.Core.Application, []}, | ||||
|       extra_applications: [:bamboo, :bamboo_smtp, :logger, :runtime_tools] | ||||
|       extra_applications: [:bamboo, :bamboo_smtp, :logger, :mnesia, :runtime_tools] | ||||
|     ] | ||||
|   end | ||||
| 
 | ||||
|  |  | |||
|  | @ -43,7 +43,8 @@ config :core, :pow, | |||
|   controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks, | ||||
|   mailer_backend: Legendary.AuthWeb.Pow.Mailer, | ||||
|   web_mailer_module: Legendary.AuthWeb, | ||||
|   web_module: Legendary.AuthWeb | ||||
|   web_module: Legendary.AuthWeb, | ||||
|   cache_store_backend: Pow.Store.Backend.MnesiaCache | ||||
| 
 | ||||
| config :core, email_from: "example@example.org" | ||||
| 
 | ||||
|  | @ -73,6 +74,8 @@ config :app, | |||
|   crontab: [ | ||||
|   ] | ||||
| 
 | ||||
| config :mnesia, dir: to_charlist(File.cwd!) ++ '/apps/core/priv/mnesia' | ||||
| 
 | ||||
| import_config "email_styles.exs" | ||||
| import_config "admin.exs" | ||||
| 
 | ||||
|  |  | |||
|  | @ -82,7 +82,6 @@ config :core, Legendary.CoreMailer, | |||
| config :core, email_from: System.get_env("EMAIL_FROM") | ||||
| 
 | ||||
| config :libcluster, | ||||
|   debug: true, | ||||
|   topologies: [ | ||||
|     kubernetes: [ | ||||
|       strategy: Elixir.Cluster.Strategy.Kubernetes, | ||||
|  | @ -94,8 +93,6 @@ config :libcluster, | |||
|         kubernetes_namespace: System.get_env("NAMESPACE", "legendary"), | ||||
|         polling_interval: 10_000]]] | ||||
| 
 | ||||
| IO.puts Kernel.node | ||||
| 
 | ||||
| # ## Using releases (Elixir v1.9+) | ||||
| # | ||||
| # If you are doing OTP releases, you need to instruct Phoenix | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Robert Prehn
						Robert Prehn