Remote servers and the agent
Trong trang này
A remote server runs rudder-agent, a single static binary. The agent dials the panel, runs the panel's Docker calls on its own machine, and ships that machine's logs and metrics back. The panel never connects to the server, so servers behind NAT or a firewall work as long as they can reach the panel.
panel :7443 (gRPC, mTLS) ◀── dial out ── rudder-agent ── Docker Engine
└─ rudder-traefik, rudder-cache, appsAdd a server
-
In Servers, add a server with kind
remote. The panel shows a one-line command with a one-time join token that expires in an hour. -
Run the command on the server as root:
curl -fsSL https://panel.example.com/install-agent.sh | sudo sh -s -- \ --server https://panel.example.com --ca-sha256 3f6c... --token join_...The panel URL must use
https://;http://is refused unless it points atlocalhost,127.0.0.1, or[::1], because enrollment receives the certificate authority the agent trusts from then on.--ca-sha256is the SHA-256 fingerprint of the panel's agent CA, and the panel puts it in the command it shows. If the CA the panel returns has a different fingerprint, enrollment stops and nothing is saved.The installer needs Docker, systemd,
curl, andsha256sum. It:- downloads
rudder-agentfor the machine's architecture from the panel (/downloads/...), or from the GitHub release when the panel has no bundled copy, and checks its SHA-256; - runs
rudder-agent enroll, which creates a private key on the server and exchanges the token and a certificate request for a client certificate; - creates the
rudder-proxynetwork and startsrudder-traefik(ports 80 and 443, JSON access log) andrudder-cache(admin port on127.0.0.1:9090only); - installs and starts the
rudder-agentsystemd unit.
- downloads
-
The server turns online within a few seconds. The Servers page shows the agent version, hostname, OS, Docker version, and last contact.
Options: --version v1.2.3 pins the GitHub release, --email sets the Let's Encrypt account email, and --no-edge skips Traefik and the cache. Running the installer again upgrades the binary and keeps the existing identity. To move a server to a new identity, use Join command on the server row to get a fresh token, delete /var/lib/rudder-agent on the server, and rerun the command. The old certificate stops working as soon as the new one is issued.
What works on a remote server
Everything the local server supports goes through the agent: image deploys and rollbacks, Git builds (built on the panel host, then streamed to the server with docker save/docker load), databases, backups and restores, compose stacks, domains and certificates, the HTTP cache, logs and the live tail, the web terminal, metrics and alerts, and Docker prune.
Routing changes made while an agent is offline are stored and written to the server when it reconnects. Deploys to a server whose agent is offline fail immediately with remote_unavailable.
Git-sourced compose stacks are cloned on the panel, then the tracked files are copied to the server (the .git directory stays on the panel). Build contexts and files the compose file mounts from the repository are included. Files already on the server that are not part of the repository are kept. A checkout larger than 512 MiB is refused.
Security
- Enrollment only runs over
https://(plainhttp://only to the same machine), and the agent checks the returned CA against the--ca-sha256fingerprint from the join command before saving it. - The join token is stored only as a SHA-256 hash, works once, and expires after an hour. Enrollment is rate limited and audited (
server.enroll). - The agent's private key never leaves the server. The panel signs the request's public key with its own certificate authority, whose key is sealed with the master key.
- Every gRPC call requires a client certificate from that CA, and the certificate's fingerprint must match the server row. Deleting a server, or enrolling it again, disconnects the old session and rejects its certificate.
- The agent verifies the panel against the same CA using the name
rudder-panel, so the panel can be reached by IP address. - The panel only sends
NodeDriveroperations. File writes are confined to/var/lib/rudderon the server, with mode 0600.
Telemetry and outages
The agent samples host and container stats every 10 seconds and follows the output of Rudder-managed containers, rudder-traefik, and rudder-cache. It keeps doing this while the panel is unreachable and holds up to 20,000 log lines (4 MiB) and one hour of stats in memory. When the buffer is full the oldest items are dropped; the server row counts them (telemetry_dropped). Batches are resent until the panel acknowledges them. Log positions are saved only after acknowledgement, so restarting the agent re-reads missed lines from Docker.
The agent reconnects with backoff from 1 to 30 seconds. The panel marks the server offline when the session ends and records server.online and server.offline events, which the alert rules can notify on.
Panel settings
| Variable | Default | Meaning |
|---|---|---|
RUDDER_AGENT_BIND |
0.0.0.0:7443 |
gRPC listener for agents, or off |
RUDDER_AGENT_URL |
panel host + agent port | Address agents are told to dial (https:// only), for example when a proxy or NAT changes the port |
RUDDER_DIST_DIR |
/usr/share/rudder/dist |
Agent binaries served at /downloads/rudder-agent-<arch>-unknown-linux-musl with a .sha256 file |
Agent files and commands
| Path | Content |
|---|---|
/usr/local/bin/rudder-agent |
The binary |
/var/lib/rudder-agent/ |
key.pem, cert.pem, ca.pem, agent.json, log-cursors.json (mode 0600, directory 0700) |
/var/lib/rudder/ |
Files the panel writes: Traefik routes and certificates, cache rules, compose stacks |
/etc/systemd/system/rudder-agent.service |
The unit |
rudder-agent enroll --server <panel URL> --token <token> [--ca-sha256 <hex>]
[--data-dir /var/lib/rudder-agent]
rudder-agent run [--data-dir /var/lib/rudder-agent] [--node-dir /var/lib/rudder]
[--docker-socket <path>] [--cache-admin-url <url>]
rudder-agent --versionjournalctl -u rudder-agent shows the agent's JSON log. The same lines appear in the panel's log explorer under source agent.
Building the agent
rustup target add x86_64-unknown-linux-musl
sudo apt-get install musl-tools
CC_x86_64_unknown_linux_musl=musl-gcc \
cargo build --release -p rudder-agent --target x86_64-unknown-linux-muslThe result is a static-pie binary of about 11 MB.