Fase 10 — Nuova rotta: solo Docker (#184)
ci / test (postgres) (push) Successful in 4m50s
ci / test (sqlite) (push) Failing after 4m21s
ci / image (push) Skipped

ADR 0021-0026 for the new course of 2 December 2026, roadmap of phases 10-24. The desktop application is gone: Docker is the only form, and outside a container the server runs only for development and tests with --data-dir, on this computer only. Lighter image (829 MB to 410 MB), rotating logs, backtest and learning as one-shot commands.

refs #113 #114 #115 #78 #80 #81

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #184.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-12-03 19:59:00 +01:00
1 parent 3c57b3e84c
commit 1bc7e067fd
96 files changed
+1433 -1606

No files matched your search

+10 -26
View File
@@ -32,9 +32,8 @@ internal static class ServerApp
if (!options.AspNetArgs.Any(a => a.StartsWith("--urls", StringComparison.Ordinal)))
{
// Desktop and demo listen only on the computer itself unless the user allowed the home network (SPEC 15.6).
var local = options.Demo || (config.Platform == PlatformKind.Desktop && !config.AllowNetwork);
builder.WebHost.UseUrls((local ? "http://127.0.0.1:" : "http://0.0.0.0:") + config.Port.ToString(System.Globalization.CultureInfo.InvariantCulture));
// Outside a container (development, tests, demo) only the computer itself; the container on every interface (ADR 0022).
builder.WebHost.UseUrls((options.LocalOnly ? "http://127.0.0.1:" : "http://0.0.0.0:") + config.Port.ToString(System.Globalization.CultureInfo.InvariantCulture));
}
builder.WebHost.ConfigureKestrel(k =>
@@ -104,7 +103,7 @@ internal static class ServerApp
}
app.Use(SecurityHeaders);
app.Use((context, next) => LocalOnly(context, next, options, config));
app.Use((context, next) => LocalOnly(context, next, options));
app.Use((context, next) => Gate.InvokeAsync(context, next, host));
app.UseWebSockets(new WebSocketOptions { KeepAliveInterval = TimeSpan.FromSeconds(20) });
app.UseRouting();
@@ -162,14 +161,13 @@ internal static class ServerApp
return next();
}
// Defence in depth: even if someone binds the server to every address, desktop and demo answer only the computer itself.
private static Task LocalOnly(HttpContext context, Func<Task> next, ServerOptions options, StartupConfig config)
// Defence in depth: even if someone binds the server to every address, outside a container it answers only the computer itself.
private static Task LocalOnly(HttpContext context, Func<Task> next, ServerOptions options)
{
var localOnly = options.Demo || (config.Platform == PlatformKind.Desktop && !config.AllowNetwork);
if (localOnly && !CurrentUser.IsLocal(context))
if (options.LocalOnly && !CurrentUser.IsLocal(context))
{
context.Response.StatusCode = StatusCodes.Status403Forbidden;
return context.Response.WriteAsync("Anubis risponde solo dal computer su cui gira.");
return context.Response.WriteAsync("Fuori dal container Anubis risponde solo da questo computer (sviluppo, prove, modalità dimostrativa).");
}
return next();
@@ -202,7 +200,7 @@ internal static class ServerApp
}
/// <summary>
/// While the application is not ready, every page is the service page (error, first run): the engine does not start
/// While the application is not ready, every page is the service page (the error page): the engine does not start
/// and no other database is ever opened (SPEC 15.1). Health, logo and style always answer.
/// </summary>
internal static class Gate
@@ -223,7 +221,7 @@ internal static class Gate
if (mode == HostMode.Ready)
{
if (path.StartsWithSegments("/servizio", StringComparison.Ordinal) || path.StartsWithSegments("/primo-avvio", StringComparison.Ordinal))
if (path.StartsWithSegments("/servizio", StringComparison.Ordinal))
{
context.Response.Redirect("/");
return;
@@ -234,21 +232,7 @@ internal static class Gate
}
var api = SessionAuthentication.IsApi(context.Request);
if (mode == HostMode.FirstRun)
{
if (path.StartsWithSegments("/primo-avvio", StringComparison.Ordinal) || path.StartsWithSegments("/azioni/primo-avvio", StringComparison.Ordinal))
{
await next().ConfigureAwait(false);
return;
}
if (!api && HttpMethods.IsGet(context.Request.Method))
{
context.Response.Redirect("/primo-avvio");
return;
}
}
else if (path.StartsWithSegments("/azioni/servizio", StringComparison.Ordinal))
if (path.StartsWithSegments("/azioni/servizio", StringComparison.Ordinal))
{
await next().ConfigureAwait(false);
return;