Skip to content

Deploy a rig

Install clabe and its daemon on a rig PC with one command, then update and operate it over SSH.

1. Prepare the PC

  • A Windows user that stays logged on (e.g. with auto-logon). The daemon runs in that user's desktop session.
  • OpenSSH Server enabled, with SSH access as that user.
  • uv installed for that user (uv's installer).
  • The experiment repositories cloned under C:/git, each with a main.py.
  • Port 24070 reachable from the hub and from browsers.
  • Internet access during the install.

2. Configure (optional)

  • The daemon reads environment variables of the rig's user, e.g. DAEMON_CLABE_OTEL_ENDPOINT. With repositories under C:/git, it needs none except its token. See the daemon's variables.
  • Experiments read the rig's %PROGRAMDATA%\clabe.yml (do not put a token in it), e.g. watchdog: and otel: settings for runs. The installer can write this file (-Config).

3. Install

As the rig's user, in PowerShell or cmd:

powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/AllenNeuralDynamics/clabe/main/scripts/install.ps1 | iex"

What the installer does, in order:

  1. Stops if uv is missing, or if the daemon runs a session (busy or leased) and -Force is not set. Nothing has changed at that point.
  2. Sets DAEMON_CLABE_TOKEN and %PROGRAMDATA%\clabe.yml, when given.
  3. If the requested clabe (version or git commit, and extras) is already installed, it only re-registers the clabe-daemon task, restarts the daemon and prints its status.
  4. Otherwise it stops the daemon, installs clabe as a uv tool (clabe.exe), registers the task and starts the daemon. On Windows the running daemon locks the files uv replaces, so it has to stop first.
  5. If the install fails (e.g. no network), it reinstalls the previous clabe and starts it again, then exits non-zero. If that fails too, the error says the daemon is down.

  6. This is the daemon's own install: experiments still run in their repository's environment.

  7. Running it again is safe: the same command installs, updates and repairs.
  8. An unpinned request (no -Version) always installs, because the installer cannot tell whether the installed clabe is the latest.
  9. -DryRun prints the decision ("restart only" or "stop, install, start") and why.
Parameter Variable Meaning
-Version DAEMON_CLABE_VERSION clabe version (default: latest). Pin it on rigs.
-Package DAEMON_CLABE_PACKAGE Any uv spec instead of aind-clabe[frontend,otel], e.g. aind-clabe[frontend,otel,agents]==0.18.0
-Token DAEMON_CLABE_TOKEN Daemon token, saved as the user's DAEMON_CLABE_TOKEN
-Config DAEMON_CLABE_CONFIG The experiments' clabe.yml to install as %PROGRAMDATA%\clabe.yml; - reads it from standard input
-Force DAEMON_CLABE_FORCE=1 Stop the daemon even during a session (it is interrupted)
-Reinstall DAEMON_CLABE_REINSTALL=1 Install even when the requested clabe is already installed
-DryRun DAEMON_CLABE_DRY_RUN=1 Print the decision and the commands only
-Timeout Seconds to wait for the daemon (default 120)
# with an environment variable
$env:DAEMON_CLABE_VERSION = "0.18.0"; irm https://raw.githubusercontent.com/AllenNeuralDynamics/clabe/main/scripts/install.ps1 | iex
# with parameters
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/AllenNeuralDynamics/clabe/main/scripts/install.ps1))) -Version 0.18.0

To pin the installer version as well, replace main with the tag, e.g. .../clabe/v0.18.0/scripts/install.ps1.

4. Install over SSH

ssh rig-3 'powershell -NoProfile -ExecutionPolicy ByPass -c "& ([scriptblock]::Create((irm https://raw.githubusercontent.com/AllenNeuralDynamics/clabe/main/scripts/install.ps1))) -Version 0.18.0 -Config -"' < rig-config/clabe.yml
  • -Config - reads the rig's clabe.yml from the pipe, so you do not copy the file first. Leave it out to keep the rig's current clabe.yml.
  • Pass the token through the SSH session's environment, or set it once on the rig. Do not put it on the command line.
  • To update or roll back, run the same command with another -Version.

5. Operate it

ssh rig-3 clabe daemon status      # the task, and whether the daemon answers (idle, busy, leased)
ssh rig-3 clabe daemon restart     # refused during a session; --force interrupts it
ssh rig-3 clabe daemon stop        # same; it starts again at logon or with `clabe daemon start`
ssh rig-3 clabe daemon uninstall   # stop the daemon and remove the task
ssh rig-3 type %LOCALAPPDATA%\clabe\daemon.log
  • Do not start the daemon with clabe daemon run over SSH. Started that way, it cannot show windows and stops when the SSH session disconnects.
  • To check that rigs are up, the hub shows each rig as online, offline, idle, busy or leased. clabe daemon status checks a single rig.
  • Without SSH, a rig admin can run schtasks /S rig-3 /Run /TN clabe-daemon.

6. Deploy the hub

From a checkout of this repository on a Docker host:

cp docker/hub/.env.example docker/hub/.env     # the hub's token, the rigs' token, the rigs
docker compose -f docker/hub/compose.yml up -d --build

To update, pull and run the same command. See The hub.

Troubleshooting

Symptom Fix
restart: task Ready, daemon starts at logon Log the rig's user on.
restart times out, task Running Read daemon.log: port taken, or a DAEMON_CLABE_* variable invalid.
uv is not installed Install uv for the rig's user, then run the installer again.
Cannot download clabe Give the rig internet (or a uv index mirror) while installing.
Daemon answers with no repositories Each needs a main.py and a pyproject.toml depending on aind-clabe in a folder right under a root (default C:/git); or list it under repositories.
401 from the hub or a browser Token differs from the rig's DAEMON_CLABE_TOKEN; restart the daemon after changing it.
... would interrupt it (busy or leased) Deploy later, or -Force.
ModuleNotFoundError: No module named 'clabe' An install failed while the daemon ran (installers before this fix). Run the installer again.
The clabe-daemon task is not installed Run the installer (or clabe daemon install).