## User
- **User:** Mike Swanson (mike)
- **Machine:** Mikes-MacBook-Air
- **Role:** admin

---

## Session Summary

Deployed GuruRMM agent as a Docker container on Lonestar Electrical's Unraid server (Tower, IP 172.16.1.188) following the pattern established with Jupiter. The Unraid server was already at the ACG office for USB flash drive migration work completed 2026-06-02, making direct network access available for setup.

Retrieved existing GuruRMM client configuration for Lonestar Electrical and identified the Warren site (WARM-FALCON-5891) as the enrollment target. Regenerated the site's API key and vaulted it at `clients/lonestar/gururmm-site-warren.sops.yaml`. The original localhost Docker registry (localhost:3000) was unreachable from the Unraid server, so switched to the Gitea container registry (git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest).

Encountered multiple config format issues during initial container startup. The agent config required `api_key` in the `[server]` section, not `[agent]`. After fixing the config structure, the agent attempted to connect to the external WebSocket URL (wss://rmm.azcomputerguru.com/ws) but failed due to network routing. Switched to the internal RMM server URL (ws://172.16.3.30:3001/ws) which resolved connectivity.

Agent enrolled successfully with ID e827f798-bab1-484b-b641-98da7ff5af87, hostname Tower, and immediately began sending inventory data. The container is configured with host networking, auto-restart policy, Unraid dockerman label for UI integration, and proper volume mounts for config and device-id persistence. Vaulted Unraid root credentials at `clients/lonestar/unraid-server.sops.yaml` including RMM agent enrollment details.

---

## Key Decisions

- **Used Warren site instead of creating new site**: Lonestar already had an existing site (WARM-FALCON-5891) in GuruRMM, so regenerated its API key rather than provisioning a new site
- **Gitea registry over localhost registry**: The localhost:3000 Docker registry wasn't routable from the Unraid server, switched to git.azcomputerguru.com which is accessible from the office network
- **Internal RMM URL over external**: The external wss://rmm.azcomputerguru.com URL failed from the office network, used internal ws://172.16.3.30:3001/ws which provides direct access
- **Host networking mode**: Following Jupiter pattern for simplified container networking and full system visibility for the agent
- **Vaulted Unraid credentials immediately**: Root password was provided by user for setup work, vaulted it proactively to establish credentials.md migration path

---

## Problems Encountered

- **localhost:3000 Docker registry unreachable**: The Unraid server couldn't reach the localhost registry used in the original Jupiter setup. Fixed by switching to the Gitea container registry at git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest
- **Wrong config.toml format (missing api_key field)**: Initial config had `site_key` in `[agent]` section, but agent expected `api_key` in `[server]` section. Fixed by restructuring config
- **External WebSocket URL unreachable**: Agent couldn't connect to wss://rmm.azcomputerguru.com/ws from office network. Fixed by using internal ws://172.16.3.30:3001/ws URL
- **Config changes not picked up**: After initial config errors, container kept using old config from cache. Fixed by restarting container after each config update

---

## Configuration Changes

### Files Created
- `clients/lonestar/gururmm-site-warren.sops.yaml` (vault) - Warren site enrollment key
- `clients/lonestar/unraid-server.sops.yaml` (vault) - Unraid root credentials and RMM details
- `/mnt/user/appdata/gururmm/config.toml` (Unraid server) - GuruRMM agent config

### Docker Container
- Container name: `gururmm-agent`
- Image: `git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest`
- Network: host mode
- Restart policy: unless-stopped
- Labels: `net.unraid.docker.managed=dockerman`

### Volume Mounts
- `/mnt/user/appdata/gururmm:/config` - Config directory
- `/mnt/user/appdata/gururmm/lib:/var/lib/gururmm` - Device-id persistence
- `/dev/kvm:/dev/kvm:ro` - KVM access (read-only)
- `/proc:/proc:ro` - Process info
- `/sys:/sys:ro` - System info
- `/var/run/docker.sock:/var/run/docker.sock` - Docker socket
- `/var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock:ro` - Libvirt socket

---

## Credentials & Secrets

### GuruRMM Warren Site Enrollment Key
- **Vault path**: `clients/lonestar/gururmm-site-warren.sops.yaml`
- **Site code**: WARM-FALCON-5891
- **Site ID**: 8146db49-cc9d-41b3-b8e6-972bf074510b
- **Client ID**: 9d17778d-e117-4dab-a190-7de7273a4a54
- **API key**: `grmm_J-czbQF3RCOl3Tnn20A3mPhZiPa_rkExZ4Z1I2nXVU` (regenerated 2026-06-03)

### Unraid Server (Tower)
- **Vault path**: `clients/lonestar/unraid-server.sops.yaml`
- **IP**: 172.16.1.188
- **Username**: root
- **Password**: `Gptf*77ttb123!@#-lonestar`
- **SSH**: Standard OpenSSH on port 22

---

## Infrastructure & Servers

### Unraid Server (Tower)
- **Hostname**: Tower
- **IP**: 172.16.1.188 (ACG office network - temporary)
- **OS**: Unraid 7.1.4
- **Location**: Physically at ACG office for repair, to be returned to client site week of 2026-06-08
- **USB migration**: Completed 2026-06-02, new USB registered
- **GuruRMM agent ID**: e827f798-bab1-484b-b641-98da7ff5af87
- **Agent version**: 0.6.28
- **Status**: Online, connected to RMM server

### GuruRMM Server
- **Internal URL**: ws://172.16.3.30:3001/ws (WebSocket)
- **HTTP API**: http://172.16.3.30:3001
- **External URL**: wss://rmm.azcomputerguru.com/ws (not reachable from office network)

### Docker Registry
- **Gitea registry**: git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest
- **Image digest**: sha256:2fe9c8fc496f194230d546613017e362712545fe502e5ded857e06488830ee5b

---

## Commands & Outputs

### Regenerate Site API Key
```bash
curl -s -X POST "$RMM/api/sites/8146db49-cc9d-41b3-b8e6-972bf074510b/regenerate-key" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json"
```

### Docker Pull and Run
```bash
# Pull image
docker pull git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest

# Run container
docker run -d \
  --name=gururmm-agent \
  --network=host \
  --restart=unless-stopped \
  -e GURURMM_CONFIG=/config/config.toml \
  -l net.unraid.docker.managed=dockerman \
  -v /dev/kvm:/dev/kvm:ro \
  -v /proc:/proc:ro \
  -v /sys:/sys:ro \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock:ro \
  -v /mnt/user/appdata/gururmm:/config \
  -v /mnt/user/appdata/gururmm/lib:/var/lib/gururmm \
  --entrypoint /usr/local/bin/gururmm-agent \
  git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest run
```

### Successful Enrollment Logs
```
[2026-06-04T00:28:23.416030Z] INFO WebSocket connected (HTTP status: 101 Switching Protocols)
[2026-06-04T00:28:23.874149Z] INFO Authentication successful, agent_id: Some(e827f798-bab1-484b-b641-98da7ff5af87)
[2026-06-04T00:28:23.878142Z] INFO Sending initial network state (3 interfaces)
[2026-06-04T00:28:23.882997Z] INFO Sent user inventory report: 1 users, join_type=none
[2026-06-04T00:28:23.957652Z] INFO Sent hardware inventory report
[2026-06-04T00:28:24.802105Z] INFO Applied config update from server
```

### Config File Format (Final Working Version)
```toml
[server]
url = "ws://172.16.3.30:3001/ws"
api_key = "grmm_J-czbQF3RCOl3Tnn20A3mPhZiPa_rkExZ4Z1I2nXVU"

[agent]
check_interval_secs = 30
```

---

## Pending / Incomplete Tasks

### GURU-KALI Service Status
- Todo item from previous session still pending: "Verify GURU-KALI gururmm-agent service status and restart if needed"
- GURU-KALI went offline during deployment attempt, needs physical access to verify

### Lonestar Unraid Server Documentation
- Mike to document full array/disk layout after server returned to client site
- Investigate LimeTech/Unraid API skill for future automation (Unraid 7.x ships GraphQL API)

---

## Reference Information

### GuruRMM Agent Details
- **Agent ID**: e827f798-bab1-484b-b641-98da7ff5af87
- **Hostname**: Tower
- **OS**: Debian GNU/Linux 12 (bookworm)
- **OS Version**: 12
- **Agent Version**: 0.6.28
- **Status**: online
- **Last Seen**: 2026-06-04T00:28:54.249686Z

### Lonestar Electrical Client
- **Client ID**: 9d17778d-e117-4dab-a190-7de7273a4a54
- **Client Name**: Lonestar Electrical
- **Site**: Warren
- **Site Code**: WARM-FALCON-5891
- **Site ID**: 8146db49-cc9d-41b3-b8e6-972bf074510b
- **Syncro Customer ID**: 33809612

### Container Details
- **Container ID**: 47e18cb03af5
- **Image**: git.azcomputerguru.com/azcomputerguru/gururmm-agent:latest
- **Created**: 2026-06-04T00:26:16Z
- **Status**: Running (auto-restart enabled)

### Vault Commits
- Warren site key: commit 4e3b93a "add: Lonestar Electrical GuruRMM site Warren enrollment key (WARM-FALCON-5891)"
- Unraid credentials: commit 824ae49 "add: Lonestar Unraid server (Tower) credentials and RMM enrollment details"

### Related Session Logs
- Jupiter Docker setup reference: `session-logs/2026-06-01-session.md`
- Lonestar Sophos removal: `clients/lonestar-electrical/session-logs/2026-06-02-session.md`
- Unraid USB migration: `clients/lonestar-electrical/session-logs/2026-06-02-session.md`
