Skip to content

Commit

Permalink
Merge branch 'main' into apb/js-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Feb 5, 2025
2 parents 38da586 + 357f302 commit e99a2f0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/beacon/live_admin/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule Beacon.LiveAdmin.Application do
children = [
Beacon.LiveAdmin.Registry,
{Phoenix.PubSub, name: Beacon.LiveAdmin.PubSub},
%{id: :pg, start: {:pg, :start_link, [Beacon.LiveAdmin.Cluster.scope()]}},
Beacon.LiveAdmin.Cluster,
Turboprop.Cache
]
Expand Down
4 changes: 3 additions & 1 deletion lib/beacon/live_admin/cluster.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ defmodule Beacon.LiveAdmin.Cluster do

@scope :beacon_cluster

@doc false
def scope, do: @scope

@doc false
def start_link(opts) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
Expand All @@ -18,7 +21,6 @@ defmodule Beacon.LiveAdmin.Cluster do
@doc false
@impl true
def init(opts) do
{:ok, _} = :pg.start_link(@scope)
:pg.monitor_scope(@scope)
:ok = :net_kernel.monitor_nodes(true, node_type: :all)
{:ok, opts}
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%{
"accent": {:hex, :accent, "1.1.1", "20257356446d45078b19b91608f74669b407b39af891ee3db9ee6824d1cae19d", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.3", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "6d5afa50d4886e3370e04fa501468cbaa6c4b5fe926f72ccfa844ad9e259adae"},
"bandit": {:hex, :bandit, "1.6.7", "42f30e37a1c89a2a12943c5dca76f731a2313e8a2e21c1a95dc8241893e922d1", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "551ba8ff5e4fc908cbeb8c9f0697775fb6813a96d9de5f7fe02e34e76fd7d184"},
"beacon": {:git, "https://github.com/BeaconCMS/beacon.git", "c243a4989deae142e2640be0f5e39253a88eca7a", []},
"beacon": {:git, "https://github.com/BeaconCMS/beacon.git", "dfece41f6f8ffbbe4bf5b2368d452abb4cb0fc25", []},
"castore": {:hex, :castore, "1.0.11", "4bbd584741601eb658007339ea730b082cc61f3554cf2e8f39bf693a11b49073", [:mix], [], "hexpm", "e03990b4db988df56262852f20de0f659871c35154691427a5047f4967a16a62"},
"cc_precompiler": {:hex, :cc_precompiler, "0.1.10", "47c9c08d8869cf09b41da36538f62bc1abd3e19e41701c2cea2675b53c704258", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f6e046254e53cd6b41c6bacd70ae728011aa82b2742a80d6e2214855c6e06b22"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
Expand Down
23 changes: 21 additions & 2 deletions test/support/cluster.ex
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,35 @@ defmodule Beacon.LiveAdminTest.Cluster do

rpc(node, MyApp.Repo, :stop, [])

rpc(node, Application, :put_env, [
:my_app,
MyAppWeb.ProxyEndpoint,
http: [ip: {127, 0, 0, 1}, port: Enum.random(4030..4050)],
# adapter: Bandit.PhoenixAdapter,
server: true,
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64),
render_errors: [
formats: [
html: Beacon.Web.ErrorHTML
],
layout: false
],
pubsub_server: MyApp.PubSub,
debug_errors: false
])

rpc(node, Application, :put_env, [
:my_app,
MyAppWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: Enum.random(4030..4099)],
http: [ip: {127, 0, 0, 1}, port: Enum.random(4051..4099)],
# adapter: Bandit.PhoenixAdapter,
server: true,
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64),
render_errors: [
formats: [
html: MyApp.ErrorHTML
html: Beacon.Web.ErrorHTML
],
layout: false
],
Expand All @@ -139,6 +157,7 @@ defmodule Beacon.LiveAdminTest.Cluster do

children = [
MyApp.Repo,
MyAppWeb.ProxyEndpoint,
MyAppWeb.Endpoint,
{Phoenix.PubSub, name: MyApp.PubSub},
{Beacon, beacon_config}
Expand Down
9 changes: 9 additions & 0 deletions test/support/site.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ defmodule MyApp.Router do
end
end

defmodule MyAppWeb.ProxyEndpoint do
use Beacon.ProxyEndpoint,
otp_app: :my_app,
session_options: [store: :cookie, key: "_live_view_key", signing_salt: "/VEDsdfsffMnp5"],
fallback: MyAppWeb.Endpoint
end

defmodule MyAppWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app

def proxy_endpoint, do: MyAppWeb.ProxyEndpoint

plug Plug.Session,
store: :cookie,
key: "_live_view_key",
Expand Down

0 comments on commit e99a2f0

Please sign in to comment.