Development is fun. Deployment is where it gets real. Hazina is designed for production from day one, with built-in support for configuration management, database migrations, monitoring, and scaling.
Deployment Checklist
- Switch from SQLite to PostgreSQL
- Configure production API keys via environment variables
- Enable health checks and monitoring
- Set up proper logging
- Configure rate limiting
Database: SQLite to PostgreSQL
// Development
config.Storage.UseSqlite("hazina-dev.db");
// Production
config.Storage.UsePostgreSQL(new PostgresSettings {
ConnectionString = Environment.GetEnvironmentVariable("DATABASE_URL")!,
EnablePgVector = true,
MaxPoolSize = 20
});
Environment Variables for Production
# Required
OPENAI_API_KEY=sk-prod-key-here
DATABASE_URL=Host=db.example.com;Database=hazina;Username=app;Password=secret
# Optional
HAZINA__AI__MAXTOKENS=4096
HAZINA__AI__TEMPERATURE=0.3
ASPNETCORE_ENVIRONMENT=Production
Docker Deployment
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]
Supabase Integration
For a managed database with built-in vector support:
config.Storage.UseSupabase(new SupabaseSettings {
Url = Environment.GetEnvironmentVariable("SUPABASE_URL")!,
ConnectionString = Environment.GetEnvironmentVariable("SUPABASE_CONNECTION_STRING")!
});
Rate Limiting
builder.Services.AddHazinaRateLimiting(options => {
options.PerTenant = new RateLimit {
RequestsPerMinute = 60,
AICallsPerHour = 100
};
options.Global = new RateLimit {
RequestsPerMinute = 1000
};
});
Windows Service Deployment
Hazina applications can also run as Windows Services using the built-in hosting support:
builder.Host.UseWindowsService();
In the next post, we’ll look at Hazina’s YAML/JSON entity definitions – a way for non-developers to define data structures.
Terug naar overzicht