# Install a private node

> Run checks from your own Linux server - one installer command with a join token, what it installs, its limits and permissions, updating, and removing it.

A [private node](https://docs.monitorly.cloud/concepts/nodes.md) runs checks from your own server, so they can reach internal addresses: databases, admin panels, services inside a VPC. It belongs to one workspace and runs checks of all its projects.

## Requirements

- Linux with systemd, on x86_64 or aarch64;
- `curl` or `wget`, and `sha256sum` or `shasum`;
- root, or `sudo`;
- outbound HTTPS to `gw.monitorly.cloud` and `app.monitorly.cloud`. The node opens the connection; nothing needs to reach the server from outside.

The node keeps its memory under 256 MiB.

## Install

1. In the dashboard, open **Settings → Nodes** and choose **Add node**. Give it a name; the country is optional, the node's location is otherwise found from the address it connects from.
2. The dialog shows two commands with a one-time join token. Run them on the server:

```sh title="On the server"
curl -fsSL https://gw.monitorly.cloud/install.sh -o install.sh
sudo MONITORLY_JOIN_TOKEN=<join token> sh install.sh
```

3. The dialog shows the node as soon as it connects. Select it on your checks.

The node also reports the server it runs on ([Server metrics](https://docs.monitorly.cloud/servers.md)). To include Docker containers and systemd services, add `--docker` and `--systemd` to the last command.

A join token works once and for 24 hours. Only a workspace owner or admin can add nodes, and the plan limits how many: private nodes are part of the Solo plan and up ([Plans and limits](https://docs.monitorly.cloud/concepts/plans.md)).

From a workstation with the [CLI](https://docs.monitorly.cloud/cli.md), `monitorly node install --ssh <user@server> --name <name>` does the same over your own `ssh`, issues the token itself and waits until the node is online. The token never appears in a process list on either side. It takes `--docker` and `--systemd failed` (or `--systemd <unit,unit>`) and passes them to the installer.

## What the installer does

- downloads the node software for this machine over HTTPS and checks its SHA-256 (and its signature when the release carries one); nothing is installed if a check fails;
- creates the system user `monitorly-runner` and the state directory `/var/lib/monitorly-runner`;
- installs `/usr/local/bin/monitorly-runner` and the unit `monitorly-runner.service`, enabled at boot;
- enrolls the node with the join token. The node makes its own key pair; the private key never leaves the server.

The service runs as its own user with a single capability, `CAP_NET_RAW`, for ICMP checks. It may write only its state directory; home directories, devices, kernel settings and other processes are hidden from it.

## Check that it runs

```sh title="On the server"
systemctl status monitorly-runner
journalctl -u monitorly-runner -f
```

The node also shows as **online** under **Settings → Nodes** and in `monitorly node list`.

## Results while offline

If the connection is lost, the node keeps checking and stores results on disk, up to 1 GiB or 7 days, and sends them when it is back. Beyond that the oldest are dropped and reported as "no data" ([Nodes](https://docs.monitorly.cloud/concepts/nodes.md#results-survive-a-lost-connection)).

## Settings

The node takes these options of `monitorly-runner run`. Add them to `ExecStart` with `systemctl edit --full monitorly-runner`:

| Option                   | Default | Meaning                                                                    |
| ------------------------ | ------- | -------------------------------------------------------------------------- |
| `--spool-limit-bytes`    | 1 GiB   | Disk space for results not yet delivered, in bytes                         |
| `--spool-limit-hours`    | 168     | Age of the oldest result kept                                              |
| `--rate-per-destination` | 5       | Runs per second against one destination address, with bursts of twice that |

## Update

Run the same installer again, without a join token. It installs the current version and restarts the service; the node keeps its identity. Give the same `--docker` and `--systemd` options as before: without them the node stops reporting containers and services.

```sh title="On the server"
curl -fsSL https://gw.monitorly.cloud/install.sh -o install.sh && sudo sh install.sh
```

## Remove

1. Revoke the node under **Settings → Nodes**, or with `monitorly node revoke <name>`. Checks stop running on it at once, and a revoked node cannot connect again.
2. On the server:

```sh title="On the server"
sudo systemctl disable --now monitorly-runner
sudo rm /etc/systemd/system/monitorly-runner.service /usr/local/bin/monitorly-runner
sudo rm -r /var/lib/monitorly-runner
sudo userdel monitorly-runner
```
