-
Notifications
You must be signed in to change notification settings - Fork 785
Expand file tree
/
Copy pathmeshnode.bat
More file actions
110 lines (96 loc) · 2.82 KB
/
meshnode.bat
File metadata and controls
110 lines (96 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@echo off
title ShadowBroker - Mesh Node
color 0B
echo ===================================================
echo S H A D O W B R O K E R -- MESH NODE
echo ===================================================
echo.
echo Lightweight node — syncs the Infonet chain only.
echo No map, no frontend, no data feeds.
echo Close this window to stop the node.
echo.
:: Check for Python
where python >nul 2>&1
if %errorlevel% neq 0 (
echo [!] ERROR: Python is not installed or not in PATH.
echo [!] Install Python 3.10-3.12 from https://python.org
echo [!] IMPORTANT: Check "Add to PATH" during install.
echo.
pause
exit /b 1
)
:: Check Python version
for /f "tokens=2 delims= " %%v in ('python --version 2^>^&1') do set PYVER=%%v
echo [*] Found Python %PYVER%
:: Kill anything on port 8000
echo [*] Clearing port 8000...
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":8000 " ^| findstr "LISTENING"') do (
taskkill /F /PID %%a >nul 2>&1
)
timeout /t 1 /nobreak >nul
cd backend
:: Setup venv
where uv >nul 2>&1
if %errorlevel% neq 0 goto :use_pip
echo [*] Using UV for Python dependency management.
if not exist "venv\" (
echo [*] Creating Python virtual environment...
uv venv
if %errorlevel% neq 0 (
echo [!] ERROR: Failed to create virtual environment.
pause
exit /b 1
)
)
call venv\Scripts\activate.bat
echo [*] Installing Python dependencies via UV (fast)...
cd ..
uv sync --frozen --no-dev
if %errorlevel% neq 0 goto :dep_fail
cd backend
goto :deps_ok
:use_pip
if not exist "venv\" (
echo [*] Creating Python virtual environment...
python -m venv venv
if %errorlevel% neq 0 (
echo [!] ERROR: Failed to create virtual environment.
pause
exit /b 1
)
)
call venv\Scripts\activate.bat
echo [*] Installing Python dependencies...
pip install -q -r requirements.txt
if %errorlevel% neq 0 goto :dep_fail
goto :deps_ok
:dep_fail
echo.
echo [!] ERROR: Python dependency install failed.
pause
exit /b 1
:deps_ok
echo [*] Dependencies OK.
:: Install ws package for ais_proxy (needed even in mesh-only mode to avoid import errors)
if not exist "node_modules\ws" (
echo [*] Installing backend Node.js dependencies...
where npm >nul 2>&1
if %errorlevel% equ 0 (
call npm ci --omit=dev --silent 2>nul
)
)
:: Auto-enable the node on startup
echo [*] Auto-enabling node participation...
if not exist "data\" mkdir data
echo {"enabled":true,"updated_at":0} > data\node.json
echo.
echo ===================================================
echo Mesh node starting on port 8000
echo Mode: MESH_ONLY (no data feeds)
echo Relay: %MESH_RELAY_PEERS%
echo Press Ctrl+C to stop
echo ===================================================
echo.
set MESH_ONLY=true
set MESH_NODE_MODE=participant
python -m uvicorn main:app --host 0.0.0.0 --port 8000