Skip to main content
Version: 2.5

Install and connect

This guide installs tsm and connects it to your tSM environment. It takes about 5 minutes.

You need:

  • a GitLab access token with the read_api scope, to download the CLI (in GitLab: avatar → Edit profile → Access tokens),
  • the URL of your tSM environment and your account there.

1. Install the CLI​

Windows​

Run in PowerShell:

$env:TSM_UPGRADE_TOKEN = '<your GitLab token>'
$installer = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN' = $env:TSM_UPGRADE_TOKEN } 'https://gitlab.datalite.cz/api/v4/projects/tsm%2Ftsm-config/repository/files/tsm-cli%2Finstall.ps1/raw'
& ([scriptblock]::Create($installer))

The installer puts tsm.exe into %LOCALAPPDATA%\tsm\bin. Add that folder to your PATH once:

$bin = "$env:LOCALAPPDATA\tsm\bin"
[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ";$bin", 'User')

Open a new terminal and check the installation:

tsm --version

Linux​

export TSM_UPGRADE_TOKEN='<your GitLab token>'
curl -fsSL -H "PRIVATE-TOKEN: $TSM_UPGRADE_TOKEN" 'https://gitlab.datalite.cz/api/v4/projects/tsm%2Ftsm-config/repository/files/tsm-cli%2Finstall.sh/raw' | sh
tsm --version

The installer puts tsm into ~/.local/bin. If tsm is not found, add that folder to PATH in your shell profile.

macOS​

The releases do not contain a macOS binary yet. Ask the tSM team for one, or build it from tsm-config.

2. Connect to your environment​

For a configuration Git checkout, use the shorter quick start with tsm context create. The explicit steps below are also supported.

Log in to tSM in the browser and create an API key on your user detail, tab API Keys. Then run the following commands. Replace the URL with your environment; the names tsm, dev and personal are your own labels and you can choose different ones.

tsm cli config project add tsm
tsm cli config environment add dev --project tsm --endpoint https://tsm-dev.k8s.datalite.cz
tsm context create dev --project tsm --env dev --account personal --no-login --non-interactive --use none
tsm context use dev --global
tsm auth login --method api-key

The last command asks for the API key. To log in with a username and password instead, use tsm auth login --method basic --user <username>.

What the commands did:

  • registered the project tsm and its environment dev with the URL,
  • created the context dev (environment + account + tenant default) and made it your default,
  • saved the API key as account personal. The key is stored in the operating system's credential store (Windows Credential Manager, macOS Keychain, Linux Secret Service via secret-tool), not in a plain file.

3. Check the connection​

tsm auth whoami
tsm app entity types

auth whoami shows who you are logged in as. app entity types lists the entity types of the application; an empty list is fine on a new tenant.

If a command fails, tsm doctor checks the configuration, the connection and the login step by step.

You are ready. Continue with Concepts, or go straight to the guide for your task.

Good to know​

  • Update the CLI: tsm cli upgrade (uses the same TSM_UPGRADE_TOKEN). tsm cli upgrade --check only checks for a newer version.
  • Configuration file: ~/.config/tsm/config.yaml (on Windows %USERPROFILE%\.config\tsm\config.yaml). It contains no passwords or keys. See Configuration.
  • Log out: tsm auth logout deletes the saved key from this computer. It does not revoke the API key in tSM.
  • Manual download: binaries are also on the CLI releases page. The installers above check the SHA-256 checksum automatically; when downloading manually, compare the file hash with the .sha256 file next to it.