Fase 10 — Nuova rotta: solo Docker (#184)
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:
1 parent
3c57b3e84c
commit
1bc7e067fd
96 files changed
+1433
-1606
No files matched your search
@@ -121,6 +121,9 @@ public sealed partial class DeliveryTests
|
||||
Assert.AreEqual("/mnt/user/appdata/anubis", fields["/data"].Value);
|
||||
var extra = template.Element("ExtraParams")!.Value;
|
||||
StringAssert.Contains(extra, "--memory=4g");
|
||||
StringAssert.Contains(extra, "--log-opt max-size=10m --log-opt max-file=3", "Docker's own log files rotate (ADR 0022).");
|
||||
StringAssert.Contains(Text("docs/MANUALE.md"), "--log-opt max-size=10m --log-opt max-file=3");
|
||||
StringAssert.Contains(Text("docker-compose.yml"), "max-size: 10m");
|
||||
var stop = int.Parse(StopTimeout().Match(extra).Groups[1].Value, System.Globalization.CultureInfo.InvariantCulture);
|
||||
Assert.AreEqual(60, stop);
|
||||
Assert.IsGreaterThan(new GuardOptions().GracefulStop, TimeSpan.FromSeconds(stop));
|
||||
@@ -223,15 +226,34 @@ public sealed partial class DeliveryTests
|
||||
StringAssert.Contains(docker, "org.opencontainers.image.revision=\"$ANUBIS_COMMIT\"");
|
||||
var publish = docker.Split('\n').Where(l => l.StartsWith("RUN dotnet publish", StringComparison.Ordinal)).ToList();
|
||||
Assert.HasCount(2, publish);
|
||||
Assert.IsTrue(publish.All(l => l.EndsWith("${ANUBIS_COMMIT:+-p:SourceRevisionId=$ANUBIS_COMMIT}", StringComparison.Ordinal)));
|
||||
Assert.IsTrue(publish.All(l => l.EndsWith(" -o /app ${ANUBIS_COMMIT:+-p:SourceRevisionId=$ANUBIS_COMMIT}", StringComparison.Ordinal)),
|
||||
"Into /app, with the commit as a separate argument: without the space the output folder would swallow it.");
|
||||
StringAssert.Contains(docker, "COPY global.json Directory.Build.props Directory.Build.targets Directory.Packages.props ./");
|
||||
Assert.Contains("grep -qiE '^onnxruntime", docker, "The build stops if the Windows libraries of ONNX Runtime come back into /app.");
|
||||
CollectionAssert.AreEquivalent(new[] { "mcr.microsoft.com/dotnet/sdk:10.0", "mcr.microsoft.com/dotnet/aspnet:10.0" },
|
||||
docker.Split('\n').Where(l => l.StartsWith("FROM ", StringComparison.Ordinal)).Select(l => l.Split(' ')[1]).ToList());
|
||||
StringAssert.Contains(docker, "${PORT:-8787}");
|
||||
StringAssert.Contains(docker, "EXPOSE 8787\n");
|
||||
StringAssert.Contains(docker, "--timeout=10s", "Longer than the 5 seconds the page waits for the database, so its answer arrives.");
|
||||
|
||||
// Only what Linux x64 needs (ADR 0022): the native libraries of the other 23 platforms stay out of the image.
|
||||
var restore = docker.Split('\n').Where(l => l.Contains("dotnet restore", StringComparison.Ordinal)).ToList();
|
||||
Assert.HasCount(2, restore);
|
||||
Assert.IsTrue(restore.Concat(publish).All(l => l.Contains(" -r linux-x64 ", StringComparison.Ordinal)), string.Join("\n", restore.Concat(publish)));
|
||||
Assert.IsTrue(publish.All(l => l.Contains("--self-contained false", StringComparison.Ordinal)));
|
||||
Assert.DoesNotContain("ANUBIS_PLATFORM", docker, "The guard and the server recognise the container by themselves.");
|
||||
|
||||
var entry = Text("deploy/docker/entrypoint.sh");
|
||||
StringAssert.Contains(entry, "PUID=0");
|
||||
StringAssert.Contains(entry, "--no-new-privs");
|
||||
|
||||
// Every one-shot command of the server runs outside the guard, which would restart it when it ends.
|
||||
var oneShot = OneShot().Match(entry);
|
||||
Assert.IsTrue(oneShot.Success, "The entrypoint routes the one-shot commands.");
|
||||
var routed = oneShot.Groups[1].Value.Split('|');
|
||||
var commands = CommandOfTheServer().Matches(Text("src/Anubis.Server/Program.cs")).Select(m => m.Groups[1].Value).ToList();
|
||||
Assert.IsNotEmpty(commands);
|
||||
CollectionAssert.AreEquivalent(commands, routed);
|
||||
}
|
||||
|
||||
// ---- the workflow ----
|
||||
@@ -574,6 +596,12 @@ public sealed partial class DeliveryTests
|
||||
[GeneratedRegex(@"--stop-timeout (\d+)")]
|
||||
private static partial Regex StopTimeout();
|
||||
|
||||
[GeneratedRegex(@"\r?\n\s*([a-z|]+)\)\r?\n\s*app=""/app/Anubis\.Server\.dll""")]
|
||||
private static partial Regex OneShot();
|
||||
|
||||
[GeneratedRegex(@"args\[0\] == ""([a-z]+)""")]
|
||||
private static partial Regex CommandOfTheServer();
|
||||
|
||||
[GeneratedRegex(@"publish\.sh|docker (push|login)")]
|
||||
private static partial Regex PublishCommand();
|
||||
}
|
||||
Reference in new issue
Block a user