diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..13de7e3 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,104 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Tracker: start local (8080)", + "type": "debugpy", + "request": "launch", + "module": "meshnet_tracker.cli", + "args": [ + "start", + "--host", + "0.0.0.0", + "--port", + "8080" + ], + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}/packages/tracker:${workspaceFolder}/packages/node:${workspaceFolder}/packages/relay:${workspaceFolder}/packages/gateway:${workspaceFolder}/packages/p2p:${workspaceFolder}/packages/sdk:${workspaceFolder}/packages/validator:${env:PYTHONPATH}" + } + }, + { + "name": "Tracker: start public + relay (8081)", + "type": "debugpy", + "request": "launch", + "module": "meshnet_tracker.cli", + "args": [ + "start", + "--host", + "0.0.0.0", + "--port", + "8081", + "--relay-url", + "wss://ai.neuron.d-popov.com/ws" + ], + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}/packages/tracker:${workspaceFolder}/packages/node:${workspaceFolder}/packages/relay:${workspaceFolder}/packages/gateway:${workspaceFolder}/packages/p2p:${workspaceFolder}/packages/sdk:${workspaceFolder}/packages/validator:${env:PYTHONPATH}" + } + }, + { + "name": "Node: dashboard UI (saved config)", + "type": "debugpy", + "request": "launch", + "module": "meshnet_node.cli", + "args": [ + "--tracker", + "http://localhost:8080", + "--model", + "stub-model", + "--port", + "7000", + "--debug" + ], + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}/packages/tracker:${workspaceFolder}/packages/node:${workspaceFolder}/packages/relay:${workspaceFolder}/packages/gateway:${workspaceFolder}/packages/p2p:${workspaceFolder}/packages/sdk:${workspaceFolder}/packages/validator:${env:PYTHONPATH}" + } + }, + { + "name": "Node: start local stub (no dashboard)", + "type": "debugpy", + "request": "launch", + "module": "meshnet_node.cli", + "args": [ + "start", + "--tracker", + "http://localhost:8080", + "--model", + "stub-model", + "--host", + "0.0.0.0", + "--port", + "7001", + "--debug" + ], + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}/packages/tracker:${workspaceFolder}/packages/node:${workspaceFolder}/packages/relay:${workspaceFolder}/packages/gateway:${workspaceFolder}/packages/p2p:${workspaceFolder}/packages/sdk:${workspaceFolder}/packages/validator:${env:PYTHONPATH}" + } + } + ], + "compounds": [ + { + "name": "Local mesh: tracker + node UI", + "configurations": [ + "Tracker: start local (8080)", + "Node: dashboard UI (saved config)" + ], + "stopAll": true + }, + { + "name": "Local mesh: tracker + stub node", + "configurations": [ + "Tracker: start local (8080)", + "Node: start local stub (no dashboard)" + ], + "stopAll": true + } + ] +} diff --git a/QUICKSTART.md b/QUICKSTART.md index 5bc29a9..b02e71b 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -30,6 +30,75 @@ python3 -m venv .venv > **NVIDIA GPU (CUDA):** replace the torch line with `pip install torch` (default index). > **AMD GPU (ROCm):** `pip install torch --index-url https://download.pytorch.org/whl/rocm6.2` +## Bootstrap a tracker on a new machine + +Use this when provisioning a fresh LAN/public tracker host. The tracker itself is +lightweight; install the relay too if nodes will connect from NAT, WSL2, mobile, +or other networks where inbound node ports are not reachable. + +```bash +# 1. Get the repo onto the tracker host +git clone https://git.d-popov.com/popov/neuron-tai.git AI +cd AI + +# 2. Create an isolated Python environment +python3 -m venv .venv +.venv/bin/python -m pip install --upgrade pip setuptools wheel + +# 3. Install only the services needed by the tracker host +.venv/bin/pip install -e packages/tracker -e packages/relay -e packages/gateway +``` + +For a private LAN tracker, start only the tracker and open the selected TCP port +on the host firewall if other machines will join: + +```bash +.venv/bin/meshnet-tracker start --host 0.0.0.0 --port 8080 +``` + +Verify from the tracker host: + +```bash +curl -s http://localhost:8080/v1/network/map | python3 -m json.tool +``` + +Verify from another LAN machine, replacing the IP with the tracker host's LAN IP: + +```bash +curl -s http://192.168.0.179:8080/v1/network/map | python3 -m json.tool +``` + +For a public tracker with relay support, run both services. The relay listens on +`8765`; the tracker below listens on `8081` and advertises the public WebSocket +URL that nodes should use for outbound relay connections: + +```bash +# Terminal 1 — relay +.venv/bin/meshnet-relay --host 0.0.0.0 --port 8765 + +# Terminal 2 — tracker +.venv/bin/meshnet-tracker start \ + --host 0.0.0.0 \ + --port 8081 \ + --relay-url wss://ai.neuron.d-popov.com/ws +``` + +If this host sits behind Nginx Proxy Manager, point `/` and `/v1/*` at tracker +port `8081`, and point `/ws` plus `/rpc` at relay port `8765` as shown in the +public tracker section below. After the proxy is configured, verify the public +bootstrap endpoint: + +```bash +curl -s https://ai.neuron.d-popov.com/v1/network/map | python3 -m json.tool +``` + +Nodes can then join with either the LAN tracker URL or the public URL: + +```bash +.venv/bin/meshnet-node start --tracker http://192.168.0.179:8080 --model Qwen/Qwen2.5-0.5B-Instruct +.venv/bin/meshnet-node start --tracker https://ai.neuron.d-popov.com --model Qwen/Qwen2.5-0.5B-Instruct +``` + ### Windows / WSL2 Run the Linux commands from WSL, not Git Bash. From the repo opened in Git Bash: