docs/teams/deploy_via_cli.md
Livebook provides a way to deploy Livebook apps via a CLI command to your deployment group's app servers.
This is particularly useful for automating deployments in CI/CD pipelines.
Deploying via CLI is as simple as calling livebook deploy with your configurations:
livebook deploy
--org-token="lb_ot_your_org_token_here"
--teams-key="lb_tk_your_teams_key_here"
--deployment-group-id="13"
path/to/notebook.livemd
Livebook version requirement {: .info}
Requires Livebook v0.17 or newer.
CLI deployment enables you to:
Before using CLI deployment, ensure you have:
mix escript.install hex livebookCLI deployment requires two authentication tokens:
Org tokens are organization-level authentication tokens that allow CLI access for deployments.
To create a org token, follow these steps:
Each organization has a unique Teams key available in the local Livebook of each member of the organization.
To get the Teams key of your organization, follow these steps:
Deploy a single notebook:
livebook deploy \
--org-token="lb_ot_..." \
--teams-key="lb_tk_..." \
--deployment-group-id="17" \
path/to/notebook.livemd
Deploy multiple notebooks:
livebook deploy \
--org-token="lb_ot_..." \
--teams-key="lb_tk_..." \
--deployment-group-id="13" \
app1.livemd app2.livemd app3.livemd
Use glob patterns for convenience:
livebook deploy \
--org-token="lb_ot_..." \
--teams-key="lb_tk_..." \
--deployment-group-id="7" \
notebooks/*.livemd
--org-token: A token from your Livebook Teams organization (required)--teams-key: Teams key from your Teams organization (required)--deployment-group-id: ID of the target deployment group (required)CLI deployment integrates seamlessly with automated workflows. Here's a GitHub Actions example:
name: Deploy Livebook Apps
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install Elixir
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.18.3'
otp-version: '27.3.4.1'
# Install Livebook CLI
- name: Install Livebook
run:
mix escript.install hex livebook --force
# Uses Livebook CLI to deploy your notebooks
- name: Deploy notebooks
run: |
livebook deploy \
--org-token="${{ secrets.LIVEBOOK_TEAMS_ORG_TOKEN }}" \
--teams-key="${{ secrets.LIVEBOOK_TEAMS_KEY }}" \
--deployment-group-id="3" \
./notebooks/*.livemd
Store your org token and teams key as repository secrets for secure access.
No, you don't need a running app server at deployment time. If your app server isn't running, Livebook Teams will queue the deployment and automatically deploy when the server comes online.
This error occurs when the notebook you're trying to deploy hasn't been properly stamped. Stamping happens automatically whenever a notebook is saved via Livebook.
Notebook stamping is a security mechanism to ensure only notebooks processed through your team's workspace can be deployed.
To fix this error, open the notebook inside Livebook, make sure it's using your Teams organization workspace, and save the notebook.