openclaw/register-device.bat
Claude Code 77645d143d feat: complete distributed Moltbot cluster enhancements
This commit adds comprehensive enhancements to the Moltbot distributed
cluster system, completing high and medium priority features.

Features Added:
- Web Management Panel (admin-panel.html)
  - Real-time database integration
  - Device management from database
  - Monitoring integration links (Grafana/Prometheus)
  - System health status indicator

- Database Persistence System
  - PostgreSQL database with 4 tables (conversations, devices, system_logs, statistics)
  - HTTP API at port 18800 for database operations
  - systemd service for auto-start

- Monitoring Stack (Grafana + Prometheus)
  - Docker Compose setup
  - Grafana: http://38.14.254.51:3000 (admin/moltbot2024)
  - Prometheus: http://38.14.254.51:9090
  - Node Exporter for system metrics

- Automation Scripts
  - notebook-auto-deploy.bat: Automated notebook deployment
  - register-device.bat: Device registration with database
  - setup-ssh-keys.bat: SSH key configuration for passwordless sync
  - sync-daemon.bat: Auto-sync every 10 minutes
  - sync-sessions.bat: Manual session sync

- Email/Webhook Alert System
  - Alert configuration at /opt/moltbot-monitoring/alert-config.json
  - Support for email, DingTalk, Slack, WeChat

- Session Synchronization
  - Server-side: /opt/moltbot-sync/sync-sessions.sh
  - Client-side: sync-sessions.bat
  - Cron job: */10 * * * * (every 10 minutes)
  - Backup rotation (keeps last 10)

Updated:
- ROADMAP.md: Marked completed features, updated progress

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 17:42:40 +08:00

92 lines
2.3 KiB
Batchfile

@echo off
chcp 65001 >nul
title Register Device with Moltbot Cluster
set "SERVER=root@38.14.254.51"
set "DB_API_URL=http://38.14.254.51:18800"
echo ========================================
echo Register Device with Cluster
echo ========================================
echo.
echo This will register this device with the Moltbot cluster database.
echo.
set "DEVICE_NAME=%COMPUTERNAME%"
set "DEVICE_TYPE=notebook"
REM Detect device type
echo Select device type:
echo [1] Notebook/Laptop
echo [2] Desktop
echo [3] Server
echo.
choice /C 123 /N /M "Select (1-3)"
if errorlevel 3 set "DEVICE_TYPE=server"
if errorlevel 2 set "DEVICE_TYPE=desktop"
if errorlevel 1 set "DEVICE_TYPE=notebook"
echo.
echo Device name: %DEVICE_NAME%
echo Device type: %DEVICE_TYPE%
echo.
REM Get local IP address
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /C:"IPv4"') do (
set "IP_ADDRESS=%%a"
set "IP_ADDRESS=!IP_ADDRESS: =!"
)
if "%IP_ADDRESS%"=="" set "IP_ADDRESS=unknown"
echo Local IP: %IP_ADDRESS%
echo.
choice /C YN /M "Register this device"
if errorlevel 2 (
echo Registration cancelled
pause
exit /b 0
)
echo.
echo Registering device...
REM Use curl to register with the database API
curl -s -X POST "%DB_API_URL%/api/device" ^
-H "Content-Type: application/json" ^
-d "{\"name\":\"%DEVICE_NAME%\",\"type\":\"%DEVICE_TYPE%\",\"ip\":\"%IP_ADDRESS%\",\"status\":\"online\"}" ^
-o "%TEMP%\register-response.json"
if errorlevel 1 (
echo.
echo WARNING: Could not connect to cluster database
echo.
echo You can register manually by running:
echo ssh %SERVER% "python3 /opt/moltbot-sync/db-storage.py update-device %DEVICE_NAME% %DEVICE_TYPE% %IP_ADDRESS%"
echo.
) else (
type "%TEMP%\register-response.json"
echo.
echo Device registered successfully!
)
REM Add device to server's known hosts
echo.
echo Adding device to monitoring system...
ssh %SERVER% "python3 /opt/moltbot-sync/db-storage.py update-device %DEVICE_NAME% %DEVICE_TYPE% %IP_ADDRESS% online"
echo.
echo ========================================
echo Registration Complete
echo ========================================
echo.
echo Device: %DEVICE_NAME%
echo Type: %DEVICE_TYPE%
echo Status: Registered
echo.
echo You can now view this device in:
echo - Admin Panel: admin-panel.html
echo - Grafana: http://38.14.254.51:3000
echo.
pause