Skip to content

Getting started

Video: Hearth, in ninety seconds (1:09).

This guide takes you from nothing to a first Playwright session in two steps: a farm on your laptop, then a farm on a real cluster.

1. A farm on your laptop

What you need

  • Docker (kind runs its cluster inside Docker)
  • kind, Helm 3 and kubectl
  • The hearth command:

    curl -fsSL https://raw.githubusercontent.com/test-zeus-ai/testzeus-hearth/main/install.sh | sh
    

    It installs hearth and hearth-agent into ~/.local/bin after checking their SHA-256. See Install the CLI for other versions, manual downloads and building from source.

hearth doctor checks that these are installed and Docker is running, and says what is missing.

Start the farm

hearth up local

What it does, printing each command as it runs it:

  1. Creates a kind cluster named hearth whose port 8080 on your machine reaches the gateway. If the cluster exists, it is reused.
  2. Applies the chart's CustomResourceDefinitions (Helm never upgrades CRDs by itself).
  3. Installs or upgrades the chart into the hearth namespace with one gateway replica and waits up to 10 minutes for it. The first run pulls the browser images, which takes a few minutes.
  4. Prints the URL, the API key of the default team and a Playwright snippet:
Hearth is up on http://localhost:8080

API key (team "default"): hth_...

Playwright:
  const browser = await chromium.connect("ws://localhost:8080/playwright/chromium?token=hth_...");

Useful flags: --cluster <name> for another kind cluster, --chart <path or oci ref> for another chart, --set key=value and -f values.yaml (both repeatable) for chart values. To work from a source checkout, see Development.

Run a first session

Save the key in your shell, then connect with a Playwright client whose version matches the farm's pools (1.65 by default):

export HEARTH_URL=http://localhost:8080
export HEARTH_KEY=hth_...        # the key `hearth up local` printed
npm install playwright@1.65.1
// first.mjs
import { chromium } from "playwright";

const browser = await chromium.connect(
  `${process.env.HEARTH_URL.replace(/^http/, "ws")}/playwright/chromium?token=${process.env.HEARTH_KEY}`,
);
const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.title());
await browser.close();
node first.mjs

You should see Example Domain. Open http://localhost:8080 in a browser, sign in with the same key, and the session is listed with its recording.

See what is running

hearth status
kubectl -n hearth get pods

hearth status (or kubectl -n hearth get browserpools) shows, per pool, how many browser pods are ready, busy, and how many requests are queued. Each idle pod waits for exactly one session; after the session it is deleted and a fresh one takes its place.

Stop it

hearth down          # deletes the kind cluster

On AWS or GCP

hearth up aws and hearth up gcp do the same in your cloud account, with your current credentials: they set up a cluster and install the chart into it. They create resources you pay for; run them with --help first to see what they create and the options for region, project and size. hearth down removes what they made.

For any other cluster, use Helm as below.

2. A farm on a real cluster

What you need

  • A Kubernetes cluster you can install into (any conformant cluster), Helm 3 and kubectl
  • Nodes with room for browser pods: by default each asks for 1 CPU and 2 GiB of memory

Install the chart

kubectl create namespace hearth
helm show crds oci://ghcr.io/test-zeus-ai/charts/hearth | kubectl apply --server-side -f -
helm install hearth oci://ghcr.io/test-zeus-ai/charts/hearth -n hearth

The defaults give a working farm: two gateway replicas, the operator, a bundled Valkey (Redis), a bundled SeaweedFS for artifacts, five browser pools (Playwright Chromium, Firefox and WebKit, and Selenium Chrome and Firefox) and a default team with a generated key. Every value is listed in Configuration.

Keep the release name hearth

hearth key and the examples look for Secrets named hearth-key-<team>. With another release name, the Secret is <release>-key-<team>.

Get the key

kubectl -n hearth get secret hearth-key-default -o jsonpath='{.data.key}' | base64 -d

or, with the CLI, hearth key default. The CLI's other commands talk to the farm's API and read HEARTH_URL and HEARTH_KEY (or --url and --key).

Reach the gateway

For a quick test, forward a port:

kubectl -n hearth port-forward svc/hearth-gateway 8080:80

For your CI, expose the gateway with an Ingress or a load balancer:

# values.yaml
gateway:
  ingress:
    enabled: true
    className: nginx
    host: hearth.example.com
    tls:
      - hosts: [hearth.example.com]
        secretName: hearth-tls
helm upgrade hearth oci://ghcr.io/test-zeus-ai/charts/hearth -n hearth -f values.yaml

Sessions are long-lived WebSockets (Playwright) and long HTTP conversations (Selenium, Appium). Make sure your ingress controller or load balancer allows WebSocket upgrades and does not cut idle connections after a short timeout. Clients then use wss://hearth.example.com/playwright/chromium.

Next steps