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:
parent
6252aff728
commit
44f0ff26e5
1 changed files with 27 additions and 0 deletions
27
lib/mix/tasks/notebook.ex
Normal file
27
lib/mix/tasks/notebook.ex
Normal 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
|
||||
Loading…
Add table
Reference in a new issue