Phase 10: new course and Docker only

Record the course the user chose on 2 December 2026 and make the
container the only form of Anubis.

- ADR 0021-0026: new roadmap (phases 10-24, readings per phase, the
  spec-to-ADR table, merge and tag only after the user's yes),
  Docker only, maths-only decisions, bans turned into limits on margin
  accounts, eToro Demo as currency venue and forward tests, strategy
  championship. ROADMAP rewritten from phase 10; STATE, CLAUDE.md,
  SVILUPPO, README, API-NOTES and the manuals without the desktop.
- Remove the desktop: Anubis.Desktop, Anubis.Setup, deploy/windows,
  release-win and desktop-win, config.toml, PlatformKind,
  ANUBIS_PLATFORM, DPAPI with the ProtectedData package and the
  first-run wizard. Outside a container the server needs --data-dir,
  listens on 127.0.0.1 only and refuses foreign hosts; server and guard
  refuse --platform desktop with an Italian message and exit code 2.
  The demo keeps its key in a file and its error-page choices need no
  startup password. The diagnostics report says where the server runs
  from its own environment.
- Lighter image: restore and publish for linux-x64 only, and leave out
  the Windows libraries ONNX Runtime copies anyway (829 MB to 410 MB on
  disk, /app from 282 MB to 42 MB). Rotating Docker logs in the Unraid
  template, the manual and the compose; backtest and learning run as
  one-shot commands. tasks dev uses artifacts/dev-data.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-03 17:35:17 +01:00
1 parent 3c57b3e84c
commit e9ac6dccc9
95 files changed
+1426 -1604

No files matched your search

+93 -22
View File
@@ -165,6 +165,13 @@ public sealed class ServerTests
}
TempFolder.Delete(demoRoot);
// A development run outside a container: the same refusal, even when bound to every address (ADR 0022).
await using var dev = await ServerHarness.StartAsync("docker", ServerHarness.DockerSqlite());
using var rebinding = new HttpRequestMessage(HttpMethod.Get, new Uri("/health", UriKind.Relative));
rebinding.Headers.Host = "evil.example:" + dev.BaseAddress.Port.ToString(System.Globalization.CultureInfo.InvariantCulture);
using var refused = await dev.Http.SendAsync(rebinding);
Assert.AreEqual(HttpStatusCode.Forbidden, refused.StatusCode);
}
[TestMethod]
@@ -332,36 +339,93 @@ public sealed class ServerTests
}
[TestMethod]
public async Task DesktopStartsFromAnEmptyFolderAndKeepsTheKeyOutOfConfig()
public void TheDesktopIsGoneAndOutsideAContainerTheFolderIsGivenByHand()
{
await using var server = await ServerHarness.StartAsync("desktop", new Dictionary<string, string?>(), waitReady: false);
await server.WaitForAsync(HostMode.FirstRun);
var env = ServerHarness.DockerSqlite();
var desktop = Assert.Throws<StartupRefusedException>(() => ServerOptions.Parse(["--platform", "desktop"], env));
Assert.Contains("solo in un container Docker", desktop.Message);
using (var redirect = await server.GetAsync("/"))
// "--platform docker" still works, for the commands already written in the manuals.
var outside = ServerOptions.Parse(["--platform", "docker"], env);
Assert.IsFalse(outside.InContainer);
Assert.IsTrue(outside.LocalOnly);
var refused = Assert.Throws<StartupRefusedException>(() => outside.LoadConfig(env));
Assert.Contains("--data-dir", refused.Message);
var inside = new Dictionary<string, string?>(env, StringComparer.Ordinal) { ["DOTNET_RUNNING_IN_CONTAINER"] = "true" };
var container = ServerOptions.Parse([], inside);
Assert.IsTrue(container.InContainer);
Assert.IsFalse(container.LocalOnly);
Assert.AreEqual("/data", container.LoadConfig(inside).Data.Root);
}
[TestMethod]
[DataRow(false, "http://127.0.0.1:")]
[DataRow(true, "http://0.0.0.0:")]
public async Task OutsideAContainerTheServerListensOnlyOnThisComputer(bool inContainer, string address)
{
var folder = TempFolder.Create("listen");
try
{
Assert.AreEqual("/primo-avvio", ServerHarness.Location(redirect));
var env = ServerHarness.DockerSqlite();
env["PORT"] = "18787";
if (inContainer)
{
env["DOTNET_RUNNING_IN_CONTAINER"] = "true";
}
await using (var app = ServerApp.Build(["--data-dir", folder], new ServerOverrides { Environment = env, PasswordIterations = 1000 }))
{
Assert.AreEqual(address + "18787", app.Configuration["urls"]);
}
}
finally
{
TempFolder.Delete(folder);
}
}
[TestMethod]
[DataRow("Anubis.Server.dll", "--platform desktop", "solo in un container Docker")]
[DataRow("Anubis.Server.dll", "", "--data-dir")]
[DataRow("Anubis.Guard.dll", "--platform desktop", "solo in un container Docker")]
[DataRow("Anubis.Guard.dll", "--platform desktop --data-dir .", "solo in un container Docker")]
[DataRow("Anubis.Guard.dll", "", "--data-dir")]
public async Task TheServerSaysInItalianWhyItDoesNotStart(string program, string arguments, string message)
{
var info = new System.Diagnostics.ProcessStartInfo(Anubis.Supervision.GuardLaunch.Dotnet())
{
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false,
};
// The guard too: a refused start ends with the message, not with an engine restarted again and again.
info.ArgumentList.Add(Path.Combine(AppContext.BaseDirectory, program));
foreach (var argument in arguments.Split(' ', StringSplitOptions.RemoveEmptyEntries))
{
info.ArgumentList.Add(argument);
}
const string password = "fake-desktop-pass-3";
using (var done = await server.PostFormAsync("/primo-avvio", "/azioni/primo-avvio", ("motore", "sqlite"), ("password", password), ("conferma", password)))
// Outside a container, even when the suite runs in one (the CI).
info.Environment.Remove("DOTNET_RUNNING_IN_CONTAINER");
using var process = System.Diagnostics.Process.Start(info)!;
var errors = process.StandardError.ReadToEndAsync();
_ = process.StandardOutput.ReadToEndAsync();
using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(60));
try
{
Assert.AreEqual("/", ServerHarness.Location(done));
await process.WaitForExitAsync(timeout.Token);
}
catch (OperationCanceledException)
{
// A guard that does not refuse would restart the engine for ever: it goes, with what it started.
process.Kill(entireProcessTree: true);
Assert.Fail(program + " did not end within a minute.");
}
Assert.AreEqual(HostMode.Ready, server.Host.Status.Mode);
using (var home = await server.GetAsync("/"))
{
Assert.AreEqual(HttpStatusCode.OK, home.StatusCode, "Signed in by the wizard.");
}
var data = new DataDirectory(server.DataDir);
Assert.IsTrue(File.Exists(data.SqliteFile));
var config = await File.ReadAllTextAsync(data.ConfigFile);
StringAssert.Contains(config, "engine = \"sqlite\"");
StringAssert.Contains(config, "allow_live = false");
Assert.IsFalse(System.Text.RegularExpressions.Regex.IsMatch(config, @"^\s*\w*(secret|key|password)\w*\s*=", System.Text.RegularExpressions.RegexOptions.Multiline),
"Neither the secret key nor a password goes into config.toml.");
Assert.IsNotEmpty(Directory.EnumerateFiles(Path.Combine(data.Root, "keys")).ToList());
Assert.AreEqual(2, process.ExitCode);
Assert.Contains(message, await errors);
Assert.DoesNotContain(" at ", await errors, "A message, not a stack trace.");
}
[TestMethod]
@@ -403,6 +467,13 @@ public sealed class ServerTests
StringAssert.Contains(message, "\"bot\":\"active\"");
await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, null, CancellationToken.None);
// The demo has no startup password and answers only this computer: the error-page choices go through without one.
using (var choice = await server.PostFormAsync("/", "/azioni/servizio/riprova"))
{
Assert.AreEqual(HttpStatusCode.Redirect, choice.StatusCode);
Assert.DoesNotContain("errore", ServerHarness.Location(choice));
}
var after = Snapshot(configured);
CollectionAssert.AreEquivalent(before.Keys.ToList(), after.Keys.ToList(), "No file added or removed in the configured data folder.");
foreach (var (name, hash) in before)