Browse Source

fix: find the MySQL client where no .pc file exists, and document the split

Two things that only showed up once the services moved to zeus (Void Linux).

FindPackages looked for the MySQL client through pkg-config only, as libmariadb
or mysqlclient. Void installs mysql_config and ships no pkg-config module at
all, so both checks missed and the build carried on with MySQL node support
disabled behind a single STATUS line. The result is a runner whose registered
node list is quietly missing mysql-query: workflows using it fail with an
unknown node type on that host and work everywhere else. It now falls back to
mariadb_config/mysql_config, which is how this library has always been found.

CLAUDE.md said to restart with systemctl. There is no systemctl on Void - it
answers "command not found", which reads like a typo rather than the wrong
machine. It now names which host each service is on, which init system manages
it, and the four addresses that have to point across the network, including
what breaks for each when it is missed.
fszontagh 3 weeks ago
parent
commit
0e8c2b32a8
2 changed files with 62 additions and 16 deletions
  1. 37 14
      CLAUDE.md
  2. 25 2
      cmake/FindPackages.cmake

+ 37 - 14
CLAUDE.md

@@ -37,8 +37,17 @@ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
 cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON
 ```
 
-After building a service, restart it to actually run the new binary:
-`systemctl --user restart smartbotic-webserver smartbotic-runner`.
+After building a service, restart it to actually run the new binary. **The two
+services live on different machines and are managed by different init systems**
+(split 2026-09-03):
+
+| | host | restart with |
+| --- | --- | --- |
+| webserver | zeus (Void Linux, runit) | `sudo sv restart smartbotic-webserver` |
+| runner | mulan (Debian, systemd) | `ssh mulan systemctl --user restart smartbotic-runner` |
+
+There is no `systemctl` on zeus at all - it prints "command not found" rather
+than failing in any way that looks like a wrong host.
 
 ### Frontend (webui/)
 ```bash
@@ -52,24 +61,38 @@ npm run lint     # ESLint
 ## Running Services
 
 The database is **not** built from this repo - it is the standalone upstream
-`smartbotic-database` daemon, installed from the SmartBotics APT repository and
-managed as a system service. Start it first, then the in-repo services:
+`smartbotic-database` daemon. It runs on zeus as the Docker container
+`smartbotic-db` (moved there 2026-08-09; it and the SD.cpp REST API could not
+share mulan's memory), so it is neither an APT package nor a system service on
+the host any more. It is already up; the in-repo services connect to it:
 
 ```bash
-# 1. Upstream database daemon (gRPC port 9004)
-sudo systemctl start smartbotic-database
-
-# 2. WebServer (HTTP port 8090, gRPC port 9012)
-./build/smartbotic-webserver
+# 1. Database daemon - already running on zeus as the Docker container
+#    `smartbotic-db`, published on 9004. Not started from this repo.
+docker ps --filter name=smartbotic-db
 
-# 3. Runner(s) (gRPC port 9011)
-./build/smartbotic-runner
+# 2. WebServer on zeus (HTTP 8090, WebSocket 8091, gRPC 9012 + 9013)
+sudo sv status smartbotic-webserver          # runit, not systemd
+tail -f /var/log/smartbotic-webserver/current
 
-# Or use systemd for the in-repo services
-systemctl --user start smartbotic.target
-journalctl --user -u smartbotic-* -f
+# 3. Runner on mulan (gRPC port 9011)
+ssh mulan systemctl --user status smartbotic-runner
+ssh mulan journalctl --user -u smartbotic-runner -f
 ```
 
+Because the two are split, three addresses must point across the network. They
+are env overrides in a systemd drop-in on mulan
+(`~/.config/systemd/user/smartbotic-runner.service.d/zeus-webserver.conf`), NOT
+in `config/runner.json` - that file is tracked in git and shared by both hosts,
+so its `localhost` defaults cannot be edited per machine:
+
+| variable | value | what breaks without it |
+| --- | --- | --- |
+| `WEBSERVER_ADDRESS` | `zeus.fsociety.hu:8090` | the runner never registers |
+| `NODE_SYNC_ADDRESS` | `zeus.fsociety.hu:9012` | no node updates reach it |
+| `CREDENTIAL_SERVICE_ADDRESS` | `zeus.fsociety.hu:9013` | credentials and workflow-control fail |
+| `ADVERTISE_ADDRESS` | `mulan.fsociety.hu:9011` | the runner registers as `localhost:9011`, reports **online**, and dispatches silently go to the webserver's own host |
+
 Both the database address and the project namespace are configurable everywhere,
 via `config/webserver.json` and `config/runner.json`:
 

+ 25 - 2
cmake/FindPackages.cmake

@@ -50,8 +50,31 @@ else()
         set(MYSQL_CLIENT_FOUND TRUE CACHE BOOL "MySQL client library found")
         message(STATUS "Found MySQL client library")
     else()
-        set(MYSQL_CLIENT_FOUND FALSE CACHE BOOL "MySQL client library found")
-        message(STATUS "MySQL/MariaDB client library not found - MySQL node support disabled")
+        # Not every distribution ships a .pc file for the client. Void, for one,
+        # installs mysql_config and no pkg-config module at all - so both checks
+        # above miss and the mysql-query node disappears from the build with only
+        # a STATUS line to say so. A runner built that way registers a node list
+        # silently missing mysql-query, and a workflow using it fails with
+        # "unknown node type" on that host and works on every other.
+        find_program(MYSQL_CONFIG_EXECUTABLE NAMES mariadb_config mysql_config)
+        if(MYSQL_CONFIG_EXECUTABLE)
+            execute_process(COMMAND ${MYSQL_CONFIG_EXECUTABLE} --cflags
+                            OUTPUT_VARIABLE _mysql_cflags
+                            OUTPUT_STRIP_TRAILING_WHITESPACE)
+            execute_process(COMMAND ${MYSQL_CONFIG_EXECUTABLE} --libs
+                            OUTPUT_VARIABLE _mysql_libs
+                            OUTPUT_STRIP_TRAILING_WHITESPACE)
+            separate_arguments(_mysql_cflags NATIVE_COMMAND "${_mysql_cflags}")
+            separate_arguments(_mysql_libs NATIVE_COMMAND "${_mysql_libs}")
+            add_library(mysql_client INTERFACE)
+            target_compile_options(mysql_client INTERFACE ${_mysql_cflags})
+            target_link_libraries(mysql_client INTERFACE ${_mysql_libs})
+            set(MYSQL_CLIENT_FOUND TRUE CACHE BOOL "MySQL client library found")
+            message(STATUS "Found MySQL client library via ${MYSQL_CONFIG_EXECUTABLE}")
+        else()
+            set(MYSQL_CLIENT_FOUND FALSE CACHE BOOL "MySQL client library found")
+            message(STATUS "MySQL/MariaDB client library not found - MySQL node support disabled")
+        endif()
     endif()
 endif()