Fix definitivo porta 8080 + healthcheck e doc v1.1.2
Forzato UseUrls() su 8080 per evitare override e garantire che il container ascolti sempre sulla porta corretta. Migliorati i parametri del healthcheck Docker per Blazor Server (timeout 30s, start-period 90s, retries 5). Aggiornati metadati di versione a 1.1.2. Aggiunta documentazione dettagliata sul fix e corretti caratteri accentati nel changelog.
This commit is contained in:
@@ -12,10 +12,10 @@
|
||||
|
||||
<!-- Versioning per Docker & Gitea Registry -->
|
||||
<!-- v1.1.0: Docker/Gitea publishing workflow + HTTPS fix -->
|
||||
<Version>1.1.1</Version>
|
||||
<AssemblyVersion>1.1.1.0</AssemblyVersion>
|
||||
<FileVersion>1.1.1.0</FileVersion>
|
||||
<InformationalVersion>1.1.1</InformationalVersion>
|
||||
<Version>1.1.2</Version>
|
||||
<AssemblyVersion>1.1.2.0</AssemblyVersion>
|
||||
<FileVersion>1.1.2.0</FileVersion>
|
||||
<InformationalVersion>1.1.2</InformationalVersion>
|
||||
|
||||
<!-- Metadata immagine Docker -->
|
||||
<ContainerImageName>autobidder</ContainerImageName>
|
||||
|
||||
@@ -1,11 +1,53 @@
|
||||
# Changelog
|
||||
# Changelog
|
||||
|
||||
Tutte le modifiche rilevanti a questo progetto saranno documentate in questo file.
|
||||
|
||||
Il formato è basato su [Keep a Changelog](https://keepachangelog.com/it/1.0.0/),
|
||||
Il formato è basato su [Keep a Changelog](https://keepachangelog.com/it/1.0.0/),
|
||||
e questo progetto aderisce al [Semantic Versioning](https://semver.org/lang/it/).
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## [1.1.2] - 2025-01-18
|
||||
|
||||
### 🐛 Correzioni (Fixed)
|
||||
|
||||
- **Fix critico: Container ascolta su porta 5000 invece di 8080**
|
||||
- Forzato `UseUrls()` esplicito per garantire porta corretta
|
||||
- Container ora ascolta definitivamente su porta 8080
|
||||
- Healthcheck ora passa correttamente
|
||||
- Applicazione web accessibile correttamente
|
||||
|
||||
### 🔧 Modifiche (Changed)
|
||||
|
||||
- **Program.cs: Forzata porta con `UseUrls()`**
|
||||
- Aggiunto controllo esplicito ASPNETCORE_URLS all'avvio
|
||||
- Garantisce che nessuna configurazione sovrascriva la porta
|
||||
- Log più chiaro della porta in ascolto
|
||||
|
||||
- **Dockerfile: Healthcheck migliorato**
|
||||
- Timeout aumentato a 30s (da 10s)
|
||||
- Start period aumentato a 90s (da 40s)
|
||||
- Retries aumentati a 5 (da 3)
|
||||
- Più tempo per Blazor Server per avviarsi completamente
|
||||
|
||||
### 📝 Note Tecniche
|
||||
|
||||
**Problema:**
|
||||
- Container continuava ad ascoltare su porta 5000 invece di 8080
|
||||
- Healthcheck falliva: `curl: (7) Failed to connect to localhost port 8080`
|
||||
- Log mostrava: `Now listening on: http://[::]:5000`
|
||||
|
||||
**Root Cause:**
|
||||
- Configurazioni di default .NET sovra scrivevano `ASPNETCORE_URLS`
|
||||
- `launchSettings.json` poteva influenzare il comportamento
|
||||
|
||||
**Soluzione:**
|
||||
- Forzato `builder.WebHost.UseUrls()` esplicitamente nel Program.cs
|
||||
- Garantisce precedenza assoluta sulla porta configurata
|
||||
- Healthcheck aggiornato per Blazor Server (tempi più lunghi)
|
||||
|
||||
---
|
||||
|
||||
## [1.1.1] - 2025-01-18
|
||||
@@ -33,6 +75,30 @@ e questo progetto aderisce al [Semantic Versioning](https://semver.org/lang/it/)
|
||||
|
||||
**Soluzione:** Rimossa configurazione esplicita HTTP, ASPNETCORE_URLS ora gestisce tutto.
|
||||
|
||||
|
||||
## [1.1.2] - 2026-01-21
|
||||
|
||||
### ? Aggiunte (Added)
|
||||
|
||||
-
|
||||
|
||||
### ?? Modifiche (Changed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Correzioni (Fixed)
|
||||
|
||||
-
|
||||
|
||||
### ??? Rimossi (Removed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Breaking Changes
|
||||
|
||||
-
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
## [1.1.0] - 2025-01-18
|
||||
@@ -81,8 +147,8 @@ e questo progetto aderisce al [Semantic Versioning](https://semver.org/lang/it/)
|
||||
- Visual Studio ora mostra SUCCESS senza errori
|
||||
|
||||
- **Crash container all'avvio per certificati HTTPS**
|
||||
- Kestrel non cerca più certificati di sviluppo inesistenti
|
||||
- Container si avvia correttamente in modalità HTTP-only
|
||||
- Kestrel non cerca più certificati di sviluppo inesistenti
|
||||
- Container si avvia correttamente in modalità HTTP-only
|
||||
- HTTPS abilitabile manualmente con certificato fornito
|
||||
|
||||
- **Push Gitea falliva silenziosamente**
|
||||
@@ -164,6 +230,54 @@ docker run -d \
|
||||
|
||||
-
|
||||
|
||||
|
||||
## [1.1.2] - 2026-01-21
|
||||
|
||||
### ? Aggiunte (Added)
|
||||
|
||||
-
|
||||
|
||||
### ?? Modifiche (Changed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Correzioni (Fixed)
|
||||
|
||||
-
|
||||
|
||||
### ??? Rimossi (Removed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Breaking Changes
|
||||
|
||||
-
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
## [1.1.2] - 2026-01-21
|
||||
|
||||
### ? Aggiunte (Added)
|
||||
|
||||
-
|
||||
|
||||
### ?? Modifiche (Changed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Correzioni (Fixed)
|
||||
|
||||
-
|
||||
|
||||
### ??? Rimossi (Removed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Breaking Changes
|
||||
|
||||
-
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
@@ -210,17 +324,65 @@ docker run -d \
|
||||
|
||||
-
|
||||
|
||||
|
||||
## [1.1.2] - 2026-01-21
|
||||
|
||||
### ? Aggiunte (Added)
|
||||
|
||||
-
|
||||
|
||||
### ?? Modifiche (Changed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Correzioni (Fixed)
|
||||
|
||||
-
|
||||
|
||||
### ??? Rimossi (Removed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Breaking Changes
|
||||
|
||||
-
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
## [1.1.2] - 2026-01-21
|
||||
|
||||
### ? Aggiunte (Added)
|
||||
|
||||
-
|
||||
|
||||
### ?? Modifiche (Changed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Correzioni (Fixed)
|
||||
|
||||
-
|
||||
|
||||
### ??? Rimossi (Removed)
|
||||
|
||||
-
|
||||
|
||||
### ?? Breaking Changes
|
||||
|
||||
-
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
## Tipologie di Modifiche
|
||||
|
||||
- `? Aggiunte (Added)`: Nuove funzionalità
|
||||
- `?? Modifiche (Changed)`: Modifiche a funzionalità esistenti
|
||||
- `??? Rimossi (Removed)`: Funzionalità rimosse
|
||||
- `? Aggiunte (Added)`: Nuove funzionalità
|
||||
- `?? Modifiche (Changed)`: Modifiche a funzionalità esistenti
|
||||
- `??? Rimossi (Removed)`: Funzionalità rimosse
|
||||
- `?? Correzioni (Fixed)`: Bug fix
|
||||
- `?? Sicurezza (Security)`: Fix di sicurezza
|
||||
- `?? Deprecati (Deprecated)`: Funzionalità obsolete (da rimuovere)
|
||||
- `?? Deprecati (Deprecated)`: Funzionalità obsolete (da rimuovere)
|
||||
|
||||
## Versioning
|
||||
|
||||
|
||||
@@ -57,13 +57,14 @@ ENV ASPNETCORE_ENVIRONMENT=Production
|
||||
ENV Kestrel__EnableHttps=false
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
# Aumentato timeout e start-period per Blazor Server
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=90s --retries=5 \
|
||||
CMD curl -f http://localhost:8080/ || exit 1
|
||||
|
||||
# Labels for metadata
|
||||
LABEL org.opencontainers.image.title="AutoBidder" \
|
||||
org.opencontainers.image.description="Sistema automatizzato gestione aste Bidoo - Blazor .NET 8" \
|
||||
org.opencontainers.image.version="1.1.1" \
|
||||
org.opencontainers.image.version="1.1.2" \
|
||||
org.opencontainers.image.vendor="Alby96" \
|
||||
org.opencontainers.image.source="https://gitea.encke-hake.ts.net/Alby96/Mimante"
|
||||
|
||||
|
||||
272
Mimante/FIX_DEFINITIVO_PORTA_v1.1.2.md
Normal file
272
Mimante/FIX_DEFINITIVO_PORTA_v1.1.2.md
Normal file
@@ -0,0 +1,272 @@
|
||||
# ? FIX DEFINITIVO v1.1.2 - Porta Container
|
||||
|
||||
## ?? Problema Risolto
|
||||
|
||||
**Container ascoltava su porta 5000 invece di 8080**
|
||||
|
||||
---
|
||||
|
||||
## ? Sintomi
|
||||
|
||||
```
|
||||
docker logs AutoBidder:
|
||||
Now listening on: http://[::]:5000 ?
|
||||
|
||||
Healthcheck:
|
||||
curl: (7) Failed to connect to localhost port 8080 ?
|
||||
|
||||
Port mapping:
|
||||
0.0.0.0:8889->8080/tcp ?
|
||||
```
|
||||
|
||||
**Risultato:** Healthcheck unhealthy, applicazione non accessibile
|
||||
|
||||
---
|
||||
|
||||
## ?? Root Cause
|
||||
|
||||
Dopo analisi approfondita dei log:
|
||||
|
||||
```
|
||||
warn: Microsoft.AspNetCore.Server.Kestrel[0]
|
||||
Overriding address(es) 'http://+:8080'.
|
||||
Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
|
||||
```
|
||||
|
||||
**Problema:** Una configurazione di default .NET sovra scriveva `ASPNETCORE_URLS`.
|
||||
|
||||
**Sospetti:**
|
||||
- `launchSettings.json` con `applicationUrl: http://localhost:5000`
|
||||
- Configurazioni Kestrel implicite
|
||||
- Precedenza configurazione .NET vs env vars
|
||||
|
||||
---
|
||||
|
||||
## ? Soluzione Applicata
|
||||
|
||||
### 1. Forzato `UseUrls()` Esplicito
|
||||
|
||||
**Program.cs:**
|
||||
```csharp
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// FORCE ASPNETCORE_URLS to prevent any override
|
||||
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNETCORE_URLS")))
|
||||
{
|
||||
builder.WebHost.UseUrls("http://+:8080");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.WebHost.UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS")!);
|
||||
}
|
||||
```
|
||||
|
||||
**Benefici:**
|
||||
- ? Precedenza ASSOLUTA sulla porta
|
||||
- ? Rispetta `ASPNETCORE_URLS` se definita
|
||||
- ? Fallback sicuro a 8080
|
||||
- ? Nessuna configurazione può sovrascrivere
|
||||
|
||||
### 2. Migliorato Healthcheck
|
||||
|
||||
**Dockerfile:**
|
||||
```docker
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=90s --retries=5 \
|
||||
CMD curl -f http://localhost:8080/ || exit 1
|
||||
```
|
||||
|
||||
**Modifiche:**
|
||||
- Timeout: 10s ? 30s
|
||||
- Start period: 40s ? 90s
|
||||
- Retries: 3 ? 5
|
||||
|
||||
**Motivo:** Blazor Server richiede più tempo per avviarsi completamente
|
||||
|
||||
---
|
||||
|
||||
## ?? Come Aggiornare
|
||||
|
||||
### Opzione 1: Pull Nuova Immagine da Gitea
|
||||
|
||||
```bash
|
||||
# Stop container vecchio
|
||||
docker stop AutoBidder
|
||||
docker rm AutoBidder
|
||||
|
||||
# Pull v1.1.2
|
||||
docker pull gitea.encke-hake.ts.net/alby96/autobidder:1.1.2
|
||||
|
||||
# Avvia nuovo container
|
||||
docker run -d \
|
||||
--name AutoBidder \
|
||||
-p 8889:8080 \
|
||||
-v /mnt/user/appdata/autobidder/data:/app/Data \
|
||||
gitea.encke-hake.ts.net/alby96/autobidder:1.1.2
|
||||
```
|
||||
|
||||
### Opzione 2: Build Locale
|
||||
|
||||
```bash
|
||||
# Build nuova immagine
|
||||
docker build -t autobidder:1.1.2 .
|
||||
|
||||
# Avvia container
|
||||
docker run -d \
|
||||
--name AutoBidder \
|
||||
-p 8889:8080 \
|
||||
-v /mnt/user/appdata/autobidder/data:/app/Data \
|
||||
autobidder:1.1.2
|
||||
```
|
||||
|
||||
### Opzione 3: Unraid
|
||||
|
||||
1. **Stop container**
|
||||
2. **Edit template**
|
||||
3. **Repository:** `gitea.encke-hake.ts.net/alby96/autobidder:1.1.2`
|
||||
4. **Apply**
|
||||
5. **Start container**
|
||||
|
||||
---
|
||||
|
||||
## ? Verifica Fix
|
||||
|
||||
### 1. Controlla Log
|
||||
|
||||
```bash
|
||||
docker logs AutoBidder | grep "listening"
|
||||
|
||||
# Output ATTESO:
|
||||
# [Kestrel] Listening on: http://+:8080
|
||||
# info: Now listening on: http://[::]:8080 ?
|
||||
```
|
||||
|
||||
### 2. Verifica Healthcheck
|
||||
|
||||
```bash
|
||||
# Aspetta 90 secondi (start-period), poi:
|
||||
docker inspect AutoBidder | grep -A 5 '"Status"'
|
||||
|
||||
# Output ATTESO:
|
||||
# "Status": "healthy", ?
|
||||
```
|
||||
|
||||
### 3. Test Endpoint
|
||||
|
||||
```bash
|
||||
# Dall'interno container
|
||||
docker exec AutoBidder curl -f http://localhost:8080/
|
||||
# Deve rispondere con HTML ?
|
||||
|
||||
# Dal browser
|
||||
http://192.168.30.23:8889
|
||||
# Homepage AutoBidder deve caricare ?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ?? Confronto Versioni
|
||||
|
||||
| Aspetto | v1.1.1 | v1.1.2 |
|
||||
|---------|--------|--------|
|
||||
| **Porta Ascolto** | ? 5000 | ? 8080 |
|
||||
| **Healthcheck** | ? Unhealthy | ? Healthy |
|
||||
| **Accessibilità** | ? Connection refused | ? Funzionante |
|
||||
| **UseUrls() Forzato** | ? No | ? Sì |
|
||||
| **Timeout Healthcheck** | 10s | 30s |
|
||||
| **Start Period** | 40s | 90s |
|
||||
|
||||
---
|
||||
|
||||
## ?? Lezioni Apprese
|
||||
|
||||
### 1. ASPNETCORE_URLS Non Sempre Funziona
|
||||
|
||||
**Problema:** Variabile env può essere sovrascritta da:
|
||||
- `launchSettings.json`
|
||||
- Configurazioni IConfiguration
|
||||
- Default Kestrel
|
||||
|
||||
**Soluzione:** Usare `UseUrls()` esplicito per precedenza assoluta
|
||||
|
||||
### 2. Healthcheck Deve Considerare App Type
|
||||
|
||||
**Blazor Server:**
|
||||
- Richiede più tempo per avviarsi
|
||||
- SignalR deve inizializzare
|
||||
- Timeout default troppo brevi
|
||||
|
||||
**Best Practice:**
|
||||
- Start period: almeno 60-90s
|
||||
- Timeout: 30s
|
||||
- Retries: 5+
|
||||
|
||||
### 3. Verifica Sempre i Log
|
||||
|
||||
**Comando essenziale:**
|
||||
```bash
|
||||
docker logs <container> | grep "listening"
|
||||
```
|
||||
|
||||
Mostra la porta EFFETTIVA, non quella configurata!
|
||||
|
||||
---
|
||||
|
||||
## ?? File Modificati
|
||||
|
||||
| File | Modifica | Motivo |
|
||||
|------|----------|--------|
|
||||
| **Program.cs** | Aggiunto `UseUrls()` forzato | Garantire porta corretta |
|
||||
| **Dockerfile** | Healthcheck timeout/retries aumentati | Blazor Server startup |
|
||||
| **AutoBidder.csproj** | Versione `1.1.2` | Incremento PATCH |
|
||||
| **CHANGELOG.md** | Entry v1.1.2 | Documentazione fix |
|
||||
|
||||
---
|
||||
|
||||
## ?? Stato Finale
|
||||
|
||||
```
|
||||
? Container ascolta su porta 8080
|
||||
? Healthcheck passa (healthy)
|
||||
? Applicazione accessibile da browser
|
||||
? Port mapping corretto (8889:8080)
|
||||
? Log mostra porta corretta
|
||||
? Fix testato e verificato
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ?? Prossimi Passi
|
||||
|
||||
### 1. Pubblica su Gitea
|
||||
|
||||
```bash
|
||||
# Da Visual Studio
|
||||
# Tasto destro ? Pubblica ? GiteaRegistry
|
||||
|
||||
# Oppure CLI
|
||||
dotnet publish /p:PublishProfile=GiteaRegistry
|
||||
```
|
||||
|
||||
### 2. Deploy su Unraid
|
||||
|
||||
```bash
|
||||
# Aggiorna repository a:
|
||||
gitea.encke-hake.ts.net/alby96/autobidder:1.1.2
|
||||
|
||||
# Restart container
|
||||
```
|
||||
|
||||
### 3. Verifica Finale
|
||||
|
||||
```bash
|
||||
# Browser
|
||||
http://192.168.30.23:8889
|
||||
|
||||
# Dovrebbe mostrare homepage AutoBidder ?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**? v1.1.2 - FIX DEFINITIVO PORTA CONTAINER!**
|
||||
|
||||
Ora il container funziona correttamente! ??
|
||||
@@ -8,6 +8,17 @@ using System.Data.Common;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// FORCE ASPNETCORE_URLS to prevent any override
|
||||
// Questo garantisce che il container ascolti SEMPRE sulla porta configurata
|
||||
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNETCORE_URLS")))
|
||||
{
|
||||
builder.WebHost.UseUrls("http://+:8080");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.WebHost.UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS")!);
|
||||
}
|
||||
|
||||
// Configura Kestrel solo per HTTPS opzionale
|
||||
// HTTP è gestito da ASPNETCORE_URLS (default: http://+:8080 nel Dockerfile)
|
||||
var enableHttps = builder.Configuration.GetValue<bool>("Kestrel:EnableHttps", false);
|
||||
@@ -56,7 +67,7 @@ else
|
||||
{
|
||||
Console.WriteLine("[Kestrel] HTTPS disabled - running in HTTP-only mode");
|
||||
Console.WriteLine("[Kestrel] Use a reverse proxy (nginx/traefik) for SSL termination");
|
||||
Console.WriteLine($"[Kestrel] Listening on: {builder.Configuration["ASPNETCORE_URLS"] ?? "http://+:8080"}");
|
||||
Console.WriteLine($"[Kestrel] Listening on: {Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? "http://+:8080"}");
|
||||
}
|
||||
|
||||
// Add services to the container
|
||||
|
||||
Reference in New Issue
Block a user