feat: auto-discovery

This commit is contained in:
2025-08-25 12:05:51 +02:00
parent f72e4ba220
commit 5977a37d6c
8 changed files with 552 additions and 3 deletions

View File

@@ -71,6 +71,7 @@ The backend now includes automatic UDP discovery for SPORE nodes on the network.
- `GET /api/discovery/nodes` - View all discovered nodes and current status
- `POST /api/discovery/refresh` - Manually trigger discovery refresh
- `POST /api/discovery/primary/:ip` - Manually set a specific node as primary
- `POST /api/discovery/random-primary` - Randomly select a new primary node
- `GET /api/health` - Health check including discovery status
### Testing Discovery
@@ -86,8 +87,21 @@ npm run test-discovery 192.168.1.100
# Send multiple messages
npm run test-discovery broadcast 5
# Test random primary node selection
npm run test-random-selection
```
### Frontend Features
The frontend now includes:
- **Primary Node Display**: Shows the current primary node IP in the cluster header
- **Random Selection**: Click the 🎲 button to randomly select a new primary node
- **Real-time Updates**: Primary node display updates automatically every 10 seconds
- **Visual Status Indicators**: Different colors and icons show node status
- **Manual Refresh**: Users can manually trigger discovery updates
### Node Behavior
- Nodes should send `CLUSTER_DISCOVERY` messages periodically (recommended: every 30-60 seconds)