Deployment
Configuration & Secrets
In a real environment (Production), configuration should be injected via Environment Variables. These override the values in appsettings.json.
Required Secrets
| Variable | Project | Description |
|---|---|---|
Jwt__Key | Titan.API / Titan.AppHost | CRITICAL: Must be a secure random 32+ byte string. |
Configuration Overrides
| Variable | Project | Description |
|---|---|---|
Cors__AllowedOrigins__0 | Titan.API | Allowed Origin 1 (e.g. https://titan-client.com) |
RateLimiting__PermitLimit | Titan.API | Requests per window (default: 100) |
Logging__FilePath | Hosts | Path to log file (default: logs/titan-...-.txt) |
ConnectionStrings__titan | All | PostgreSQL Connection String |
ConnectionStrings__orleans-clustering | All | Redis Connection String |
Running in "Production" Mode Locally
To simulate a real environment, you can run the artifacts with the Production environment variable:
# 1. Publish (optional, or just use dotnet run)
dotnet publish -c Release -o ./publish
# 2. Set Environment Variables
$env:ASPNETCORE_ENVIRONMENT="Production"
$env:Jwt__Key="YourSuperSecureKeyThatIsAtLeast32BytesLength"
$env:ConnectionStrings__titan="Host=localhost;Database=titan;Username=postgres;Password=postgres"
# (Ensure DB is running)
# 3. Run
dotnet run --project Source/Titan.API
Deployment with Aspire
Titan uses .NET Aspire for orchestration.
Generating a Manifest
To generate a deployment manifest for Kubernetes or Azure Container Apps:
dotnet run --project Source/Titan.AppHost --publisher manifest --output-path aspire-manifest.json
Simulating "Production" locally with Aspire
You can run the full distributed application (AppHost) in a mode that mimics production settings (e.g. using the production appsettings.json values where possible, though Aspire forces Development environment by default for the dashboard).
To test the Configuration handover specifically:
- Set the Secret Key in your shell.
- Run the AppHost.
$env:Jwt__Key="ProductionSecretKeyForTestingAspireFlowMustBeLong"
dotnet run --project Source/Titan.AppHost
The AppHost (in AppHost.cs) is configured to pass this value down to the mapped projects:
.WithEnvironment("Jwt__Key", builder.Configuration["Jwt:Key"])
This ensures that even when running locally via Aspire, the "orchestration" of secrets is tested.