defmodule LivebookWeb.Hub.Edit.TeamComponent do use LivebookWeb, :live_component alias Livebook.Hubs alias Livebook.Hubs.{Provider, Team} alias Livebook.Teams alias LivebookWeb.LayoutHelpers alias LivebookWeb.NotFoundError @impl true def update(assigns, socket) do socket = assign(socket, assigns) changeset = Team.change_hub(assigns.hub) show_key? = assigns.params["show-key"] == "true" secrets = Livebook.Hubs.get_secrets(assigns.hub) file_systems = Hubs.get_file_systems(assigns.hub, hub_only: true) secret_name = assigns.params["secret_name"] file_system_id = assigns.params["file_system_id"] is_default? = is_default?(assigns.hub) secret_value = if assigns.live_action == :edit_secret do Enum.find_value(secrets, &(&1.name == secret_name and &1.value)) || raise(NotFoundError, "could not find secret matching #{inspect(secret_name)}") end file_system = if assigns.live_action == :edit_file_system do Enum.find_value(file_systems, &(&1.id == file_system_id && &1)) || raise(NotFoundError, "could not find file system matching #{inspect(file_system_id)}") end docker_tags = Livebook.Config.docker_tags() [%{tag: default_base_image} | _] = docker_tags {:ok, socket |> assign( secrets: secrets, file_system: file_system, file_system_id: file_system_id, file_systems: file_systems, show_key: show_key?, secret_name: secret_name, secret_value: secret_value, hub_metadata: Provider.to_metadata(assigns.hub), is_default: is_default?, zta: %{"provider" => "", "key" => ""}, zta_metadata: nil, base_image: default_base_image, docker_tags: docker_tags ) |> assign_dockerfile() |> assign_form(changeset)} end @impl true def render(assigns) do ~H"""
<.remix_icon icon="mail-line" /> Invite users <.remix_icon icon="settings-line" /> Manage organization <.remix_icon icon="key-2-fill" /> Display Teams key <%= if @is_default do %> <.remix_icon icon="star-fill" /> Remove as default <% else %> <.remix_icon icon="star-line" /> Mark as default <% end %>
Secrets are a safe way to share credentials and tokens with notebooks.
They are often used by Smart cells and can be read as
environment variables using the LB_ prefix.
File storages are used to store notebooks and their files.
<.live_component module={LivebookWeb.Hub.FileSystemListComponent} id="hub-file-systems-list" hub_id={@hub.id} file_systems={@file_systems} target={@myself} />It is possible to deploy notebooks that belong to this Hub in an airgapped deployment, without connecting back to Livebook Teams server, by following the steps below. First, configure your deployment:
Then save the Dockerfile below in a repository with the Livebook notebooks
that belong to your Organization. You must change
the value of the APPS_PATH
argument in the template below to point to a directory with all .livemd
files you want to deploy.
You may additionally perform the following optional steps:
TEAMS_KEY
from your Dockerfile and set it as a build argument in your deployment
platform
LIVEBOOK_PASSWORD environment variable with a
value of at least 12 characters of your choice
This only removes the hub from this machine. You must rejoin to access its features once again.