Initial import of the CBDDC codebase with docs and tests. Add a .NET-focused gitignore to keep generated artifacts out of source control.
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
Joseph Doherty
2026-02-20 13:03:21 -05:00
commit 08bfc17218
218 changed files with 33910 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
# ZB.MOM.WW.CBDDC.Hosting
ASP.NET Core integration for CBDDC with health checks and hosted services.
## Features
- Cluster mode
- Built-in health endpoint integration
- Hosted services for sync server lifecycle
- Respond-only server operation
## Installation
```bash
dotnet add package ZB.MOM.WW.CBDDC.Hosting
```
## Quick Start - Cluster
```csharp
var builder = WebApplication.CreateBuilder(args);
// Add CBDDC core + BLite persistence (custom DbContext + DocumentStore required)
builder.Services.AddCBDDCCore()
.AddCBDDCBLite<MyDbContext, MyDocumentStore>(
sp => new MyDbContext("/var/lib/cbddc/data.blite"));
// Add ASP.NET integration (cluster mode)
builder.Services.AddCBDDCHosting(options =>
{
options.Cluster.NodeId = "server-01";
options.Cluster.TcpPort = 5001;
});
var app = builder.Build();
app.MapHealthChecks("/health");
app.Run();
```
## Health Checks
CBDDC registers health checks that verify:
- Database connectivity
- Latest timestamp retrieval
```bash
curl http://localhost:5000/health
```
## Deployment Mode
### Cluster
Best for:
- Dedicated database servers
- Simple deployments
- Development/testing environments
## Server Behavior
CBDDC servers operate in respond-only mode:
- Accept incoming sync connections
- Respond to sync requests
- Do not initiate outbound sync
- Do not perform UDP discovery
## Configuration Options
### ClusterOptions
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| NodeId | string | MachineName | Unique node identifier |
| TcpPort | int | 5001 | TCP port for sync |
| EnableUdpDiscovery | bool | false | Enable UDP discovery |
## Production Checklist
- Store BLite database files on durable storage in production
- Configure health checks for load balancer
- Set up proper logging and monitoring
- Configure backup/restore for BLite database files
- Configure proper firewall rules for TCP port
- Set unique NodeId per instance
- Test failover scenarios
## License
MIT