From 44f0ff26e508669ae90f7b4313878205e1bb506b Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 7 Apr 2026 08:51:09 -0500 Subject: [PATCH] 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. --- lib/mix/tasks/notebook.ex | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/mix/tasks/notebook.ex diff --git a/lib/mix/tasks/notebook.ex b/lib/mix/tasks/notebook.ex new file mode 100644 index 00000000..1770b976 --- /dev/null +++ b/lib/mix/tasks/notebook.ex @@ -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