For the complete documentation index, see llms.txt. A markdown version of this page is at /guides/lease-pool-workstation/index.md.

Lease a workstation from a pool

Create a workstation pool, lease one of its workstations for a build, connect to it, and hand it back.

Create a workstation pool, lease one of its workstations for a build, connect to it, and hand it back. Use it when a CI job, a script or a person needs a workstation and shouldn’t wait the minutes a new one takes to build. You can also have the pool clean a workstation and keep it for the next lease instead of deleting it, which takes an edit to the pool’s declaration.

Prerequisites

  • Install Ringleader, with the Ringleader application running.
  • A cloud workstation to copy as the pool’s template, in the namespace the pool will live in. Cloud workstations (GCP, AWS, Azure) says how to build one.
  • The right to lease from the pool. A pool’s owner has it, and Access for a lease holder says who else can.
  • The examples use a template workstation named app-box in the namespace acme-dev, a pool named agents-linux and a lease named my-build. Replace them with your own.

Create a pool

Create a pool whose template is a copy of the workstation’s configuration. This pool builds up to eight members, which are the workstations it owns, and keeps two idle ones running:

rl workstationpool create agents-linux --from-workstation app-box --size-max 8 --warm-running 2 -n acme-dev

The command prints the pool it created. On stderr it prints a note that names what it left out of the template. Every lease holder can read the template, as Pool template and owner explains.

Lease a member

A lease is a request for one member. The pool binds a member to your lease as soon as one is available, and the member is yours until you release the lease. On a new pool, the first lease waits while a member builds, which takes minutes. Later leases take an idle member.

  1. Request a member and wait for it:

    rl workstationpool lease agents-linux --name my-build --wait -n acme-dev

    When the lease is Ready, the command prints the lease and its member, such as workstationpoollease/my-build Ready on agents-linux-e5f6a7b8. The lease carries your device’s SSH key.

  2. Open a shell on the member, with the member’s name from step 1:

    rl shell <member> -n acme-dev
  3. Optional: If your build runs longer than the lease, renew it before it ends:

    rl workstationpoollease renew my-build --expires-in 4h -n acme-dev
  4. Release the lease when you are done:

    rl workstationpoollease release my-build -n acme-dev

    The pool deletes the member.

If that’s all you need, you are done. The next task has the pool clean a member and keep it, and the last one deletes the pool.

Recycle members between leases

By default the pool deletes every released member. With a recycle block, a member goes back to the pool after a cleanup, and the next lease takes it. A recycled member keeps whatever its last holder left, as Member recycling explains.

  1. Open the pool in your editor:

    rl workstationpool edit agents-linux -n acme-dev
  2. Add a recycle block under spec:

    spec:
      recycle:
        maxReuses: 20   # after this many recycles the member is deleted instead
        timeout: 10m    # a recycle that takes longer deletes the member
        reboot: false   # true stops and starts the member after the scripts
  3. Optional: Declare the cleanup you need as onRecycle scripts in the template, as Setup scripts describes.

  4. Save the file and close the editor. Ringleader applies the change to the pool.

  5. Lease a member again, because the last task released my-build:

    rl workstationpool lease agents-linux --name my-recycle --wait -n acme-dev
  6. Release the lease with --recycle:

    rl workstationpoollease release my-recycle --recycle -n acme-dev

    The pool cleans the member and keeps it for the next lease. When it can’t recycle the member, it deletes it instead.

Optional: Delete the pool

A pool that keeps idle members running costs money until you delete it. Delete the pool when you are done with it:

rl workstationpool delete agents-linux -n acme-dev

The command asks you to confirm, because it deletes each member’s virtual machine and disk. Delete a pool says what happens to a member that is still leased.

Troubleshoot

  • If the lease stays Pending, run rl workstationpoollease describe my-build -n acme-dev. status.message says what the lease waits for, and Pool leases says how the pool picks a member.
  • If the lease goes Failed with the reason Expired, nobody renewed it before its expiresAt, and the pool deleted the member. Lease another member, and renew before the lease ends.

Next steps