From 41b408d29bcc2a7b6d5d2a91d438b1bf4190907e Mon Sep 17 00:00:00 2001 From: vnugent Date: Tue, 9 Apr 2024 11:09:08 -0400 Subject: Squashed commit of the following: commit 33c9fad14891914268d6ad6bb63c880b52b08860 Author: vnugent Date: Mon Apr 8 21:49:25 2024 -0400 refactor: Change connection logging verbosity commit d8e1307252b176112040521f46951a02b5474c80 Author: vnugent Date: Thu Mar 28 16:57:57 2024 -0400 ci(app): Switch to local build deps instead of downloading commit b53fde4d0e9ed7d88e1ac322f455eefe0c9f0dfa Merge: a504435 49c3641 Author: vnugent Date: Sun Mar 24 21:26:58 2024 -0400 Merge branch 'master' into develop commit a504435151efbe1d19404fa44859b15c629f6d5d Author: vnugent Date: Sun Mar 24 20:55:01 2024 -0400 chore: Updated compose and added some more logging commit c74440ff12daa03cc4b7792d0c3baad46a11a465 Author: vnugent Date: Mon Mar 18 21:57:57 2024 -0400 feat: message checksum support & dynamic serializers commit 9983582db08d3e6c456295ea96e482cbb4f31f42 Author: vnugent Date: Sun Mar 10 21:58:28 2024 -0400 source tree project location updated commit 60f09bde87b5c59ef937c62ef64b7745bc3711b5 Merge: 2f75659 e5bb0ee Author: vnugent Date: Sun Mar 10 16:50:09 2024 -0400 Merge remote-tracking branch 'origin/master' into develop commit 2f7565976472f0f056db60520bf253a776112c10 Merge: 323ff67 6b87785 Author: vnugent Date: Sun Mar 10 16:45:23 2024 -0400 merge master commit 323ff67badfc46ad638d75f059d60d9425ccb2fa Author: vnugent Date: Sun Mar 10 15:50:07 2024 -0400 ci(server): Conainerize and add vncache server packages commit 5d4192880654fd6e00e587814169415b42621327 Author: vnugent Date: Sat Mar 9 19:13:21 2024 -0500 chore: #2 Minor fixes and polish before release commit a4b3504bb891829074d1efde0433eae010862181 Author: vnugent Date: Sat Mar 9 16:30:44 2024 -0500 package updates commit 4d8cfc10382105b0acbd94df93ad3d05ff91db54 Author: vnugent Date: Wed Mar 6 21:30:58 2024 -0500 refactor: #2 Centralize server state, default discovery endpoints & more commit 016a96a80cce025a86c6cf26707738f6a2eb2658 Author: vnugent Date: Thu Feb 29 21:22:38 2024 -0500 feat: add future support for memory diagnostics, and some docs commit 456ead9bc8b0f61357bae93152ad0403c4940101 Author: vnugent Date: Tue Feb 13 14:46:35 2024 -0500 fix: #1 shared cluster index on linux & latested core updates commit a481d63f964a5d5204cac2e95141f37f9a28d573 Author: vnugent Date: Tue Jan 23 15:43:50 2024 -0500 cache extension api tweaks --- .../server/container/Taskfile.yaml | 19 -------- .../ObjectCacheServer/server/install.taskfile.yaml | 20 --------- plugins/ObjectCacheServer/server/taskfile.yaml | 51 ++++++++++------------ .../src/Endpoints/ConnectEndpoint.cs | 10 +++-- 4 files changed, 30 insertions(+), 70 deletions(-) delete mode 100644 plugins/ObjectCacheServer/server/install.taskfile.yaml (limited to 'plugins') diff --git a/plugins/ObjectCacheServer/server/container/Taskfile.yaml b/plugins/ObjectCacheServer/server/container/Taskfile.yaml index 10ee86b..e02f1b3 100644 --- a/plugins/ObjectCacheServer/server/container/Taskfile.yaml +++ b/plugins/ObjectCacheServer/server/container/Taskfile.yaml @@ -8,11 +8,6 @@ version: "3" vars: INCLUDE_FILES: "Dockerfile, docker-compose.yaml" -includes: - install: - taskfile: ../install.taskfile.yaml - optional: true #not needed for inside container build - tasks: #called from inside the container to build native libraries build-libs: @@ -40,9 +35,6 @@ tasks: #remove the default config file as it's not needed in the container - powershell -Command "rm -Force -Recurse build/app/config/" - #install rpmalloc - - task: install-rpmalloc-lib - postbuild_success: cmds: #tar up the build directory and move it to the output bin directory @@ -55,17 +47,6 @@ tasks: cmds: - cmd: powershell -Command "rm -Recurse -Force ./build" - install-rpmalloc-lib: - internal: true - cmds: - #install compressor plugin - - task: install:install - vars: - PROJECT_NAME: 'vnlib_rpmalloc' - MODULE_NAME: "VNLib.Core" - FILE_NAME: "src.tgz" - DIR: './build/app/lib/vnlib_rpmalloc' - setup-container-image: internal: true cmds: diff --git a/plugins/ObjectCacheServer/server/install.taskfile.yaml b/plugins/ObjectCacheServer/server/install.taskfile.yaml deleted file mode 100644 index 37baf12..0000000 --- a/plugins/ObjectCacheServer/server/install.taskfile.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# https://taskfile.dev - -#Called by the vnbuild system to produce builds for my website -#https://www.vaughnnugent.com/resources/software - -version: "3" - -tasks: - - install: - internal: true - cmds: - #make the plugin directory - - cmd: powershell -Command "mkdir {{.DIR}} -Force" - ignore_error: true - - cmd: powershell -Command "pwd" - - cd {{.DIR}} && powershell "{{.SCRIPT_DIR}}/install.ps1" -BaseUrl {{.BUILDS_URL}} -ModuleName {{.MODULE_NAME}} -ProjectName {{.PROJECT_NAME}} -FileName {{.FILE_NAME}} - - cd {{.DIR}} && tar -xzf {{.FILE_NAME}} - #remove the archive file - - cd {{.DIR}} && powershell -Command "rm {{.FILE_NAME}}" \ No newline at end of file diff --git a/plugins/ObjectCacheServer/server/taskfile.yaml b/plugins/ObjectCacheServer/server/taskfile.yaml index 9455451..83b8e70 100644 --- a/plugins/ObjectCacheServer/server/taskfile.yaml +++ b/plugins/ObjectCacheServer/server/taskfile.yaml @@ -6,14 +6,10 @@ version: "3" vars: - BUILDS_URL: https://www.vaughnnugent.com/public/resources/software/builds SCRIPT_DIR: '{{.TASKFILE_DIR}}' BINARY_DIR: '{{.PROJECT_DIR}}/bin' #binary dir is not available for dotnet plugis includes: - install: - taskfile: install.taskfile.yaml - optional: true container: dir: container #always run from the container directory @@ -38,9 +34,8 @@ tasks: VNLIB_SHARED_HEAP_FILE_PATH: lib/libvn_rpmalloc cmds: - - cmd: dotnet webserver/VNLib.WebServer.dll --config config/config.json --input-off --inline-scheduler {{.CLI_ARGS}} - #setup sever environment - + - cmd: dotnet webserver/VNLib.WebServer.dll --config config/config.json --input-off {{.CLI_ARGS}} + #setup sever environment setup-apt: desc: "Performs initial setup on Debian/APT x64 based machines" @@ -105,6 +100,7 @@ tasks: install-webserver: internal: true cmds: + #create a server environment for each target os - for: [ win-x64, linux-x64, osx-x64, linux-arm64 ] task: create-env vars: @@ -112,20 +108,21 @@ tasks: install-plugins: internal: true + vars: + RPMALLOC_SRC: 'core/lib/Utils.Memory/vnlib_rpmalloc/bin/src.tgz' cmds: - cmd: powershell -Command "mkdir lib -Force" ignore_error: true #copy the object-cache plugin output to the local plugins directory - - cmd: powershell -Command "cp -Recurse -Force {{.PROJECT_DIR}}/bin/Release/net8.0/publish/ plugins/{{.PROJECT_NAME}}/" + - cmd: powershell -Command "cp -Recurse -Force {{.PROJECT_DIR}}/bin/Release/net8.0/publish/ plugins/{{.PROJECT_NAME}}" - #download rpmalloc - - task: install:install - vars: - PROJECT_NAME: 'vnlib_rpmalloc' - MODULE_NAME: "VNLib.Core" - FILE_NAME: "src.tgz" - DIR: './lib/vnlib_rpmalloc' + #copy local rpmalloc library to the local lib directory + - cmd: powershell mkdir lib/vnlib_rpmalloc -Force + - cmd: cd '{{.MODULE_DIR}}' && cd .. && powershell cp '{{.RPMALLOC_SRC}}' '{{.TASKFILE_DIR}}/lib/vnlib_rpmalloc/src.tgz' + - cmd: cd lib/vnlib_rpmalloc && tar -xzf src.tgz + - for: [ src.tgz, package.json ] + cmd: cd lib/vnlib_rpmalloc && powershell rm {{.ITEM}} postbuild_success: desc: "CI ONLY! DO NOT RUN" @@ -141,17 +138,12 @@ tasks: ignore_error: true - task: container:postbuild_success - - build-container: - internal: true - cmds: - - task: container:build #Creates a new webserver build environment for an operating system configuration create-env: - internal: true + #internal: true vars: - BUILD_DIR: './build/{{.TARGET_OS}}' + BUILD_DIR: 'build/{{.TARGET_OS}}' cmds: #create dir for env - cmd: powershell -Command "mkdir {{.BUILD_DIR}} -Force" @@ -169,13 +161,16 @@ tasks: #fetches a copy of (the desired os version) VNLib.WebServer project and installs it into the build directory get-webserver: internal: true + vars: + TARGET_DIR: '{{.TASKFILE_DIR}}/{{.BUILD_DIR}}/webserver/' + TARGET_FILENAME: '{{.TARGET_OS}}-release.tgz' + CI_WEBSERVER_DIR: 'VNLib.WebServer/src/bin' cmds: - - task: install:install - vars: - PROJECT_NAME: 'VNLib.Webserver' - MODULE_NAME: "VNLib.Webserver" - FILE_NAME: "{{.TARGET_OS}}-release.tgz" - DIR: '{{.BUILD_DIR}}/webserver' + #copy an existing webserver build to the build directory + - cmd: powershell -Command "mkdir {{.TARGET_DIR}} -Force" + - cmd: cd '{{.MODULE_DIR}}' && cd .. && powershell cp -Recurse -Force '{{.CI_WEBSERVER_DIR}}/{{.TARGET_FILENAME}}' '{{.TARGET_DIR}}{{.TARGET_FILENAME}}' + - cmd: cd '{{.TARGET_DIR}}' && tar -xzf {{.TARGET_FILENAME}} + - cmd: powershell rm '{{.TARGET_DIR}}/{{.TARGET_FILENAME}}' pack: internal: true diff --git a/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs b/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs index 42f406a..20d1836 100644 --- a/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs +++ b/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs @@ -25,6 +25,7 @@ using System; using System.Net; using System.Threading; +using System.Diagnostics; using System.Threading.Tasks; using System.Collections.Generic; @@ -224,7 +225,8 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints MaxResponseBufferSize = (int)MemoryUtil.NearestPage(maxMessageSizeClamp), NodeId = nodeId, - Advertisment = discoveryAd + Advertisment = discoveryAd, + Address = entity.TrustedRemoteIp, }; } catch (KeyNotFoundException) @@ -243,8 +245,9 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints private async Task WebsocketAcceptedAsync(WebSocketSession wss) { WsUserState state = wss.UserState!; + Debug.Assert(state != null, "User state is null"); - Log.Debug("Client established websocket connection {sid}", wss.SocketID); + Log.Information("{sid} established websocket connection", state.Address); //Notify peers of new connection Peers.OnPeerConnected(state); @@ -309,7 +312,7 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints //Notify monitor of disconnect Peers.OnPeerDisconnected(state); - Log.Debug("Client websocket disconnected {sid}", wss.SocketID); + Log.Information("{sid} websocket disconnected", state.Address); } @@ -321,6 +324,7 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints public int MaxResponseBufferSize { get; init; } public string? NodeId { get; init; } public CacheNodeAdvertisment? Advertisment { get; init; } + public IPAddress Address { get; init; } public bool IsPeer => !string.IsNullOrWhiteSpace(NodeId); -- cgit