Supporto Unraid/Docker nativo, healthcheck e template
- Configurazione Kestrel ottimizzata per ambienti Docker/Unraid: porta 8080 in produzione, HTTPS redirect solo in sviluppo - Endpoint /health sempre attivo per healthcheck automatici - Aggiunti file docker-compose.yml e unraid-template.xml per deploy e gestione nativa su Unraid (senza Portainer) - Nuova guida UNRAID_NATIVE_INSTALL.md per installazione, update e troubleshooting su Unraid - Logging e appsettings separati per Development/Production - launchSettings.json aggiornato e semplificato - Rimosso package Azure Containers Tools dal csproj; aggiunto target MSBuild per push automatico su Gitea Registry dopo publish - Algoritmo SMA più robusto: filtra dati nulli/invalidi e gestisce casi di dati insufficienti - Pronto per deploy professionale, aggiornamento e gestione semplificata in ambienti containerizzati
This commit is contained in:
@@ -3,12 +3,15 @@ using TradingBot.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Configure Kestrel per Docker - Listen su tutte le interfacce
|
||||
builder.WebHost.ConfigureKestrel(serverOptions =>
|
||||
// Configure Kestrel - Solo in Development usa porte da launchSettings
|
||||
// In Production/Docker usa porta 8080 su tutte le interfacce
|
||||
if (builder.Environment.IsProduction() || builder.Environment.EnvironmentName == "Docker")
|
||||
{
|
||||
// Listen su porta 8080 per Docker
|
||||
serverOptions.ListenAnyIP(8080);
|
||||
});
|
||||
builder.WebHost.ConfigureKestrel(serverOptions =>
|
||||
{
|
||||
serverOptions.ListenAnyIP(8080);
|
||||
});
|
||||
}
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
@@ -29,12 +32,10 @@ var app = builder.Build();
|
||||
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();
|
||||
}
|
||||
|
||||
// Disabilita HTTPS redirect in Docker/Production
|
||||
// Docker gestisce HTTPS tramite reverse proxy se necessario
|
||||
// HTTPS redirect solo in Development
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseHttpsRedirection();
|
||||
@@ -43,7 +44,7 @@ if (app.Environment.IsDevelopment())
|
||||
app.UseStaticFiles();
|
||||
app.UseAntiforgery();
|
||||
|
||||
// Health check endpoint for Docker
|
||||
// Health check endpoint
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.MapRazorComponents<App>()
|
||||
|
||||
Reference in New Issue
Block a user