Skip to content

Commit 5ebced8

Browse files
authored
Docs for integration with Git (#3075)
1 parent 02f0079 commit 5ebced8

File tree

4 files changed

+112
-9
lines changed

4 files changed

+112
-9
lines changed

docs/images/open-from-git.png

38.7 KB
Loading

docs/teams/git_file_storage.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# How to open notebooks from a private Git repository
2+
3+
This guide shows you how to configure a Git file storage in your Livebook Teams organization, allowing team members to access shared notebooks from a private Git repository inside an [app server](/teams_concepts.md#app-server).
4+
5+
![](images/open-from-git.png)
6+
7+
## Prerequisites
8+
9+
- Membership in a [Livebook Teams](https://livebook.dev/teams) organization
10+
- A private Git repository (GitHub, GitLab, Bitbucket, etc.)
11+
12+
> #### Livebook version requirement {: .info}
13+
> Requires Livebook v0.18 or newer.
14+
15+
16+
## Add a Git file storage to your Teams workspace
17+
18+
1. Open Livebook
19+
2. Navigate to your Teams workspace page by clicking on the team name in the sidebar
20+
3. Scroll to the "File storages" section and click **Add file storage**
21+
4. Select **Git** as the file storage type
22+
5. Fill in the Git repository details:
23+
- **Repository URL**: Enter the SSH URL of your Git repository (e.g., `[email protected]:username/repo-name.git`)
24+
- **Branch**: Specify the branch to use (e.g., `main`)
25+
- **Private key**: Paste an SSH private key that has access to the repository (read-only access is enough)
26+
6. Click **Add** to save the configuration
27+
28+
Once configured, the Git file storage will be synced across all team members and Livebook app servers that belong to your Teams organization.
29+
30+
> #### Which SSH private key should I use? {: .tip}
31+
> Livebook connects to Git repositories over SSH, so you need to provide a private key with access to the repo.
32+
>
33+
> The recommended way is to create a new SSH key pair and add the public key as a deploy key for your Git repository inside your Git provider ([GitHub](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#set-up-deploy-keys), [GitLab](https://docs.gitlab.com/user/project/deploy_keys/#create-a-project-deploy-key), [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/set-up-repository-access-keys-on-linux/), etc.), then use the private key for the Livebook configuration.
34+
>
35+
> Livebook only needs **read-only access**, so when adding the deploy key to your Git repo, you can grant read-only permissions only.
36+
37+
## Open a notebook from the Git repository
38+
39+
After adding the Git file storage, members and app servers of your Teams organization can access notebooks stored in the repository:
40+
41+
1. From the Livebook home page, click **Open** to open a notebook
42+
2. Make sure you're in the **From storage** tab, and click on the file storage dropdown, saying "Disk"
43+
3. Click on the Git file storage you configured (it will be listed with your repository URL)
44+
4. Browse the repository files and click on the notebook file you want to open
45+
5. Click **Fork** to open the notebook in a new session
46+
47+
The notebook will open and be ready to use.
48+
49+
It's worth noting that **Livebook treats notebooks inside a Git file storage as read-only**. That's
50+
why you have to "fork" the notebook, which creates a copy. Any changes you make are local to your session and won't affect the original file in the Git repository.
51+
52+
## Examples of when this feature is useful
53+
54+
This feature is particularly useful when working inside an [app server](/teams_concepts.md#app-server) from your Teams organization and you need to open shared notebooks stored in a Git repository.
55+
56+
Common use cases include:
57+
58+
* **Templates and boilerplate** - Access frequently needed code inside an app server
59+
* **Runbooks** - Open operational runbooks directly in your app server to interact with production systems
60+
61+
## Examples of when this feature is not needed
62+
63+
### Sharing notebooks with team members for local development
64+
65+
If your team members need to edit and collaborate on notebooks in their local Livebook instances, use standard Git workflows instead:
66+
67+
1. Team members clone the Git repository to their local machines
68+
2. Open notebooks directly from the cloned repository
69+
3. Edit, commit, and push changes using Git
70+
71+
**Use Git file storage when**: You need to access the notebook from an app server, since app servers don't have direct access to your Git repository.
72+
73+
### Deploying Livebook apps
74+
75+
If you want to give someone access to a Livebook app (not edit the notebook):
76+
77+
1. [Deploy your notebook as a Livebook app](deploy_app.md)
78+
2. Share your app server URL with users
79+
80+
This allows users to use the app without notebook editing capabilities.
81+
82+
**Use Git file storage when**: Team members need to open shared notebooks as regular notebooks inside an app server, not as deployed apps.
83+
84+
## Security
85+
86+
Your SSH private key is encrypted end-to-end and never accessible to Livebook Teams in plaintext.
87+
88+
Livebook encrypts your SSH private key locally using your Teams key before sending it to Livebook Teams servers. When a Git file storage is added or edited, team members' Livebook instances and app servers receive the encrypted key and decrypt it locally using the same Teams key.
89+
90+
This ensures that only members of your Teams organization can access the private key.

docs/teams/shared_file_storages.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
# Shared file storages
22

3-
## Overview
4-
5-
This feature allows your team to share the configuration of S3-compatible storages.
3+
This feature allows your team to share S3-compatible buckets and Git repos as Livebook file storages.
64

75
Livebook file storages are used to store notebooks and their files.
86

9-
Whenever you add (update or detach) a file storage to your organization workspace, Livebook Teams will synchronize that with the Livebook of every member of your organization.
7+
Whenever you add, update, or detach a file storage from your organization workspace, Livebook Teams will synchronize it to every Livebook instance connected to your Teams organization, including team members and app servers in deployment groups.
108

119
![](images/add_shared_file_storage.png)
1210

1311
## How it works
1412

15-
Here's a video showing how that feature works.
13+
Here's a video showing how this feature works.
1614

1715
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/NkrTHShRCYE?si=9LhjlER91nyEbZxi" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
1816

19-
## Security strengths
17+
## Synchronization scope
18+
19+
Shared file storages are synchronized to:
20+
21+
1. **Team member Livebook instances**: Every member of your organization receives the shared file storage configuration in their local Livebook instance
22+
2. **App servers**: All app servers across all deployment groups in your organization also receive the shared file storage configuration
23+
24+
## Read/write permissions
25+
26+
File storage permissions depend on the storage type:
27+
28+
- **S3 file storages**: Support both read and write operations. You can create, modify, and delete notebooks and files.
29+
- **Git file storages**: Read-only access. You can view and use notebooks and files, but cannot modify them directly through the file storage.
30+
31+
## Security
2032

21-
Livebook Teams cannot access the credentials of your S3 (compatible) account.
33+
Livebook Teams cannot access sensitive data from your file storages, including S3 credentials or Git SSH private keys.
2234

23-
Livebook encrypts your S3 credentials locally in your machine using your Teams key. Then, they're sent encrypted to Livebook Teams servers.
35+
Livebook encrypts your file storage credentials (S3 credentials or Git SSH private keys) locally on your machine using your Teams key. The encrypted credentials are then sent to Livebook Teams servers.
2436

25-
When a new synchronization is needed, Livebook Teams sends the encrypted credentials to the Livebook of team members, and their Livebook decrypts that in their local machines using the same Teams key.
37+
When a new synchronization is needed, Livebook Teams sends the encrypted credentials to the Livebook instances of team members and app servers. These Livebook instances decrypt the credentials locally using the same Teams key.

mix.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ defmodule Livebook.MixProject do
267267
"docs/teams/oidc_groups.md",
268268
"docs/teams/shared_secrets.md",
269269
"docs/teams/shared_file_storages.md",
270+
{"docs/teams/git_file_storage.md", title: "Open notebooks from a private Git"},
270271
{"docs/teams/phoenix_integration.md", title: "How-to integrate with a Phoenix app"},
271272
{"docs/teams/teams_concepts.md", title: "Livebook Teams concepts"},
272273
"docs/authentication/basic_auth.md",

0 commit comments

Comments
 (0)