In this guide, we will start a runtime, make some changes in it and create a fork and a child to compare.
Fork state between agent runs.
Install the client tools and sign in
Beams is a Teleport project and uses official Teleport client tools.
The client tools include tsh to sign in and run commands, and tctl to administer your cluster if you have permission.
Cluster: example.beams.run. Edit this example to use your cluster name.
Install version 18.11.10 of the client:
Download and open the macOS installer, then follow its instructions.
curl -O https://cdn.teleport.dev/teleport-tools-18.11.10.pkg
open teleport-tools-18.11.10.pkgFor Linux x86-64, download and install the client tools:
curl -O https://cdn.teleport.dev/teleport-v18.11.10-linux-amd64-bin.tar.gz
tar -xzf teleport-v18.11.10-linux-amd64-bin.tar.gz
sudo ./teleport/installFor Windows x86-64, run these commands in PowerShell. Add the extraction directory ($env:LOCALAPPDATA\Teleport) to your user PATH to use tsh in future terminals; the last command adds it to this terminal's PATH.
Invoke-WebRequest -Uri https://cdn.teleport.dev/teleport-v18.11.10-windows-amd64-bin.zip -OutFile teleport.zip
Expand-Archive -Path teleport.zip -DestinationPath "$env:LOCALAPPDATA\Teleport" -Force
$env:Path += ";$env:LOCALAPPDATA\Teleport"Follow the official client tools install guide for other versions and architectures.
Check that you’re running v18.11.10 of the client with tsh version.
tsh versionI sign in without a password (e.g. a passkey).
tsh login --proxy='example.beams.run' --auth=passwordlessI have a password & MFA set up for my account:
Replace you@example.com with your Teleport username.
tsh login --proxy='example.beams.run' --user=you@example.comI sign in with SSO (e.g. Okta, GitHub, SAML).
tsh login --proxy='example.beams.run'Start a beam
This command creates a build beam. Any snapshots to it’s /home will be saved to a phase image with the same name:
# create a build beam workspace and associated phase with the same name
tsh phase add workspaceSave one file:
printf 'v1\n' > ~/example.txt
tsh phase snapshot --final--final saves the files, ends the build beam and returns you to your local terminal.
The new phase’s parent defaults to default:v1 phase image.
Create a child
Create a child of workspace:
tsh phase add child --from=workspaceSave without changing any files:
tsh phase snapshot --finalThe child’s parent phase is workspace. It follows workspace’s published images. We will revisit child later.
Create a fork
To compare, let’s create a fork of a workspace.
Fork workspace’s saved files:
tsh phase add fork --fork-from=workspaceSave the fork:
tsh phase snapshot --finalThe fork copies workspace’s saved v1 file but keeps workspace’s parent, default:v1.
It does not follow workspace.
Change the source
Let’s re-open workspace’s build beam to change the workspace phase:
tsh phase edit workspaceChange the file and snapshot:
printf 'v2\n' > ~/example.txt
tsh phase snapshot --finalFork vs child
A child keeps a parent relationship with workspace. A fork takes a one-time copy
of workspace’s saved files, but keeps workspace’s parent, default:v1.
When workspace publishes v2, the child inherits that file after refresh. The
fork keeps its copied v1. Both phases still follow their own parent’s updates,
and existing running beams do not change.
Here is the end state:
| Phase | Parent | ~/example.txt in a new beam after refresh |
|---|---|---|
| workspace | default:v1 |
v2 |
| child | workspace |
v2 |
| fork | default:v1 |
v1 |
Forks only copy files, not running processes or memory. See the fork restrictions.
A fork or a child?
| Goal | Command | Relationship |
|---|---|---|
| Make an independent copy of saved work | tsh phase add experiment --fork-from=workspace |
Copies the snapshot and follows the source’s parent. |
| Capture current work in a build beam | tsh phase add experiment --fork |
Copies the running filesystem into a new phase with the same parent. |
| Add another stage that follows a phase’s updates | tsh phase add app-work --from=app-tools |
Creates a child of app-tools. |