141 lines
3.7 KiB
Markdown
141 lines
3.7 KiB
Markdown
# Install Agent
|
|
|
|
## Build
|
|
|
|
On Windows:
|
|
|
|
```powershell
|
|
.\scripts\build-agent.ps1
|
|
```
|
|
|
|
On Linux or macOS:
|
|
|
|
```sh
|
|
make build-agent
|
|
```
|
|
|
|
Pass a version explicitly if you are cutting a release build:
|
|
|
|
```powershell
|
|
.\scripts\build-agent.ps1 -Version (.\scripts\version.ps1)
|
|
```
|
|
|
|
The binaries are written to `dist/`:
|
|
|
|
```text
|
|
klipperanywhere-agent-linux-amd64
|
|
klipperanywhere-agent-linux-arm64
|
|
klipperanywhere-agent-linux-armv7
|
|
klipperanywhere-agent-linux-mipsle
|
|
```
|
|
|
|
## Manual Test First
|
|
|
|
Copy the matching binary and config to the printer host, then run it manually:
|
|
|
|
```sh
|
|
chmod +x ./klipperanywhere-agent
|
|
./klipperanywhere-agent -config ./agent.json
|
|
```
|
|
|
|
Check the server dashboard before installing it as a service.
|
|
|
|
## Install
|
|
|
|
The installer auto-detects the host runtime and installs the agent as:
|
|
|
|
- a `systemd` service when `systemctl` and a systemd userspace are present
|
|
- an OpenRC service when `rc-update` is available
|
|
- a SysV-style init script when `update-rc.d` or `chkconfig` is available
|
|
- a BusyBox-style boot hook when only lightweight init directories exist
|
|
|
|
Run it from the repo root:
|
|
|
|
```sh
|
|
sudo sh ./scripts/install-agent.sh ./dist/klipperanywhere-agent-linux-arm64 ./agent.json
|
|
```
|
|
|
|
Check logs on `systemd` hosts:
|
|
|
|
```sh
|
|
journalctl -u klipperanywhere-agent -f
|
|
```
|
|
|
|
Check local printer-host status:
|
|
|
|
```sh
|
|
/usr/local/bin/klipperanywhere-agent status -config /etc/klipperanywhere/agent.json
|
|
```
|
|
|
|
Add `-json` if you want machine-readable output.
|
|
|
|
Print the embedded build version:
|
|
|
|
```sh
|
|
/usr/local/bin/klipperanywhere-agent version
|
|
```
|
|
|
|
## Bootstrap From A Release
|
|
|
|
If you already have the config file on the printer host, the bootstrapper will
|
|
download the correct binary for the host architecture and install it in one step.
|
|
It expects to sit alongside the installer scripts from this repo or a release
|
|
bundle that includes them:
|
|
|
|
```sh
|
|
sudo sh ./scripts/bootstrap-agent.sh --config /etc/klipperanywhere/agent.json
|
|
```
|
|
|
|
You can override the release asset base URL when testing locally:
|
|
|
|
```sh
|
|
sudo sh ./scripts/bootstrap-agent.sh \
|
|
--config /etc/klipperanywhere/agent.json \
|
|
--release-base-url https://github.com/klipperanywhere/klipperanywhere/releases/latest/download
|
|
```
|
|
|
|
## Install Over SSH
|
|
|
|
If you are logged into the server web UI as an admin, you can install a printer
|
|
agent over SSH from the new `/install` page. Enter the printer IP, SSH user,
|
|
password, and a printer-reachable server URL, then KlipperAnywhere will:
|
|
|
|
- detect the printer architecture over SSH
|
|
- download the matching agent binary on the server
|
|
- upload the binary, config, and init files to the printer
|
|
- run the standard installer remotely
|
|
- wait for the agent to call back and appear in `/api/printers`
|
|
|
|
If you open `/install` from a printer detail page, the printer ID will prefill.
|
|
|
|
The SSH account should be `root` or a user with passwordless sudo.
|
|
|
|
Use the `Printer host type` selector on `/install` if the printer is running
|
|
Rinkhals. In that mode the installer uploads a Rinkhals app bundle instead of
|
|
installing a host service. The app bundle lives under
|
|
`/useremain/home/rinkhals/apps/60-klipperanywhere-agent` and includes:
|
|
|
|
- `app.json`
|
|
- `app.sh`
|
|
- `klipperanywhere-agent`
|
|
- `agent.json`
|
|
|
|
The app script starts the agent inside the Rinkhals runtime and uses the same
|
|
SSH-installed config fields as the standard service path.
|
|
|
|
On BusyBox or SysV-style hosts, the installer places `/etc/init.d/klipperanywhere-agent`
|
|
in place and starts it using the best available boot registration it can find. If the
|
|
host does not expose a runtime manager, start it manually with:
|
|
|
|
```sh
|
|
/etc/init.d/klipperanywhere-agent start
|
|
```
|
|
|
|
Uninstall:
|
|
|
|
```sh
|
|
sudo sh ./scripts/uninstall-agent.sh
|
|
```
|
|
|
|
The uninstall script leaves `/etc/klipperanywhere/agent.json` in place.
|