Add mix notebook task for Livebook attached to dev node

Run `mix notebook` for instructions to start Livebook at localhost:8081
connected to the running Phoenix node with full Repo/Scorer access.
This commit is contained in:
Graham McIntire 2026-04-07 08:51:09 -05:00
parent 6252aff728
commit 44f0ff26e5

27
lib/mix/tasks/notebook.ex Normal file
View file

@ -0,0 +1,27 @@
defmodule Mix.Tasks.Notebook do
@shortdoc "Start Phoenix + Livebook at localhost:8081/notebooks/algorithm_analysis.livemd"
@moduledoc false
use Mix.Task
@impl Mix.Task
def run(_args) do
hostname = :inet.gethostname() |> elem(1) |> List.to_string()
cookie = "microwaveprop_notebook"
node = "prop@#{hostname}"
IO.puts("""
Start Phoenix with a node name first:
iex --sname prop --cookie #{cookie} -S mix phx.server
Then in another terminal:
LIVEBOOK_NODE=#{node} LIVEBOOK_COOKIE=#{cookie} livebook server \\
--port 8081 \\
--default-runtime attached:#{node}:#{cookie} \\
--open notebooks/algorithm_analysis.livemd
Livebook will be at http://localhost:8081
""")
end
end