# Devices and fleets

# Devices and fleets

A device is a computer or server that captures data for your workspace.
Connect one to sync its data and see it in the console.

## Connect a computer

1. Open Phloem Computer. The first screen reads **Connect** and the computer's
   name.
2. Press **Continue in browser**. Sign in to Phloem in the browser that opens.
3. Check the workspace and press **Approve**.
4. Computer connects by itself. Return to it.

Anyone in the workspace can connect their own computer. No password is typed in
Computer.

| If | Do |
|---|---|
| You want to approve on a phone or another laptop | Press **Approving on another device?**, open the link there, approve, and paste the code it shows. Press **Connect**. |
| The browser did not open | Press **Browser didn’t open? Open it again**. |
| You want to work without the cloud | Press **Use this computer locally**. Sign in later from **Settings** › **Cloud connection** › **Sign in to cloud**. |

See [Cloud sync and working offline](https://phloem.ai/docs/workspace/sync/) for what works without signing in.

## Connect a headless server

On the server, run the command with the name the device should have:

```bash
phloem device enrol rig-2
```

It prints a link and a code. An admin opens the link in any browser and
presses **Enrol machine**. The server then keeps its own sign-in. It needs no
`phloem login`.

The server signs in as itself, not as a person. Only an admin can approve it.

## Device limit

Your plan sets how many devices can be signed in at once.

| Plan | Devices |
|---|---|
| Starter | 2 |
| Enterprise | Set to fit your team |

Each connected device counts once. Revoked devices don't count. At the limit,
a new device is refused when you approve it. The message says how many are
signed in and offers **Open Devices**. Revoke one there, or ask us to raise the
limit. Devices already connected keep working.

Your current count is on [Members and plans](https://phloem.ai/docs/workspace/members/) › **Plan &
usage**.

## Manage devices

Open your Phloem account and choose **Devices**. The **Active** tab lists
connected devices, with who signed each in and when. **Add a device** shows
both ways to connect.

| To | Do | Who |
|---|---|---|
| Rename a device | Press the pencil beside its name. The console and Computer show the new name. | Admin |
| Rename this computer | In Computer, open **Settings** › **Cloud connection**, and click the name beside **Device**. | |
| See a device's details | The row's menu › **Details** | Anyone |
| Revoke a device | The row's menu › **Revoke…** › **Revoke** | Admin |
| Remove a server from itself | Run `phloem device remove <name>` on it. It signs itself out. | |
| Sign out this computer | **Settings** › **Cloud connection** › **Sign out** | |

A revoked device is signed out at its next request. To send data again, it
must join again. What it already sent stays in the cloud. Captures it had not
uploaded stay on that machine. Revoked devices move to the **Revoked** tab.

## Fleets

A fleet groups devices, such as every rig in one test cell. Fleets live in the
console.

1. Open **Fleets** in the console and press **New fleet**.
2. Enter a **Name** and an optional **Description**. Press **Create**.

The page lists each fleet with its devices and how many are online. Devices in
no fleet are under **Unassigned**. A connector's device list in the console can
filter by **Fleet**.

## Fleet configuration

Store device settings once for a whole fleet, or for one device. Use the
`phloem` CLI after `phloem login`:

| Command | Does |
|---|---|
| `phloem config set --fleet <fleet> <file>` | Stores the fleet's document (YAML or JSON) |
| `phloem config set --device <device> <file>` | Stores one device's document, and applies it at once when the device is online |
| `phloem config get --device <device>` | Shows what the device should run: its fleet's document merged with its own |
| `phloem config apply --device <device>` | Sends the device its document now |
| `phloem config status --device <device>` | Compares what the device applied with what it should run |

A device's own value wins over its fleet's. A fleet change reaches each device
on its next apply.

In the console, open a device and choose the **Workspace** tab. **Configuration**
shows the document and its state: `in sync`, `behind` with the reason, or
`never applied`. Press **Apply now** to send it.

> **Note:** A device refuses a new configuration while a Trellis setup is
> deployed on it. It shows as `behind`, with the reason.

- [Members and plans](https://phloem.ai/docs/workspace/members/): Roles, invitations and plan limits
- [Projects](https://phloem.ai/docs/workspace/projects/): What each device runs
- [Cloud sync and working offline](https://phloem.ai/docs/workspace/sync/): What a device sends, and when
