# Servers, CI and alerts

> Add a Linux server or a CI machine to a team without giving it any way to read, seal a job's sessions at its end, get a signed health webhook with no names in it, and set an alert address.

Agents run on servers and in CI as well as on Macs. This page covers the three things that make a team work there: a machine that is a member, a signed message when a device goes quiet, and an address for alerts. The rest of the team is in [Excellent for teams](https://www.excellent.so/docs/teams).

## Linux servers and CI machines as members

A server or a CI machine joins as a **machine member**. Its role is Contributor and its read level is none. It can add sessions from the repos you name. It can't read any session, its own or anyone's, because it never holds a key that opens one.

There are two ways to bring one in. Pick by whether a person can sit at the machine.

| Way | Use it for | Who approves |
| --- | --- | --- |
| Approve a fingerprint | A server you can reach over ssh | An admin, comparing a check number |
| A machine credential | CI, where nobody is there to approve | An admin makes it ahead of time |

### Approve a fingerprint

**Step 1: Ask to join from the server**

Make an invite for a server in the team's app (**Add a machine…**, then **Approve a server**), then run this on the server. It reads the invite code from standard input, so the code never shows in the process list, and prints a **check number** for its join request.

```bash
printf '%s' 'CODE' | excellent team join --machine
```

**Step 2: Match the number**

An admin's Mac shows that a server with that name wants to join, and a number. If it is the same as the one on the server, press **Approve**. If it isn't, don't.

This is the Confirm way in, the same as for an admin. A server never joins on a link alone.

### Use a machine credential

**Step 1: Add a machine**

In the app, under People, an admin chooses **Add a machine** and names it. The admin's Mac makes the machine's keys and one secret, and shows the secret once.

**Step 2: Paste it into the CI secret store**

Store the secret as a secret in your CI system, never in a repo. The job joins with it, reading the secret from standard input.

```bash
printf '%s' "$EXCELLENT_TEAM_CREDENTIAL" | excellent team join --credential -
```

**Step 3: Remove it like any device**

To retire the machine, an admin removes it from the roster, the same as a Mac. The credential stops working at once.

What a leak of the credential can do: add sessions as that machine, and fill the machine's share of storage. What it can't do: read anything, because it holds no read key. The team can set a per-device storage cap to bound the filling (there is none until one is set). The credential can't add devices to itself, so removing the machine from People ends it. It can delete what that machine wrote, and each delete is in the audit log. The machine shows by name in Health and in the history, so a strange one is easy to spot.

The admin whose Mac makes the credential makes the machine's keys, so that admin could sign as the machine. Give it to someone you trust with that.

### Seal at the end of a job

A machine that is new for every job can't keep a long archive. At the end of a job, seal what it wrote and send it to the team.

```bash
excellent team seal-now
```

It uses the machine credential, sends only the sessions from the repos the rules name, and exits. Run it as the last step, whether the job passed or failed.

### On a long-lived server

A server runs the same rules and reports health the same way as a Mac. The engine's systemd user service keeps it going, and `loginctl enable-linger` keeps that service running when nobody is logged in. Linux has no Keychain, so the machine's keys sit in a file in the state folder that only its user can open (permissions 0600).

## The health webhook

A team can have one webhook. When a device goes red, the team's service sends one signed message to your URL, so a stopped machine can page someone in Slack or a pager tool within the hour. When it is back, the service sends one more.

### What is sent

A `POST` with a JSON body of exactly these keys, in this order:

```json
{"team":"…","device":"…","status":"stale","since":"2026-11-29T08:00:00.000Z","at":"2026-11-29T09:00:12.000Z"}
```

| Key | Value |
| --- | --- |
| `team` | The team's id |
| `device` | The device's id |
| `status` | One word: `stale`, `off` or `blocked` when it turns red, or the word it has now (`healthy`, `behind` or `gap`) when it recovers |
| `since` | When the device got that status |
| `at` | When the message was made |

The ids are opaque. There are no names in it, no repo and no path. Your receiver can look up which machine an id is in the team's People view.

Each request carries these headers.

| Header | Value |
| --- | --- |
| `X-Excellent-Signature` | `t=<unix>,v1=<hex>` |
| `X-Excellent-Event` | An id that is the same on every retry of one message |
| `Content-Type` | `application/json` |

### How to verify it

The signature is an HMAC-SHA256 of the timestamp, a full stop and the exact bytes of the body, keyed with the webhook's secret. Use the secret as text, exactly as you were given it.

1. Read the raw body before you parse it.
2. Split the header into `t` and `v1`.
3. Compute the HMAC-SHA256 of `t + "." + body`, as hex.
4. Compare it with `v1` in constant time.
5. Refuse the message if `t` is more than 5 minutes old.
6. Keep the `X-Excellent-Event` ids you have seen, and ignore a repeat.

```js
import crypto from "node:crypto";

// secret: the webhook secret, exactly as given. rawBody: the request body as a string, unparsed.
export function verify(secret, header, rawBody, nowSeconds = Math.floor(Date.now() / 1000)) {
  if (typeof header !== "string") return false; // no signature header: not from us
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const t = Number(parts.t);
  if (!Number.isFinite(t) || Math.abs(nowSeconds - t) > 300) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  const given = Buffer.from(parts.v1 ?? "", "hex");
  const want = Buffer.from(expected, "hex");
  return given.length === want.length && crypto.timingSafeEqual(given, want);
}
```

### Setting it up and what to expect

An owner or an admin sets the webhook from their Mac. The Mac makes the signing secret. The service never shows it again, so keep it in your receiver's secret store, and set the webhook again if you lose it.

- The URL must be `https`, with no login in it and no `#`. Addresses inside a private network and names like `localhost` are refused.
- The service doesn't follow redirects. Answer with a `2xx` from the URL itself.
- It waits 5 seconds for an answer. A failed try is repeated an hour or so later, up to 5 tries in all, then it gives up on that message. The team's service log records each success and failure with the device and the event id, never the secret.
- One message is sent when a device turns red, and one when it recovers. A device that goes from `off` to `blocked` is still the same problem, so there is no second message.
- Setting the webhook again sends what was waiting at the next hourly run. Deleting it drops what was waiting. A message that has waited more than a week is dropped, and nothing is queued while no webhook is set.

The webhook says a device is quiet. It doesn't say why, and it can't see what a person did. [Health](https://www.excellent.so/docs/teams#health) explains what each word means and what it can't catch.

## Alert address

An owner or an admin can add one email address for alerts. Excellent stores it with the team, and shows it only to owners and admins. Only that, and it is kept until an admin removes it or the team is deleted.

**Email alerts.** Excellent emails that address once when a device needs attention (it stopped checking in, its archive is off, or it's blocked) and once when it recovers. A message names the device by a short id, says its status in plain words and since when, and names no person or repo; open Excellent's Health view to see which Mac it is. The emails are sent through Resend (see [Subprocessors](https://www.excellent.so/docs/teams/subprocessors)).

The address is personal data that your team gives us. Use a shared address for the team, such as an alias, and not a person's own.

Source: https://www.excellent.so/docs/teams/servers-and-ci
