* cli, daemon: add `olares-cli status` backed by olaresd /system/status
Adds a new top-level `olares-cli status` command that calls the local
olaresd daemon's `/system/status` HTTP endpoint and prints either a
grouped, annotated human-readable report or raw JSON.
To avoid duplicating the response schema, the daemon's `state` struct
and related enums are extracted into a new shared package
`cli/pkg/daemon/state`. The daemon now type-aliases those types so all
existing daemon call sites keep compiling unchanged.
Made-with: Cursor
* cli: drop unused state.APIResponse envelope type
The HTTP client in cli/pkg/daemon/api/client.go intentionally uses an
inline anonymous envelope with json.RawMessage for the data field so
that --json mode can passthrough the bytes verbatim, so the public
APIResponse{Data State} type defined here had zero references. Remove
it; if a strongly-typed consumer ever shows up, re-add then.
Addresses Cursor Bugbot feedback on PR #2917.
Made-with: Cursor
|
||
|---|---|---|
| .. | ||
| .olares | ||
| cmd | ||
| deploy | ||
| docker | ||
| internel | ||
| pkg | ||
| .goreleaser.agent.yml | ||
| .goreleaser.yml | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| README.md | ||
Olares System Daemon (olaresd)
olaresd is the foundational process that boots on every Olares node. It runs as a systemd service on port 18088, exposing a secure REST API for hardware abstraction, network orchestration, storage management, and turnkey cluster operations—all before Kubernetes starts.
Olaresd is installed as a systemd service in /etc/systemd/system/olaresd.service.
Key features
- System monitoring: Continuous health checks of cluster and node status.
- Cluster lifecycle management: Automated install, upgrade, IP-switching, restart, and maintenance operations.
- Hardware Abstraction: USB auto-mounting, storage provisioning, and management.
- Network Management: mDNS service discovery, WiFi onboarding, and network interface control.
REST API reference
The daemon provides an authenticated REST API (using signature-based auth):
Base URL: http://<node-ip>:18088
System commands /command/
Lifecycle operations
| Method | Endpoint | Description |
|---|---|---|
| POST | /command/install |
Install Olares |
| POST | /command/uninstall |
Uninstall Olares |
| POST | /command/upgrade |
Upgrade Olares |
| DELETE | /command/upgrade |
Cancel upgrade |
| POST | /command/reboot |
Reboot node |
| POST | /command/shutdown |
Shutdown node |
Network configuration
| Method | Endpoint | Description |
|---|---|---|
| POST | /command/connect-wifi |
Connect to WiFi |
| POST | /command/change-host |
Change Olares IP binding |
Storage management
| Method | Endpoint | Description |
|---|---|---|
| POST | /command/mount-samba |
Mount SMB shares |
| POST | /command/v2/mount-samba |
Enhanced SMB mounting |
| POST | /command/umount-samba |
Unmount SMB shares |
| POST | /command/umount-samba-incluster |
Cluster-wide SMB unmount |
| POST | /command/umount-usb |
Unmount USB device |
| POST | /command/umount-usb-incluster |
Cluster-wide USB unmount |
System Maintenance
| Method | Endpoint | Description |
|---|---|---|
| POST | /command/collect-logs |
Collect system logs for diagnostics |
System information (/system/)
System status
| Method | Endpoint | Description |
|---|---|---|
| GET | /system/status |
Get full system status |
| GET | /system/ifs |
List network interfaces |
| GET | /system/hosts-file |
View /etc/hosts |
| POST | /system/hosts-file |
Update /etc/hosts |
Mount information
| Method | Endpoint | Description |
|---|---|---|
| GET | /system/mounted-usb |
Mounted USB devices |
| GET | /system/mounted-hdd |
Mounted hard drives |
| GET | /system/mounted-smb |
Mounted SMB shares |
| GET | /system/mounted-path |
All mount points |
Cluster-wide mounts
| Method | Endpoint | Description |
|---|---|---|
| GET | /system/mounted-usb-incluster |
USB mounts in cluster |
| GET | /system/mounted-hdd-incluster |
HDD mounts in cluster |
| GET | /system/mounted-smb-incluster |
SMB mounts in cluster |
| GET | /system/mounted-path-incluster |
All cluster mounts |
Container management (/containerd/)
Registry Management
| Method | Endpoint | Description |
|---|---|---|
| GET | /containerd/registries |
List registries |
| GET | /containerd/registry/mirrors/ |
List registry mirrors |
| GET | /containerd/registry/mirrors/:registry |
Get specific registry mirror |
| PUT | /containerd/registry/mirrors/:registry |
Update registry mirror |
| DELETE | /containerd/registry/mirrors/:registry |
Delete registry mirror |
Image Management
| Method | Endpoint | Description |
|---|---|---|
| GET | /containerd/images/ |
List container images |
| DELETE | /containerd/images/:image |
Delete specific image |
| POST | /containerd/images/prune |
Remove unused images |
Build from source
Prerequisites
- Go 1.24+
- GoReleaser (Optional, for creating release artifacts)
Steps
-
Navigate to the daemon directory:
cd daemon -
Build for your host OS/architecture:
go build -o olaresd ./cmd/olaresd/main.go -
Cross-compile for another target (e.g., Linux AMD64):
GOOS=linux GOARCH=amd64 go build -o olaresd ./cmd/olaresd/main.go -
Produce release artifacts (optional):
goreleaser release --snapshot --clean
Extend olaresd
To add a new command API:
- Define command: Add a new command struct in
pkg/commands/. - Implement handler: Create the corresponding HTTP handler logic in
internal/apiserver/handlers/. - Register route: Register the new API route in
internal/apiserver/server.go. - Update state: If the command modifies the cluster's state, ensure you update the logic in
pkg/cluster/state/. - Validate: Run
go vet ./... && go test ./...to check for issues and ensure all tests pass before opening a pull request.
Test a custom build
-
Copy the binary to your Olares node.
-
On the node, replace the existing binary:
# Move the new binary into place sudo cp -f /tmp/olaresd /usr/local/bin/ -
Restart the daemon to apply changes:
sudo systemctl restart olaresd