From 744bee40dfeb028a12c97c7ad2add4bf8da1aebd Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Tue, 29 Sep 2026 16:28:40 -0500 Subject: [PATCH] feat: log the build identifier at startup and show it on the dashboard About page Every server logs BuildInfo's build string as its version; the About page also shows the build kind and commit, and log bundles name the build. Co-Authored-By: Claude Opus 5.5 --- dAuthServer/AuthServer.cpp | 3 ++- dChatServer/ChatServer.cpp | 3 ++- dCommon/BuildInfo.h | 9 +++++++++ dDashboardServer/DashboardServer.cpp | 2 ++ dDashboardServer/routes/DashboardRoutes.cpp | 4 +++- dDashboardServer/routes/ServerRoutes.cpp | 3 ++- dDashboardServer/templates/about.jinja2 | 1 + dMasterServer/MasterServer.cpp | 3 ++- dUgcServer/UgcServer.cpp | 2 ++ dWorldServer/WorldServer.cpp | 3 ++- 10 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dAuthServer/AuthServer.cpp b/dAuthServer/AuthServer.cpp index 786d9d829..6a6c0d434 100644 --- a/dAuthServer/AuthServer.cpp +++ b/dAuthServer/AuthServer.cpp @@ -29,6 +29,7 @@ #include "Game.h" #include "Server.h" +#include "BuildInfo.h" namespace Game { Logger* logger = nullptr; @@ -60,7 +61,7 @@ int main(int argc, char** argv) { Game::config->LogSettings(); LOG("Starting Auth server..."); - LOG("Version: %s", PROJECT_VERSION); + LOG("Version: %s", std::string(BuildInfo::buildString).c_str()); LOG("Compiled on: %s", __TIMESTAMP__); try { diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index a1ed99c83..127955261 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -39,6 +39,7 @@ #include "MessageIdentifiers.h" #include "ChatWeb.h" +#include "BuildInfo.h" namespace Game { Logger* logger = nullptr; @@ -76,7 +77,7 @@ int main(int argc, char** argv) { //Read our config: LOG("Starting Chat server..."); - LOG("Version: %s", PROJECT_VERSION); + LOG("Version: %s", std::string(BuildInfo::buildString).c_str()); LOG("Compiled on: %s", __TIMESTAMP__); try { diff --git a/dCommon/BuildInfo.h b/dCommon/BuildInfo.h index 99e5f9277..e7bf00b01 100644 --- a/dCommon/BuildInfo.h +++ b/dCommon/BuildInfo.h @@ -32,6 +32,15 @@ namespace BuildInfo { return (static_cast(buildKind) & BUILD_KIND_MASK) | (dirty ? DIRTY_FLAG : 0); } + inline std::string_view BuildKindName() { + switch (buildKind) { + case eBuildKind::LOCAL: return "Local"; + case eBuildKind::CI: return "CI"; + case eBuildKind::RELEASE: return "Release"; + default: return "Unknown"; + } + } + // The first 32 bits (8 hex digits) of the commit hash, 0 without git. inline uint32_t CommitPrefix() { uint32_t value = 0; diff --git a/dDashboardServer/DashboardServer.cpp b/dDashboardServer/DashboardServer.cpp index e76b98859..37e204c3b 100644 --- a/dDashboardServer/DashboardServer.cpp +++ b/dDashboardServer/DashboardServer.cpp @@ -105,6 +105,7 @@ #include "PermissionGrantsLoader.h" #include "JWTUtils.h" #include "GeneralUtils.h" +#include "BuildInfo.h" #include #include @@ -376,6 +377,7 @@ int main(int argc, char** argv) { Game::config->LogSettings(); LOG("Starting Dashboard Server"); + LOG("Version: %s", std::string(BuildInfo::buildString).c_str()); // Load settings if (Game::config->GetValue("max_clients") != "") diff --git a/dDashboardServer/routes/DashboardRoutes.cpp b/dDashboardServer/routes/DashboardRoutes.cpp index 8bac7dc9b..3913c50a9 100644 --- a/dDashboardServer/routes/DashboardRoutes.cpp +++ b/dDashboardServer/routes/DashboardRoutes.cpp @@ -23,6 +23,7 @@ #include "GameLabels.h" #include "BehaviorXml.h" #include "ClientAssets.h" +#include "BuildInfo.h" #include #include #include @@ -484,7 +485,8 @@ void RegisterDashboardRoutes() { SimplePage("/settings", Perm("settings"), "settings.jinja2", "settings", "Server settings"); SimplePage("/client_assets", Perm("client_files"), "client_assets.jinja2", "client_assets", "Browse the game client's files"); Route(eHTTPMethod::GET, "/about", 0, "About this server", [](HTTPReply& reply, const HTTPContext& context) { - RenderPage(reply, context, "about.jinja2", "about", { {"version", PROJECT_VERSION} }); + RenderPage(reply, context, "about.jinja2", "about", { {"version", std::string(BuildInfo::buildString)}, + {"commit", std::string(BuildInfo::commit)}, {"dirty", BuildInfo::dirty}, {"buildKind", std::string(BuildInfo::BuildKindName())} }); }); // Logs diff --git a/dDashboardServer/routes/ServerRoutes.cpp b/dDashboardServer/routes/ServerRoutes.cpp index 91808f025..998ef85d7 100644 --- a/dDashboardServer/routes/ServerRoutes.cpp +++ b/dDashboardServer/routes/ServerRoutes.cpp @@ -27,6 +27,7 @@ #include "DashboardRoutes.h" #include "LogBundle.h" #include "Workers.h" +#include "BuildInfo.h" #ifdef __linux__ #include @@ -414,7 +415,7 @@ void RegisterServerRoutes() { const std::string downloadName = std::string("logs_") + stamp + ".zip"; const auto out = folder / ("bundle_" + std::to_string(context.accountId) + "_" + std::to_string(now) + "_" + std::to_string(++counter) + ".zip"); - std::string header = "DarkflameServer log bundle\nServer version: " PROJECT_VERSION "\nMade: " + std::string(made) + " (server time) by " + + std::string header = "DarkflameServer log bundle\nServer version: " + std::string(BuildInfo::buildString) + "\nMade: " + std::string(made) + " (server time) by " + context.authenticatedUser + "\nFilters: " + filter->ToJson().dump() + "\nSize limit: " + LogBundle::SizeText(maxBytes) + " before compression\n"; Audit(context, "download_logs", "Downloaded a log bundle: " + std::to_string(files.size()) + " file(s), " + LogBundle::SizeText(total) + " of logs; filters " + filter->ToJson().dump()); diff --git a/dDashboardServer/templates/about.jinja2 b/dDashboardServer/templates/about.jinja2 index e9ea4edb7..95e92fba0 100644 --- a/dDashboardServer/templates/about.jinja2 +++ b/dDashboardServer/templates/about.jinja2 @@ -7,6 +7,7 @@
DarkflameServer {{ version }}
+

{{ buildKind }} build{% if commit %} of commit {{ commit }}{% if dirty %} with uncommitted changes{% endif %}{% endif %}

A server emulator for LEGO® Universe. This dashboard is part of the server and replaces the separate NexusDashboard.

  • DarkflameServer on GitHub
  • diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index 0178100a6..cdf4d2aa4 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -56,6 +56,7 @@ #include "master/LiveUpdate.h" #include "master/ServerTraffic.h" #include "master/UgcModelsMade.h" +#include "BuildInfo.h" #ifdef DARKFLAME_PLATFORM_UNIX @@ -243,7 +244,7 @@ int main(int argc, char** argv) { LOG("Using net version %i", clientNetVersion); LOG("Starting Master server..."); - LOG("Version: %s", PROJECT_VERSION); + LOG("Version: %s", std::string(BuildInfo::buildString).c_str()); LOG("Compiled on: %s", __TIMESTAMP__); //Connect to the MySQL Database diff --git a/dUgcServer/UgcServer.cpp b/dUgcServer/UgcServer.cpp index 01c9c96fd..5b21752de 100644 --- a/dUgcServer/UgcServer.cpp +++ b/dUgcServer/UgcServer.cpp @@ -42,6 +42,7 @@ #include "UgcProcessor.h" #include "UgcStorage.h" #include "UgcThrottle.h" +#include "BuildInfo.h" namespace Game { Logger* logger = nullptr; @@ -646,6 +647,7 @@ int main(int argc, char** argv) { if (!Game::config->GetValue("dump_folder").empty()) Diagnostics::SetOutDirectory(Game::config->GetValue("dump_folder")); Game::config->LogSettings(); LOG("Starting UGC Server"); + LOG("Version: %s", std::string(BuildInfo::buildString).c_str()); const auto res = ResPath(); if (res.empty() || !std::filesystem::exists(res)) { diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 31cae21a6..9e5727755 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -107,6 +107,7 @@ #include "EffectsMessages.h" #include "MovementMessages.h" #include "ZoneMessages.h" +#include "BuildInfo.h" namespace Game { Logger* logger = nullptr; @@ -242,7 +243,7 @@ int main(int argc, char** argv) { Game::config->LogSettings(); LOG("Starting World server..."); - LOG("Version: %s", Game::projectVersion.c_str()); + LOG("Version: %s", std::string(BuildInfo::buildString).c_str()); LOG("Compiled on: %s", __TIMESTAMP__); g_ChatDisabled = Game::config->GetValue("disable_chat") == "1";