Refactor server to use .NET Generic Host APIs
- [x] Wrap
NitroxConfigin custom MS configuration provider for validation, CMD args and DI support - [x] Replace logging with ZLogger for improved performance, while keeping all prior features of
Nitrox.Model.Logger.Log(i.e. redaction andLogOnce). - [x] Refactor IPC communication between launcher<->server with MagicOnion for improved stability and performance.
- [x] Added
server.Development.jsonwhich allows developers to override any config property. This file is automatically generated on build if it doesn't exist and works with instant launch too.
Missing features
-
Auto sync changes to configuration file
We should tell users to edit config file directly, and restart server. This is because
IOptions<T>from MSDI does not have persisting built-in.
Reviewing
Everything flows from Program.StartServerAsync so I recommend giving it a good look before reviewing the rest.
I tried to compartmentalize dependencies together into extension methods on IServiceCollection. In other words, removing .AddPackets() should still compile and run the server. It just won't have any packet related services (like LiteNetLib) running.
Issues to close
- Closes #2166
Preview
Seems like another huge piece of work and it will be hard to test/integrate. I think we should probably slice it into multiple PR (.NET Host refactor, Encryption, Sqlite)
Test Results
238 tests - 7 237 ✅ - 7 7s ⏱️ ±0s 1 suites ±0 1 💤 ±0 1 files ±0 0 ❌ ±0
Results for commit cbb77384. ± Comparison against base commit c586d7e4.
This pull request removes 8 and adds 1 tests. Note that renamed tests count towards both.
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ EntityDataTest (SubnauticaServerJsonSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ EntityDataTest (SubnauticaServerProtoBufSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ GlobalRootDataTest (SubnauticaServerJsonSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ GlobalRootDataTest (SubnauticaServerProtoBufSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ PlayerDataTest (SubnauticaServerJsonSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ PlayerDataTest (SubnauticaServerProtoBufSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ WorldDataTest (SubnauticaServerJsonSerializer)
Nitrox.Server.Subnautica.Models.Serialization.WorldPersistenceTest ‑ WorldDataTest (SubnauticaServerProtoBufSerializer)
Nitrox.Model.Helper.HashTreeTest ‑ ShouldTestForSameValue
:recycle: This comment has been updated with latest results.
Ready for review :clown_face: