Aggiunti Dockerfile multi-stage, .dockerignore e docker-compose.yml per deployment containerizzato (con healthcheck, volumi persistenti, limiti risorse). Script di build per Linux/Mac e Windows. In Program.cs aggiunto endpoint /health e health checks per orchestrazione. Documentazione estesa: guide Unraid, quickstart Docker, workflow Git/DevOps, best practices su sicurezza, backup, monitoring. Progetto ora pronto per deploy e gestione professionale in ambienti Docker/Unraid.
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using TradingBot.Components;
|
|
using TradingBot.Services;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
// Trading Bot Services - Using Simulated Market Data
|
|
builder.Services.AddSingleton<IMarketDataService, SimulatedMarketDataService>();
|
|
builder.Services.AddSingleton<ITradingStrategy, SimpleMovingAverageStrategy>();
|
|
builder.Services.AddSingleton<TradingBotService>();
|
|
builder.Services.AddSingleton<SettingsService>();
|
|
|
|
// Add health checks for Docker
|
|
builder.Services.AddHealthChecks();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseStaticFiles();
|
|
app.UseAntiforgery();
|
|
|
|
// Health check endpoint for Docker
|
|
app.MapHealthChecks("/health");
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|