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

+24 -40
View File
@@ -12,15 +12,13 @@ return command switch
{
"check" => Check(),
"test" => Test(Environment.GetEnvironmentVariable("ANUBIS_TEST_DB") ?? "sqlite", rest),
"dev" => Run("dotnet", ["watch", "--project", "src/Anubis.Server", "run", .. rest]),
"dev" => Dev(rest),
"build" => BuildImage("dev"),
"ci" => Ci(),
"hooks" => Step("Attivazione dell'hook pre-commit (.githooks)", "git", ["config", "core.hooksPath", ".githooks"]) ?? 0,
"seed-demo" => Run("dotnet", ["run", "--project", "src/Anubis.Server", "-c", "Release", "--", "--demo", .. rest]),
"screenshots" => Screenshots(rest),
"release-win" => ReleaseWindows(),
"ci-service-log" => ServiceLog.Print(rest.Length > 0 ? rest[0] : "postgres"),
"desktop-win" => NotYet("desktop-win", 10),
_ => Help(),
};
@@ -90,7 +88,7 @@ int BuildImage(string tag) =>
string Commit()
{
// What the Dockerfile copies, and what decides it.
string[] imageSources = ["Directory.Build.props", "Directory.Packages.props", "global.json", ".dockerignore", "src", "deploy/docker", "docs/design/logo", "docs/backtests", "docs/learning"];
string[] imageSources = ["Directory.Build.props", "Directory.Build.targets", "Directory.Packages.props", "global.json", ".dockerignore", "src", "deploy/docker", "docs/design/logo", "docs/backtests", "docs/learning"];
var commit = Git("rev-parse", "HEAD");
return commit is null ? "" : Git(["status", "--porcelain", "--", .. imageSources]) is "" ? commit : commit + "-dirty";
}
@@ -225,43 +223,31 @@ static int FreePort()
return port;
}
// The zip of a trial release for Windows (ADR 0013, point 6): the server, a start script and the instructions, before
// the Phase 10 installer exists. It needs the ASP.NET Core 10 runtime on the computer.
int ReleaseWindows()
// The server on this computer for development (ADR 0022): the shape of the container, with its own data folder
// (artifacts/dev-data, ignored by git) and the development values of docker-compose.yml where the variables are missing.
// Outside a container it listens only on 127.0.0.1.
int Dev(string[] arguments)
{
var version = Version();
var name = $"anubis-{version}-win-x64";
var output = Path.Combine(root, "artifacts", "release");
var folder = Path.Combine(output, name);
if (Directory.Exists(folder))
var server = arguments.Contains("--data-dir") ? arguments : [.. arguments, "--data-dir", Path.Combine(root, "artifacts", "dev-data")];
// The development values of docker-compose.yml, with SQLite: never used by a real installation.
(string Key, string Value)[] defaults =
[
("ANUBIS_DB_ENGINE", "sqlite"),
("ANUBIS_SECRET_KEY", "dev-only-secret-key-change-me-0123456789"),
("ANUBIS_ADMIN_PASSWORD", "dev-only-change-me"),
("ANUBIS_ALLOW_LIVE", "0"),
("TZ", "Europe/Rome"),
];
var env = new Dictionary<string, string>(StringComparer.Ordinal);
foreach (var (key, value) in defaults)
{
Directory.Delete(folder, recursive: true);
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable(key)))
{
env[key] = value;
}
}
var failed = Step($"Pubblicazione del server {version} per Windows", "dotnet",
["publish", "src/Anubis.Server", "-c", "Release", "-r", "win-x64", "--self-contained", "false", "-o", folder]);
if (failed is { } code)
{
return code;
}
foreach (var file in Directory.EnumerateFiles(Path.Combine(root, "deploy", "windows")))
{
File.Copy(file, Path.Combine(folder, Path.GetFileName(file)), overwrite: true);
}
var zip = Path.Combine(output, name + ".zip");
File.Delete(zip);
System.IO.Compression.ZipFile.CreateFromDirectory(folder, zip, System.IO.Compression.CompressionLevel.Optimal, includeBaseDirectory: true);
Console.WriteLine();
Console.WriteLine($"== Pronto: {zip} ({(new FileInfo(zip).Length / 1048576.0).ToString("0.0", CultureInfo.InvariantCulture)} MB)");
return 0;
}
int NotYet(string name, int phase)
{
Console.Error.WriteLine($"'tasks {name}' arriva nella Fase {phase.ToString(CultureInfo.InvariantCulture)}.");
return 2;
return Run("dotnet", ["watch", "--project", "src/Anubis.Server", "run", "--", .. server], env);
}
int Help()
@@ -270,15 +256,13 @@ int Help()
Comandi di Anubis (ADR 0003):
tasks check ripristino bloccato, formattazione, compilazione, test
tasks test solo i test (motore da ANUBIS_TEST_DB, predefinito sqlite)
tasks dev avvia il server e lo riavvia a ogni modifica
tasks dev avvia il server su questo computer (dati in artifacts/dev-data) e lo riavvia a ogni modifica
tasks build costruisce l'immagine Docker
tasks ci come la CI: check, test su PostgreSQL, immagine
tasks hooks attiva l'hook che esegue check prima di ogni commit
tasks seed-demo avvia la modalità dimostrativa (dati dell'appendice F, database a parte)
tasks screenshots fotografa le schermate dimostrative a 1440 e 390 pixel
tasks release-win zip di prova per Windows in artifacts/release (ADR 0013)
tasks ci-service-log nella CI: registro e memoria del PostgreSQL dei test
tasks desktop-win installatore Windows (Fase 10)
""");
return command == "help" ? 0 : 1;
}