Files
Alexandr Stelnykovych eaa9fc84c7 fix(observation-hub): run on an instance of its own
The observation hub has been broken since November 2024 and could not
report anything:

- Since commit 706ce222d (2024-11-27, first in the repository tag
  v2.0.20) it used Portmaster's full instance. There the SPN modules only
  start for an integrated client, so the tool never connected and the
  observer waited forever. A failed instance creation also ended in a
  nil-pointer panic, because the error was ignored.
- Since commit 80664d1a2 (2024-08-09, first in the repository tag
  v1.6.19) the Apprise module was never added and the observer was added
  twice instead. Nothing was sent to the chat rooms, without any error
  message.

The hub's instance is no better fit: it installs binary updates by
itself, which here would install Portmaster's binaries, and it lacks the
notifications module. The SPN client's connection loop reports failures
as notifications and panics without that module; the hub never runs
that loop.

- Add a small instance with only the modules the tool uses: the SPN
  client, intel updates and notifications, but no binary updater and no
  core module. The tool is updated by replacing its container image.
- Add the Apprise module once and before the observer.
- Return the errors of the instance creation instead of ignoring them.
- Require a data directory, so that the data of an installed Portmaster
  is never used.
- Remove --bin-dir and the update command: there are no binaries to
  manage, and the command would install Portmaster's.
- Add a VS Code debug entry for the observation hub.
2026-11-19 11:49:42 +02:00

69 lines
2.6 KiB
JSON

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "portmaster-core",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmds/portmaster-core",
"output": "${workspaceFolder}/__portmaster-core-debug",
"windows": {
"args": ["--bin-dir=C:\\Program Files\\Portmaster", "--log-stdout", "--log", "trace"]
},
"linux": {
"console": "integratedTerminal", // required to debug as root
"asRoot": true, // required to debug as root
"args": ["--bin-dir=/usr/lib/portmaster", "--log-stdout", "--log", "trace"]
},
},
{
"name": "portmaster-core (NO INTERCEPTION)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmds/portmaster-core",
"output": "${workspaceFolder}/__portmaster-core-debug",
"windows": {
"args": ["--bin-dir=C:\\Program Files\\Portmaster", "--log-stdout", "--log", "trace", "--disable-interception=true"]
},
"linux": {
"console": "integratedTerminal", // required to debug as root
"asRoot": true, // required to debug as root
"args": ["--bin-dir=/usr/lib/portmaster", "--log-stdout", "--log", "trace", "--disable-interception=true"]
},
},
{
"name": "observation-hub",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmds/observation-hub",
"output": "${workspaceFolder}/__observation-hub-debug",
"windows": {
// Start VS Code as administrator.
"args": [
"--data-dir=${env:LOCALAPPDATA}\\observation-hub-debug",
"--log-stdout", "--log", "debug",
"--report-all-changes", "--reporting-delay", "10s"
]
},
"linux": {
"args": [
"--data-dir=${env:HOME}/.cache/observation-hub-debug",
"--log-stdout", "--log", "debug",
"--report-all-changes", "--reporting-delay", "10s"
]
},
}
]
}