Running and debugging from VS Code
The repository carries a .vscode folder that starts the whole stack with breakpoints on both sides: the Rust core under a debugger and the Vue UI in a browser attached to the editor.
What you need
- Docker, for PostgreSQL and Mailpit (
compose.dev.yml). - Rust, Node.js and pnpm, as for any other work on the project.
- The extensions VS Code offers when you open the folder (
.vscode/extensions.json). The one that matters is CodeLLDB (vadimcn.vscode-lldb): without it the core configurations do not start. - A Chromium-based browser. The UI configuration names
/usr/bin/chromium; changeruntimeExecutablein.vscode/launch.jsonto your browser, or delete the line to use Google Chrome.
Start everything
Open Run and Debug and choose Full stack: database, core and UI, then press F5. It:
- starts PostgreSQL and Mailpit and waits until they are healthy;
- installs the UI's dependencies, and builds
ui/distonce if it is missing, because the core embeds that directory at build time; - builds the core and runs
probeward serveunder the debugger, on127.0.0.1:8080; - starts the Vite dev server on
http://localhost:5173, which proxies/apito the core; - opens a browser on it, attached to the editor.
On an empty database the first page asks you to create the first administrator.
Breakpoints work in Rust files and in .vue and .ts files. A change to the UI reloads in the browser at once. A change to Rust needs a restart of the Core (serve) session, which rebuilds.
Where things are
| What | Where |
|---|---|
| UI in development | http://localhost:5173 |
| Core, API and the embedded UI build | http://127.0.0.1:8080 |
| PostgreSQL | postgres://probeward:probeward@127.0.0.1:54329/probeward |
| Mailpit inbox (for e-mail notifications) | http://127.0.0.1:54326, SMTP on 127.0.0.1:54325 |
| Vault key, probe state, the debug browser's profile | data/, which Git ignores |
The vault key in data/vault.key belongs to the development database. If you delete one, delete the other: run the task dev: services down (deletes the development data) and remove data/.
The other configurations
- Core (serve) and UI (browser on the Vite dev server) are the two halves of the full stack, for when you want only one.
- Core (serve, with the remote probe listener) also listens for remote probes on
127.0.0.1:8443. - Remote probe runs a second process in probe mode against that listener. Create a probe under Settings, Probes, and paste its pairing token when asked. The token is needed on the first start only; leave the prompt empty afterwards.
- UI unit tests (Vitest, current file) runs the test file that is open.
- Rust tests (server, filter by name) runs one of the server's test binaries under the debugger, with a test name filter.
- UI demo (sample estate, no core) runs
pnpm dev:demoonhttp://localhost:5174and opens a browser on it. No core and no database are needed: the dev server answers the API from a made-up, read-only estate. See the sample estate and the demo mode.
Tasks
Terminal, Run Task lists the same steps on their own, and check: fmt, clippy, UI and test: Rust, which run what just check, just ui-check and just test run.
Limits
- ICMP sensors need unprivileged ping sockets (
sysctl net.ipv4.ping_group_range); see install if a ping sensor reports that it may not open a socket. - Script and plugin sensors stay off until
PROBEWARD_SCRIPT_DIRis set in the configuration'senv. - The debugger shows the values of local variables. Credentials are in memory in a running core, so do not share a debug session or a core dump of an instance that holds real ones.