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 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 16:28:40 -05:00
parent 05d18f56e4
commit 744bee40df
10 changed files with 27 additions and 6 deletions

View File

@@ -29,6 +29,7 @@
#include "Game.h" #include "Game.h"
#include "Server.h" #include "Server.h"
#include "BuildInfo.h"
namespace Game { namespace Game {
Logger* logger = nullptr; Logger* logger = nullptr;
@@ -60,7 +61,7 @@ int main(int argc, char** argv) {
Game::config->LogSettings(); Game::config->LogSettings();
LOG("Starting Auth server..."); LOG("Starting Auth server...");
LOG("Version: %s", PROJECT_VERSION); LOG("Version: %s", std::string(BuildInfo::buildString).c_str());
LOG("Compiled on: %s", __TIMESTAMP__); LOG("Compiled on: %s", __TIMESTAMP__);
try { try {

View File

@@ -39,6 +39,7 @@
#include "MessageIdentifiers.h" #include "MessageIdentifiers.h"
#include "ChatWeb.h" #include "ChatWeb.h"
#include "BuildInfo.h"
namespace Game { namespace Game {
Logger* logger = nullptr; Logger* logger = nullptr;
@@ -76,7 +77,7 @@ int main(int argc, char** argv) {
//Read our config: //Read our config:
LOG("Starting Chat server..."); LOG("Starting Chat server...");
LOG("Version: %s", PROJECT_VERSION); LOG("Version: %s", std::string(BuildInfo::buildString).c_str());
LOG("Compiled on: %s", __TIMESTAMP__); LOG("Compiled on: %s", __TIMESTAMP__);
try { try {

View File

@@ -32,6 +32,15 @@ namespace BuildInfo {
return (static_cast<uint8_t>(buildKind) & BUILD_KIND_MASK) | (dirty ? DIRTY_FLAG : 0); return (static_cast<uint8_t>(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. // The first 32 bits (8 hex digits) of the commit hash, 0 without git.
inline uint32_t CommitPrefix() { inline uint32_t CommitPrefix() {
uint32_t value = 0; uint32_t value = 0;

View File

@@ -105,6 +105,7 @@
#include "PermissionGrantsLoader.h" #include "PermissionGrantsLoader.h"
#include "JWTUtils.h" #include "JWTUtils.h"
#include "GeneralUtils.h" #include "GeneralUtils.h"
#include "BuildInfo.h"
#include <fstream> #include <fstream>
#include <filesystem> #include <filesystem>
@@ -376,6 +377,7 @@ int main(int argc, char** argv) {
Game::config->LogSettings(); Game::config->LogSettings();
LOG("Starting Dashboard Server"); LOG("Starting Dashboard Server");
LOG("Version: %s", std::string(BuildInfo::buildString).c_str());
// Load settings // Load settings
if (Game::config->GetValue("max_clients") != "") if (Game::config->GetValue("max_clients") != "")

View File

@@ -23,6 +23,7 @@
#include "GameLabels.h" #include "GameLabels.h"
#include "BehaviorXml.h" #include "BehaviorXml.h"
#include "ClientAssets.h" #include "ClientAssets.h"
#include "BuildInfo.h"
#include <chrono> #include <chrono>
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
@@ -484,7 +485,8 @@ void RegisterDashboardRoutes() {
SimplePage("/settings", Perm("settings"), "settings.jinja2", "settings", "Server settings"); 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"); 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) { 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 // Logs

View File

@@ -27,6 +27,7 @@
#include "DashboardRoutes.h" #include "DashboardRoutes.h"
#include "LogBundle.h" #include "LogBundle.h"
#include "Workers.h" #include "Workers.h"
#include "BuildInfo.h"
#ifdef __linux__ #ifdef __linux__
#include <unistd.h> #include <unistd.h>
@@ -414,7 +415,7 @@ void RegisterServerRoutes() {
const std::string downloadName = std::string("logs_") + stamp + ".zip"; 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"); 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"; 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) + Audit(context, "download_logs", "Downloaded a log bundle: " + std::to_string(files.size()) + " file(s), " + LogBundle::SizeText(total) +
" of logs; filters " + filter->ToJson().dump()); " of logs; filters " + filter->ToJson().dump());

View File

@@ -7,6 +7,7 @@
<div class="card mb-4" style="max-width: 720px;"> <div class="card mb-4" style="max-width: 720px;">
<div class="card-body"> <div class="card-body">
<h5>DarkflameServer <span class="text-body-secondary">{{ version }}</span></h5> <h5>DarkflameServer <span class="text-body-secondary">{{ version }}</span></h5>
<p class="small text-body-secondary">{{ buildKind }} build{% if commit %} of commit <code>{{ commit }}</code>{% if dirty %} with uncommitted changes{% endif %}{% endif %}</p>
<p>A server emulator for LEGO&reg; Universe. This dashboard is part of the server and replaces the separate NexusDashboard.</p> <p>A server emulator for LEGO&reg; Universe. This dashboard is part of the server and replaces the separate NexusDashboard.</p>
<ul class="mb-0"> <ul class="mb-0">
<li><a href="https://github.com/DarkflameUniverse/DarkflameServer" target="_blank" rel="noopener">DarkflameServer on GitHub</a></li> <li><a href="https://github.com/DarkflameUniverse/DarkflameServer" target="_blank" rel="noopener">DarkflameServer on GitHub</a></li>

View File

@@ -56,6 +56,7 @@
#include "master/LiveUpdate.h" #include "master/LiveUpdate.h"
#include "master/ServerTraffic.h" #include "master/ServerTraffic.h"
#include "master/UgcModelsMade.h" #include "master/UgcModelsMade.h"
#include "BuildInfo.h"
#ifdef DARKFLAME_PLATFORM_UNIX #ifdef DARKFLAME_PLATFORM_UNIX
@@ -243,7 +244,7 @@ int main(int argc, char** argv) {
LOG("Using net version %i", clientNetVersion); LOG("Using net version %i", clientNetVersion);
LOG("Starting Master server..."); LOG("Starting Master server...");
LOG("Version: %s", PROJECT_VERSION); LOG("Version: %s", std::string(BuildInfo::buildString).c_str());
LOG("Compiled on: %s", __TIMESTAMP__); LOG("Compiled on: %s", __TIMESTAMP__);
//Connect to the MySQL Database //Connect to the MySQL Database

View File

@@ -42,6 +42,7 @@
#include "UgcProcessor.h" #include "UgcProcessor.h"
#include "UgcStorage.h" #include "UgcStorage.h"
#include "UgcThrottle.h" #include "UgcThrottle.h"
#include "BuildInfo.h"
namespace Game { namespace Game {
Logger* logger = nullptr; 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")); if (!Game::config->GetValue("dump_folder").empty()) Diagnostics::SetOutDirectory(Game::config->GetValue("dump_folder"));
Game::config->LogSettings(); Game::config->LogSettings();
LOG("Starting UGC Server"); LOG("Starting UGC Server");
LOG("Version: %s", std::string(BuildInfo::buildString).c_str());
const auto res = ResPath(); const auto res = ResPath();
if (res.empty() || !std::filesystem::exists(res)) { if (res.empty() || !std::filesystem::exists(res)) {

View File

@@ -107,6 +107,7 @@
#include "EffectsMessages.h" #include "EffectsMessages.h"
#include "MovementMessages.h" #include "MovementMessages.h"
#include "ZoneMessages.h" #include "ZoneMessages.h"
#include "BuildInfo.h"
namespace Game { namespace Game {
Logger* logger = nullptr; Logger* logger = nullptr;
@@ -242,7 +243,7 @@ int main(int argc, char** argv) {
Game::config->LogSettings(); Game::config->LogSettings();
LOG("Starting World server..."); 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__); LOG("Compiled on: %s", __TIMESTAMP__);
g_ChatDisabled = Game::config->GetValue("disable_chat") == "1"; g_ChatDisabled = Game::config->GetValue("disable_chat") == "1";