Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Untitled notebook

data/test.livemd

Untitled notebook

Mix.install([
  {:kino_db, "~> 0.2.1"},
  {:phoenix_pubsub, "~> 2.1"},
  {:libcluster, "~> 3.3.3"},
  {:postgrex, "~> 0.17.2"}
])

Section

topologies = [gossip: [strategy: Cluster.Strategy.Gossip]]

children = [
  {Phoenix.PubSub, name: :phx_pubsub},
  {Cluster.Supervisor, [topologies, [name: Lv.ClusterSupervisor]]}
  # %{id: PG, start: {:pg, :start_link, []}}
]

opts = [strategy: :one_for_one, name: Lv.Supervisor]
Supervisor.start_link(children, opts)
{node(), Node.list(:connected)}
Phoenix.PubSub.direct_broadcast!(:phx_solid@app1, :phx_pubsub, "lb", "hola")
# Node.disconnect(:livebook_server@livebook)
{:inet.gethostname(), Node.list(:connected)}
:rpc.call(:phx_solid@app0, :inet, :gethostname, [])
opts = [
  hostname: "db",
  port: 5432,
  username: "postgres",
  password: System.fetch_env!("LB_POSTGRES_PASSWORD"),
  database: "phx_solid_prod"
]

{:ok, conn2} = Kino.start_child({Postgrex, opts})
result = Postgrex.query!(conn2, "select * from social_users;", [])
:rpc.call(:phx_solid@app0, PhxSolid.Repo, :get_by, [PhxSolid.SocialUser, %{id: 2}])