How to deploy LiveBook in attached mode, as well as use the App feature of LiveBook 0.10?

Hey Guys,

I am trying to run a LiveBook beside my LiveView app.

I tried to run the LiveBook in attached mode:

LIVEBOOK_HOME: livebooks
LIVEBOOK_APPS_PATH: livebooks
LIVEBOOK_APPS_PATH_PASSWORD: wubalubadubdub
LIVEBOOK_BASE_URL_PATH: /
LIVEBOOK_PORT: 49223
LIVEBOOK_SHUTDOWN_ENABLED: true
LIVEBOOK_TOKEN_ENABLED: false
LIVEBOOK_DEFAULT_RUNTIME: attached:derpytools:wubalubadubdub

But I’m unable to run those LiveBook as individual apps, while also being connected to the main app.

For instance, say I want to show the architecture diagram of my project using Kino.Mermaid, all the while running the Imgproxy attached to my app, or even query the connected Sqlite database.


So how do you approach this? Do you deploy 2 separate LiveBooks? or not ever run in attached mode?

Why can’t we add LiveBook specific dependencies even in attached mode?


I ran this in standalone mode, and I was able to add Kino.

I wish this was possible in attached mode as well.


Also, I noticed that Markdown doesn’t show up in the app!

1 Like

Hey @derpycoder,

But I’m unable to run those LiveBook as individual apps, while also being connected to the main app.

A deployed app always uses the “Elixir standalone” runtime. In order to interact with your production node, you can connect using Node.set_cookie/2 + Node.connect/2 and then use :erpc.call to fetch information from that node. The primary reason is that an app requires Kino to run and we don’t want people to be adding more dependencies to their production apps. In general the isolated approach is preferable, the “Attached runtime” is primarily for debugging.

Why can’t we add LiveBook specific dependencies even in attached mode?

We install dependencies via Mix.install/2, which can be called only once, so adding a dependency to the list wouldn’t be possible and we don’t know (nor want to) restart the connected node. Also production apps usually are releases and they don’t even have Mix. With the approach I mentioned above, you can freely add dependencies, since the notebook is separate from the app.

Also, I noticed that Markdown doesn’t show up in the app!

Correct, in case of apps we treat Markdown cells as more of a documentation. You can use Kino.Markdown to render content that should be a part of the app. We may have more configuration for this in the future, depending on the use cases we see : )

1 Like

As for the specific use case of rendering the tree, currently Kino.Process it doesn’t work with remote PIDs, but we can make it work. I will open up an issue : )

1 Like