Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Architecture Behind Deploying Livebook Apps...

The Architecture Behind Deploying Livebook Apps with Livebook Teams

I gave this talk at AlchemyConf 2025

In this talk, we’ll explore the architecture that powers the seamless deployment of Livebook apps with just a click of a button. This system combines a hybrid approach with an app running on localhost, a SaaS layer, and an on-premises app. We’ll examine how these distributed system components interact, the challenges they address, and how Elixir’s OTP is leveraged to make it all work.

Avatar for Hugo Baraúna

Hugo Baraúna

April 02, 2025
Tweet

More Decks by Hugo Baraúna

Other Decks in Programming

Transcript

  1. A Livebook app is a way to run a Livebook

    notebook as an application
  2. Hugo Baraúna Dev advocate @ Livebook 🥑 Elixir Radar newsletter

    📩 Elixir Patterns book with @akoutmos 📕 From Brazil 🇧🇷
  3. Livebook Teams Livebook HTTP REST API (for sync comms) protobuf

    messages WebSocket (for async comms) internet
  4. Livebook Livebook Teams Teams.Connection UserSocket Phoenix.PubSub LiveView Phoenix.PubSub LiveView subscribe(“org:1”)

    WebSocket.connect(“org:1”) connection established subscribe(“org:1”) broadcast( “org:1”, %LivebookProto.Event{} ) save env var send({ %LivebookProto.Event{} }) push(<<10, 17, 10, …>>) send broadcast handle_info
  5. Livebook App Server Livebook Livebook Teams deploy app HTTP POST

    start app deployment upload encrypted zipped app websocket noti fi cation: app deployment started download app presigned URL of the app GET app object app object run the app record app deployment zip and encrypt app deployment Decrypt app deployment
  6. Livebook App Server Livebook Livebook Teams deploy app HTTP POST

    start app deployment upload encrypted zipped app websocket noti fi cation: app deployment started download app presigned URL of the app GET app object app object run the app record app deployment zip and encrypt app deployment Decrypt app deployment
  7. TeamClient Apps.Manager Apps.Deployer Apps.AppSpec Sessions PubSub deploy(app_spec) sync_apps list_deployers deployers_pids

    deploy(pid, app_spec) load(app_spec) notebook App create_session send(:deploy_resullt) start(notebook) broadcast(:apps_manager_status) send(:apps_manager_status) send_message(%AppDeploymentStatusReport{})
  8. Apps.Manager Apps.Deployer list_deployers deployers_pids deploy(pid, app_spec) TeamClient Apps.AppSpec Sessions PubSub

    deploy(app_spec) sync_apps load(app_spec) notebook App create_session send(:deploy_resullt) start(notebook) broadcast(:apps_manager_status) send(:apps_manager_status) send_message(%AppDeploymentStatusReport{})
  9. Livebook app server (your own infrastructure ) Livebook Teams (SaaS)

    internet internet internet local network WebSocket Livebook app server (your own infrastructure ) Erlang distributed WebSocket
  10. livebook-dev/livebook Code diving @ WebSocket client using gen_statem lib/livebook/teams/connection.ex Protobuf

    message de fi nitions proto/* Livebook app deployment orchestration lib/livebook/apps/manager.ex lib/livebook/apps/deployer.ex