From 142b6fa47a1ea6009f63fe455f9ce9ecde67cfe7 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 21 Dec 2023 11:13:51 +0100 Subject: [PATCH 01/11] modify build scripts to generate .debug files with debug info --- scripts/debian-11/2-configure.sh | 2 +- scripts/debian-11/3-build.sh | 5 +++++ scripts/ubuntu-22.04/2-configure.sh | 2 +- scripts/ubuntu-22.04/3-build.sh | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/debian-11/2-configure.sh b/scripts/debian-11/2-configure.sh index d1ad553..a1efec9 100755 --- a/scripts/debian-11/2-configure.sh +++ b/scripts/debian-11/2-configure.sh @@ -2,4 +2,4 @@ set -ex -cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -s -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON +cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON diff --git a/scripts/debian-11/3-build.sh b/scripts/debian-11/3-build.sh index 28fee9b..4671942 100755 --- a/scripts/debian-11/3-build.sh +++ b/scripts/debian-11/3-build.sh @@ -3,3 +3,8 @@ set -ex cmake --build bin --parallel -t BeamMP-Server + +objcopy --only-keep-debug bin/BeamMP-Server bin/BeamMP-Server.debug +objcopy --add-gnu-debuglink bin/BeamMP-Server bin/BeamMP-Server.debug + +strip -s bin/BeamMP-Server diff --git a/scripts/ubuntu-22.04/2-configure.sh b/scripts/ubuntu-22.04/2-configure.sh index d1ad553..a1efec9 100755 --- a/scripts/ubuntu-22.04/2-configure.sh +++ b/scripts/ubuntu-22.04/2-configure.sh @@ -2,4 +2,4 @@ set -ex -cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -s -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON +cmake . -B bin $1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON diff --git a/scripts/ubuntu-22.04/3-build.sh b/scripts/ubuntu-22.04/3-build.sh index 28fee9b..4671942 100755 --- a/scripts/ubuntu-22.04/3-build.sh +++ b/scripts/ubuntu-22.04/3-build.sh @@ -3,3 +3,8 @@ set -ex cmake --build bin --parallel -t BeamMP-Server + +objcopy --only-keep-debug bin/BeamMP-Server bin/BeamMP-Server.debug +objcopy --add-gnu-debuglink bin/BeamMP-Server bin/BeamMP-Server.debug + +strip -s bin/BeamMP-Server From e1dfb1085e6cb920e2f4ff03a2336e62b27d80fe Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 21 Dec 2023 11:17:17 +0100 Subject: [PATCH 02/11] modify release workflows to add debug info artifacts --- .github/workflows/linux.yml | 12 ++++++++++++ .github/workflows/release.yml | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9b7de8c..593e2b8 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -47,6 +47,12 @@ jobs: name: BeamMP-Server-debian path: ./bin/BeamMP-Server + - name: Archive server debug info artifact + uses: actions/upload-artifact@v2 + with: + name: BeamMP-Server-debian.debug + path: ./bin/BeamMP-Server.debug + - name: Build Tests run: bash ./scripts/debian-11/3-build-tests.sh @@ -101,6 +107,12 @@ jobs: name: BeamMP-Server-ubuntu path: ./bin/BeamMP-Server + - name: Archive server debug info artifact + uses: actions/upload-artifact@v2 + with: + name: BeamMP-Server-ubuntu.debug + path: ./bin/BeamMP-Server.debug + - name: Build Tests run: bash ./scripts/ubuntu-22.04/3-build-tests.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1105fd5..46ae3df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,6 +83,17 @@ jobs: asset_path: ./bin/BeamMP-Server asset_name: BeamMP-Server-debian asset_content_type: application/x-elf + + - name: Upload Debug Info + id: upload-debug-info + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./bin/BeamMP-Server.debug + asset_name: debuginfo-debian.debug + asset_content_type: application/x-elf upload-release-files-ubuntu-22-04: name: Build and upload Ubuntu 22.04 Release Files @@ -131,6 +142,17 @@ jobs: asset_name: BeamMP-Server-ubuntu asset_content_type: application/x-elf + - name: Upload Debug Info + id: upload-debug-info + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./bin/BeamMP-Server.debug + asset_name: debuginfo-ubuntu.debug + asset_content_type: application/x-elf + upload-release-files-windows: name: Build and upload Windows Release Files runs-on: windows-latest From c741fe531054911df12e9ca0d6ac5a735ecd7eae Mon Sep 17 00:00:00 2001 From: Lion Date: Thu, 21 Dec 2023 12:17:11 +0100 Subject: [PATCH 03/11] remove [Feature Request] from issue title --- .github/ISSUE_TEMPLATE/feature_request.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 40f750b..e25bd13 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,6 @@ --- name: Feature request about: Suggest an idea for this project -title: "[Feature Request]" labels: enhancement assignees: '' From c3895ec1cad29082d79eedf3da69a6337760ca10 Mon Sep 17 00:00:00 2001 From: Lion Date: Thu, 21 Dec 2023 12:17:50 +0100 Subject: [PATCH 04/11] remove [Bug] title from issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e86b6b2..baabd36 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,6 @@ --- name: Bug report about: Create a report to help us improve -title: "[Bug] Enter issue title here" labels: bug assignees: '' From ddd3883aa972a5a5801ffd847657016a05439351 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 21 Dec 2023 12:21:16 +0100 Subject: [PATCH 05/11] fix failing gh actions test run --- .github/workflows/linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9b7de8c..ab3fa4e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -116,7 +116,7 @@ jobs: container: image: debian:11 steps: - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: BeamMP-Server-debian-tests @@ -136,7 +136,7 @@ jobs: container: image: ubuntu:22.04 steps: - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: BeamMP-Server-ubuntu-tests From 2fc610f6bcefd6c8c9e9e1e4b91365f2baf7b612 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 21 Dec 2023 13:01:14 +0100 Subject: [PATCH 06/11] fix tests not downloading artifacts by not using artifacts --- .github/workflows/linux.yml | 54 +++++-------------------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ab3fa4e..86980de 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -50,11 +50,11 @@ jobs: - name: Build Tests run: bash ./scripts/debian-11/3-build-tests.sh - - name: Archive server tests artifact - uses: actions/upload-artifact@v2 - with: - name: BeamMP-Server-debian-tests - path: ./bin/BeamMP-Server-tests + - name: Install Runtime Dependencies + run: bash ./scripts/debian-11/4-install-runtime-deps.sh + + - name: Test + run: ./bin/BeamMP-Server-tests ubuntu-22-04-build: runs-on: ubuntu-latest @@ -104,48 +104,8 @@ jobs: - name: Build Tests run: bash ./scripts/ubuntu-22.04/3-build-tests.sh - - name: Archive server tests artifact - uses: actions/upload-artifact@v2 - with: - name: BeamMP-Server-ubuntu-tests - path: ./bin/BeamMP-Server-tests - - run-debian-11-tests: - needs: debian-11-build - runs-on: ubuntu-latest - container: - image: debian:11 - steps: - - uses: actions/download-artifact@v4 - with: - name: BeamMP-Server-debian-tests - - name: Install Runtime Dependencies - run: | - apt-get update -y - apt-get install -y liblua5.3-0 + run: bash ./scripts/ubuntu-22.04/4-install-runtime-deps.sh - name: Test - run: | - chmod +x ./BeamMP-Server-tests - ./BeamMP-Server-tests - - run-ubuntu-22-04-tests: - needs: ubuntu-22-04-build - runs-on: ubuntu-latest - container: - image: ubuntu:22.04 - steps: - - uses: actions/download-artifact@v4 - with: - name: BeamMP-Server-ubuntu-tests - - - name: Install Runtime Dependencies - run: | - apt-get update -y - apt-get install -y liblua5.3-0 - - - name: Test - run: | - chmod +x ./BeamMP-Server-tests - ./BeamMP-Server-tests + run: ./bin/BeamMP-Server-tests \ No newline at end of file From ac41547123bdb2c6314055f690b30a20e65e213b Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 21 Dec 2023 13:05:33 +0100 Subject: [PATCH 07/11] bump version to 3.1.4 --- include/Common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Common.h b/include/Common.h index c5e07e1..85e6202 100644 --- a/include/Common.h +++ b/include/Common.h @@ -133,7 +133,7 @@ private: static inline std::mutex mShutdownHandlersMutex {}; static inline std::deque mShutdownHandlers {}; - static inline Version mVersion { 3, 1, 3 }; + static inline Version mVersion { 3, 1, 4 }; }; std::string ThreadName(bool DebugModeOverride = false); From b28c69a51531c928cf08cf614a9f14572e8a5675 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 21 Dec 2023 13:07:35 +0100 Subject: [PATCH 08/11] remove http settings from config --- src/TConfig.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/TConfig.cpp b/src/TConfig.cpp index 645325b..c1ddb9a 100644 --- a/src/TConfig.cpp +++ b/src/TConfig.cpp @@ -25,14 +25,6 @@ static constexpr std::string_view StrSendErrors = "SendErrors"; static constexpr std::string_view StrSendErrorsMessageEnabled = "SendErrorsShowMessage"; static constexpr std::string_view StrHideUpdateMessages = "ImScaredOfUpdates"; -// HTTP -static constexpr std::string_view StrHTTPServerEnabled = "HTTPServerEnabled"; -static constexpr std::string_view StrHTTPServerUseSSL = "UseSSL"; -static constexpr std::string_view StrSSLKeyPath = "SSLKeyPath"; -static constexpr std::string_view StrSSLCertPath = "SSLCertPath"; -static constexpr std::string_view StrHTTPServerPort = "HTTPServerPort"; -static constexpr std::string_view StrHTTPServerIP = "HTTPServerIP"; - TEST_CASE("TConfig::TConfig") { const std::string CfgFile = "beammp_server_testconfig.toml"; fs::remove(CfgFile); @@ -56,7 +48,6 @@ TEST_CASE("TConfig::TConfig") { const auto table = toml::parse(CfgFile); CHECK(table.at("General").is_table()); CHECK(table.at("Misc").is_table()); - CHECK(table.at("HTTP").is_table()); fs::remove(CfgFile); } @@ -116,16 +107,6 @@ void TConfig::FlushToFile() { SetComment(data["Misc"][StrSendErrors.data()].comments(), " You can turn on/off the SendErrors message you get on startup here"); data["Misc"][StrSendErrorsMessageEnabled.data()] = Application::Settings.SendErrorsMessageEnabled; SetComment(data["Misc"][StrSendErrorsMessageEnabled.data()].comments(), " If SendErrors is `true`, the server will send helpful info about crashes and other issues back to the BeamMP developers. This info may include your config, who is on your server at the time of the error, and similar general information. This kind of data is vital in helping us diagnose and fix issues faster. This has no impact on server performance. You can opt-out of this system by setting this to `false`"); - // HTTP - data["HTTP"][StrSSLKeyPath.data()] = Application::Settings.SSLKeyPath; - data["HTTP"][StrSSLCertPath.data()] = Application::Settings.SSLCertPath; - data["HTTP"][StrHTTPServerPort.data()] = Application::Settings.HTTPServerPort; - SetComment(data["HTTP"][StrHTTPServerIP.data()].comments(), " Which IP to listen on. Pick 0.0.0.0 for a public-facing server with no specific IP, and 127.0.0.1 or 'localhost' for a local server."); - data["HTTP"][StrHTTPServerIP.data()] = Application::Settings.HTTPServerIP; - data["HTTP"][StrHTTPServerUseSSL.data()] = Application::Settings.HTTPServerUseSSL; - SetComment(data["HTTP"][StrHTTPServerUseSSL.data()].comments(), " Recommended to have enabled for servers which face the internet. With SSL the server will serve https and requires valid key and cert files"); - data["HTTP"][StrHTTPServerEnabled.data()] = Application::Settings.HTTPServerEnabled; - SetComment(data["HTTP"][StrHTTPServerEnabled.data()].comments(), " Enables the internal HTTP server"); std::stringstream Ss; Ss << "# This is the BeamMP-Server config file.\n" "# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n" @@ -197,13 +178,6 @@ void TConfig::ParseFromFile(std::string_view name) { TryReadValue(data, "Misc", StrSendErrors, Application::Settings.SendErrors); TryReadValue(data, "Misc", StrHideUpdateMessages, Application::Settings.HideUpdateMessages); TryReadValue(data, "Misc", StrSendErrorsMessageEnabled, Application::Settings.SendErrorsMessageEnabled); - // HTTP - TryReadValue(data, "HTTP", StrSSLKeyPath, Application::Settings.SSLKeyPath); - TryReadValue(data, "HTTP", StrSSLCertPath, Application::Settings.SSLCertPath); - TryReadValue(data, "HTTP", StrHTTPServerPort, Application::Settings.HTTPServerPort); - TryReadValue(data, "HTTP", StrHTTPServerIP, Application::Settings.HTTPServerIP); - TryReadValue(data, "HTTP", StrHTTPServerEnabled, Application::Settings.HTTPServerEnabled); - TryReadValue(data, "HTTP", StrHTTPServerUseSSL, Application::Settings.HTTPServerUseSSL); } catch (const std::exception& err) { beammp_error("Error parsing config file value: " + std::string(err.what())); mFailed = true; @@ -238,10 +212,6 @@ void TConfig::PrintDebug() { beammp_debug(std::string(StrDescription) + ": \"" + Application::Settings.ServerDesc + "\""); beammp_debug(std::string(StrLogChat) + ": \"" + (Application::Settings.LogChat ? "true" : "false") + "\""); beammp_debug(std::string(StrResourceFolder) + ": \"" + Application::Settings.Resource + "\""); - beammp_debug(std::string(StrSSLKeyPath) + ": \"" + Application::Settings.SSLKeyPath + "\""); - beammp_debug(std::string(StrSSLCertPath) + ": \"" + Application::Settings.SSLCertPath + "\""); - beammp_debug(std::string(StrHTTPServerPort) + ": \"" + std::to_string(Application::Settings.HTTPServerPort) + "\""); - beammp_debug(std::string(StrHTTPServerIP) + ": \"" + Application::Settings.HTTPServerIP + "\""); // special! beammp_debug("Key Length: " + std::to_string(Application::Settings.Key.length()) + ""); beammp_debug("Password Protected: " + std::string(Application::Settings.Password.empty() ? "false" : "true")); From aa84a65546c9e01329d4d155406d09eba84ed876 Mon Sep 17 00:00:00 2001 From: Lion Date: Thu, 21 Dec 2023 13:15:48 +0100 Subject: [PATCH 09/11] Update feature_request.md --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e25bd13..20b75c1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project -labels: enhancement +labels: feature assignees: '' --- From 329d2eb26860a3ca271c0dd9024834f628fabc22 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 28 Dec 2023 11:22:00 +0100 Subject: [PATCH 10/11] fix hot reload not working with symlinked entire plugins --- src/TPluginMonitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TPluginMonitor.cpp b/src/TPluginMonitor.cpp index 3332ae1..93686e4 100644 --- a/src/TPluginMonitor.cpp +++ b/src/TPluginMonitor.cpp @@ -1,6 +1,7 @@ #include "TPluginMonitor.h" #include "TLuaEngine.h" +#include TPluginMonitor::TPluginMonitor(const fs::path& Path, std::shared_ptr Engine) : mEngine(Engine) @@ -9,7 +10,7 @@ TPluginMonitor::TPluginMonitor(const fs::path& Path, std::shared_ptr if (!fs::exists(mPath)) { fs::create_directories(mPath); } - for (const auto& Entry : fs::recursive_directory_iterator(mPath)) { + for (const auto& Entry : fs::recursive_directory_iterator(mPath, fs::directory_options::follow_directory_symlink)) { // TODO: trigger an event when a subfolder file changes if (Entry.is_regular_file()) { mFileTimes[Entry.path().string()] = fs::last_write_time(Entry.path()); From c7e228fbae32f6c653aa94cf750e25ec11326ca5 Mon Sep 17 00:00:00 2001 From: Lion Date: Thu, 28 Dec 2023 11:56:25 +0100 Subject: [PATCH 11/11] bump version to 3.2.0 due to new features like ENV reading this is now a feature release, so minor --- include/Common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Common.h b/include/Common.h index 85e6202..4fc4b0b 100644 --- a/include/Common.h +++ b/include/Common.h @@ -133,7 +133,7 @@ private: static inline std::mutex mShutdownHandlersMutex {}; static inline std::deque mShutdownHandlers {}; - static inline Version mVersion { 3, 1, 4 }; + static inline Version mVersion { 3, 2, 0 }; }; std::string ThreadName(bool DebugModeOverride = false);