HelloPhx API only notes
Mix.install([
{:kino, "~> 0.16.0"},
{:req, "~> 0.5.15"}
])
Node info
%{
node: Node.self(),
# same as above
node2: node(),
cookie: Node.get_cookie(),
nodes: Node.list()
} |> Kino.Tree.new
Flyio land
API request
###
req =
Req.new(
method: :get,
url: "http://hello-phx-api-only.internal:8080/info",
headers: %{},
params: %{}
)
req = Req.merge(req, inet6: true)
{req, flyio_resp} = Req.request(req)
flyio_dist_info = flyio_resp.body["distribution"]
Remote execution
require Kino.RPC
node = String.to_atom(flyio_dist_info["node"])
cookie = String.to_atom(flyio_dist_info["cookie"])
Node.set_cookie(node, cookie)
Kino.RPC.eval_string(node, ~S"Hi.build_info()", file: __ENV__.file)
Orb containter
API Request
req =
Req.new(
method: :get,
url: "https://hi.orb.local/info",
# OrbStack use self-signed certificate!
connect_options: [transport_opts: [verify: :verify_none]]
)
{req, orb_resp} = Req.request(req)
orb_dist_info = orb_resp.body["distribution"]
Remote execution
require Kino.RPC
node = String.to_atom(orb_dist_info["node"])
cookie = String.to_atom(orb_dist_info["cookie"])
Node.set_cookie(node, cookie)
Kino.RPC.eval_string(node, ~S"Release.distribution()", file: __ENV__.file)
Links
Test notes
-
2025.7.19 all passed using local desktop livebook with config
$ cat ~/.livebookdesktop.sh # This file is used to configure Livebook before booting. # If you change this file, you must restart Livebook for your changes to take place. # See https://hexdocs.pm/livebook/readme.html#environment-variables for all available environment variables. export LIVEBOOK_COOKIE="runman" # https://fly.io/docs/elixir/advanced-guides/connect-livebook-to-your-app/ export LIVEBOOK_DISTRIBUTION=name # Allow Livebook to connect to remote machines over IPv6 export ERL_AFLAGS="-proto_dist inet6_tcp" # Add Homebrew to PATH export PATH=/opt/homebrew/bin:$PATH