Skip to main content

Deployment

Configuration & Secrets

In a real environment (Production), configuration should be injected via Environment Variables. These override the values in appsettings.json.

Required Secrets

VariableProjectDescription
Jwt__KeyTitan.API / Titan.AppHostCRITICAL: Must be a secure random 32+ byte string.

Configuration Overrides

VariableProjectDescription
Cors__AllowedOrigins__0Titan.APIAllowed Origin 1 (e.g. https://titan-client.com)
RateLimiting__PermitLimitTitan.APIRequests per window (default: 100)
Logging__FilePathHostsPath to log file (default: logs/titan-...-.txt)
ConnectionStrings__titanAllPostgreSQL Connection String
ConnectionStrings__orleans-clusteringAllRedis 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:

  1. Set the Secret Key in your shell.
  2. 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.