diff --git a/lib/livebook/config.ex b/lib/livebook/config.ex index 33d7d61b8..2da2b32f3 100644 --- a/lib/livebook/config.ex +++ b/lib/livebook/config.ex @@ -180,9 +180,9 @@ defmodule Livebook.Config do @doc """ Returns the configured URL for the Livebook Teams endpoint. """ - @spec teams_url() :: String.t() | nil + @spec teams_url() :: String.t() def teams_url() do - Application.get_env(:livebook, :teams_url) + Application.fetch_env!(:livebook, :teams_url) end @doc """ diff --git a/lib/livebook_web/live/hub/edit/personal_component.ex b/lib/livebook_web/live/hub/edit/personal_component.ex index 10a2a669a..330c07286 100644 --- a/lib/livebook_web/live/hub/edit/personal_component.ex +++ b/lib/livebook_web/live/hub/edit/personal_component.ex @@ -34,141 +34,139 @@ defmodule LivebookWeb.Hub.Edit.PersonalComponent do ~H"""
-
-
+
+
-

+

Your personal hub. All data is stored on your machine and only you can access it.

+
-
-
-

- General -

+
+

+ General +

- <.form - :let={f} - id={@id} - class="flex flex-col mt-4 space-y-4" - for={@changeset} - phx-submit="save" - phx-change="validate" - phx-target={@myself} + <.form + :let={f} + id={@id} + class="flex flex-col mt-4 space-y-4" + for={@changeset} + phx-submit="save" + phx-change="validate" + phx-target={@myself} + > +
+ <.text_field field={f[:hub_name]} label="Name" /> + <.emoji_field field={f[:hub_emoji]} label="Emoji" /> +
+
+ +
+ +
+ +
+

+ Secrets +

+ +

+ 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. +

+ + <.live_component + module={LivebookWeb.Hub.SecretListComponent} + id="hub-secrets-list" + hub={@hub} + secrets={@secrets} + target={@myself} + /> +
+ +
+

+ Stamping +

+ +

+ Notebooks may be stamped using your secret key. + A stamp allows to securely store information such as the names of the secrets that you granted access to. + You must not share your secret key with others. But you may copy the secret key between + different machines you own. +

+

+ If you change the secret key, you will need + to grant access to secrets once again in previously stamped notebooks. +

+ + <.form + :let={f} + id={"#{@id}-stamp"} + class="flex flex-col mt-4 space-y-4" + for={@stamp_changeset} + phx-submit="stamp_save" + phx-change="stamp_validate" + phx-target={@myself} + > +
+
+ <.password_field field={f[:secret_key]} label="Secret key" /> +
+
+ -
- + +
- -
-

- Secrets -

- -

- Secrets are a safe way to share credentials and tokens with notebooks. - They are often shared with Smart cells and can be read as - environment variables using the LB_ prefix. -

- - <.live_component - module={LivebookWeb.Hub.SecretListComponent} - id="hub-secrets-list" - hub={@hub} - secrets={@secrets} - target={@myself} - /> -
- -
-

- Stamping -

- -

- Notebooks may be stamped using your secret key. - A stamp allows to securely store information such as the names of the secrets that you granted access to. - You must not share your secret key with others. But you may copy the secret key between - different machines you own. -

-

- If you change the secret key, you will need - to grant access to secrets once again in previously stamped notebooks. -

- - <.form - :let={f} - id={"#{@id}-stamp"} - class="flex flex-col mt-4 space-y-4" - for={@stamp_changeset} - phx-submit="stamp_save" - phx-change="stamp_validate" - phx-target={@myself} +
+ - -
-
-
- -
- + Save +
-
+
- - <.modal - :if={@live_action in [:new_secret, :edit_secret]} - id="secrets-modal" - show - width={:medium} - patch={~p"/hub/#{@hub.id}"} - > - <.live_component - module={LivebookWeb.Hub.SecretFormComponent} - id="secrets" - hub={@hub} - secret_name={@secret_name} - secret_value={@secret_value} - return_to={~p"/hub/#{@hub.id}"} - /> -
+ + <.modal + :if={@live_action in [:new_secret, :edit_secret]} + id="secrets-modal" + show + width={:medium} + patch={~p"/hub/#{@hub.id}"} + > + <.live_component + module={LivebookWeb.Hub.SecretFormComponent} + id="secrets" + hub={@hub} + secret_name={@secret_name} + secret_value={@secret_value} + return_to={~p"/hub/#{@hub.id}"} + /> +
""" end diff --git a/lib/livebook_web/live/hub/edit/team_component.ex b/lib/livebook_web/live/hub/edit/team_component.ex index 9361d1339..653b23d6b 100644 --- a/lib/livebook_web/live/hub/edit/team_component.ex +++ b/lib/livebook_web/live/hub/edit/team_component.ex @@ -43,189 +43,191 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
-
-
-
- -
-
- - <%= @hub.hub_emoji %> +
+
+ +
+
+ + <%= @hub.hub_emoji %> -
- -
- <%= @hub.hub_name %> +
+
- - -
- + <%= @hub.hub_name %> + + Livebook Teams +
-
-
+
-
-

- A shared Teams hub. All resources here are shared with your team. Manage users and billing on livebook.dev. +

+ + <.remix_icon icon="mail-line" /> Invite users + + + + <.remix_icon icon="settings-line" /> Manage organization + + + + <.remix_icon icon="key-2-fill" /> Display Teams key +

-
-
-

- General -

+
+

+ General +

- <.form - :let={f} - id={@id} - class="flex flex-col mt-4 space-y-4" - for={@form} - phx-submit="save" - phx-change="validate" - phx-target={@myself} - > -
- <.text_field - field={f[:hub_name]} - label="Name" - disabled - help="Name cannot be changed" - class="bg-gray-200/50 border-200/80 cursor-not-allowed" - /> - <.emoji_field field={f[:hub_emoji]} label="Emoji" /> -
+ <.form + :let={f} + id={@id} + class="flex flex-col mt-4 space-y-4" + for={@form} + phx-submit="save" + phx-change="validate" + phx-target={@myself} + > +
+ <.text_field + field={f[:hub_name]} + label="Name" + disabled + help="Name cannot be changed" + class="bg-gray-200/50 border-200/80 cursor-not-allowed" + /> + <.emoji_field field={f[:hub_emoji]} label="Emoji" /> +
-
- -
- -
+
+ +
+ +
-
-

- Secrets -

+
+

+ Secrets +

-

- Secrets are a safe way to share credentials and tokens with notebooks. - They are often shared with Smart cells and can be read as - environment variables using the LB_ prefix. -

+

+ 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. +

- <.live_component - module={LivebookWeb.Hub.SecretListComponent} - id="hub-secrets-list" - hub={@hub} - secrets={@secrets} - target={@myself} + <.live_component + module={LivebookWeb.Hub.SecretListComponent} + id="hub-secrets-list" + hub={@hub} + secrets={@secrets} + target={@myself} + /> +
+ +
+

+ Airgapped Deployment +

+ +

+ It is possible to deploy notebooks that belong to this Hub in an airgapped + deployment, without connecting back to Livebook Teams server. This is done + using the Docker image template below, which encrypts all of your Hub metadata, + and taking some additional steps. +

+ +
+
+ Dockerfile + +
+ + <.code_preview + source_id={"offline-deployment-#{@hub.id}-source"} + source={@dockerfile} + language="dockerfile" />
-
-

- Airgapped Deployment -

+

+ Before deployment, you must perform the following manual steps: +

-

- It is possible to deploy notebooks that belong to this Hub in an airgapped - deployment, without connecting back to Livebook Teams server. This is done - using the Docker image template below, which encrypts all of your Hub metadata, - and taking some additional steps. -

+
    +
  1. + You must change /path/to/my/notebooks in the template above + to point to a directory with the .livemd files you want to deploy +
  2. +
  3. + You must set the LIVEBOOK_TEAMS_KEY environment variable + directly on your deployment platform, with the value you can find at the + top of this page +
  4. +
  5. + You may set the LIVEBOOK_PASSWORD environment variable to any + value of your choice, if you want to access and debug your deployed notebooks + in production +
  6. +
+
-
-
- Dockerfile - -
+
+

+ Danger Zone +

- <.code_preview - source_id={"offline-deployment-#{@hub.id}-source"} - source={@dockerfile} - language="dockerfile" - /> - -
    -
  1. - You must change /path/to/my/notebooks in the template above - to point to a directory with the `.livemd` files you want to deploy -
  2. -
  3. - You must set the LIVEBOOK_TEAMS_KEY environment variable - directly on your deployment platform, with the value you can find at the - top of this page -
  4. -
  5. - You may set the LIVEBOOK_PASSWORD environment variable to any - value of your choice, if you want to access and debug your deployed notebooks - in production -
  6. -
-
-
- -
-

- Danger Zone -

- -
-
-

- Delete this hub -

-

Once deleted, you won’t be able to access its features unless you rejoin.

-
- +
+
+

+ Delete this hub +

+

+ This only removes the hub from this machine. You must rejoin to access its features once again. +

+
@@ -256,6 +258,10 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do """ end + defp org_url(hub, path) do + Livebook.Config.teams_url() <> "/orgs/#{hub.org_id}" <> path + end + defp teams_key_modal(assigns) do ~H"""