openclaw/setup-ssh-keys.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

131 lines
3.2 KiB
Batchfile

@echo off
chcp 65001 >nul
title Setup SSH Keys for Moltbot Sync
echo ========================================
echo Moltbot SSH Key Setup
echo ========================================
echo.
echo This will configure SSH keys for passwordless session sync
echo.
set "SSH_DIR=%USERPROFILE%\.ssh"
set "SERVER=root@38.14.254.51"
REM Check if .ssh directory exists
if not exist "%SSH_DIR%" (
echo Creating .ssh directory...
mkdir "%SSH_DIR%"
)
REM Check if key already exists
if exist "%SSH_DIR%\id_rsa" (
echo SSH key already exists at %SSH_DIR%\id_rsa
echo.
choice /C YN /M "Do you want to generate a new key"
if errorlevel 2 goto skip_keygen
)
echo.
echo Generating SSH key pair...
ssh-keygen -t rsa -f "%SSH_DIR%\id_rsa" -N "" -C "moltbot-sync@%COMPUTERNAME%"
if errorlevel 1 (
echo ERROR: Failed to generate SSH key
echo Make sure ssh-keygen is installed (Git Bash or OpenSSH)
pause
exit /b 1
)
echo SSH key generated successfully!
:skip_keygen
echo.
echo ========================================
echo Copy Public Key to Server
echo ========================================
echo.
echo You need to copy the public key to the server.
echo.
echo Method 1: Automatic (requires password once)
echo -------------------------------------------
type "%SSH_DIR%\id_rsa.pub"
echo.
echo The above public key will be copied to: %SERVER%
echo.
choice /C YN /M "Continue with automatic setup"
if errorlevel 2 goto manual_setup
echo.
echo Copying public key to server...
type "%SSH_DIR%\id_rsa.pub" | ssh %SERVER% "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"
if errorlevel 1 (
echo.
echo WARNING: Automatic copy failed
echo.
goto manual_setup
)
echo.
echo Public key copied successfully!
goto test_connection
:manual_setup
echo.
echo ========================================
echo Manual Setup Instructions
echo ========================================
echo.
echo 1. Copy the public key below:
echo.
type "%SSH_DIR%\id_rsa.pub"
echo.
echo 2. Run this command on the server:
echo.
echo ssh %SERVER%
echo mkdir -p ~/.ssh
echo chmod 700 ~/.ssh
echo nano ~/.ssh/authorized_keys
echo.
echo 3. Paste the public key and save (Ctrl+X, Y, Enter)
echo.
echo 4. Set permissions:
echo.
echo chmod 600 ~/.ssh/authorized_keys
echo.
pause
:test_connection
echo.
echo ========================================
echo Test SSH Connection
echo ========================================
echo.
echo Testing passwordless connection to %SERVER%...
echo.
ssh -o BatchMode=yes -o ConnectTimeout=5 %SERVER% "echo 'Connection successful!'"
if errorlevel 1 (
echo.
echo WARNING: Passwordless connection test failed
echo You may need to enter your password once for SSH to cache the key
echo.
echo Try running: ssh %SERVER%
echo.
) else (
echo.
echo SUCCESS: Passwordless SSH connection is working!
echo Session sync will work without requiring a password.
)
echo.
echo ========================================
echo Setup Complete
echo ========================================
echo.
echo SSH key location: %SSH_DIR%\id_rsa
echo Server: %SERVER%
echo.
echo You can now run sync-sessions.bat without entering a password.
echo.
pause