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
@@ -18,9 +18,6 @@ public enum HostMode
|
||||
/// <summary>The startup configuration is missing or wrong: the error page lists what to fix.</summary>
|
||||
ConfigProblem,
|
||||
|
||||
/// <summary>Desktop without config.toml, or without a user yet: the first-run wizard.</summary>
|
||||
FirstRun,
|
||||
|
||||
/// <summary>The configured database does not answer: error page, retry, never another database (trap 20).</summary>
|
||||
DatabaseUnavailable,
|
||||
|
||||
@@ -79,13 +76,19 @@ internal sealed partial class AnubisHost(
|
||||
private volatile HostStatus _status = new(HostMode.Starting, null, null, clock.UtcNow, 0);
|
||||
private volatile AppServices? _services;
|
||||
|
||||
public StartupConfig Config { get; private set; } = initialConfig;
|
||||
public StartupConfig Config { get; } = initialConfig;
|
||||
|
||||
/// <summary>The channel to the guard that started this engine (SPEC 9.3); null without one.</summary>
|
||||
public GuardLink? Guard { get; init; }
|
||||
|
||||
public bool IsDemo => options.Demo;
|
||||
|
||||
/// <summary>Where this server answers from, in plain Italian: the container, the demo or a development run (ADR 0022).</summary>
|
||||
public string Where => options.Where;
|
||||
|
||||
/// <summary>True inside the container; outside it the server runs only for development and tests (ADR 0022).</summary>
|
||||
public bool InContainer => options.InContainer;
|
||||
|
||||
public HostStatus Status => _status;
|
||||
|
||||
public IClock Clock => clock;
|
||||
@@ -93,15 +96,12 @@ internal sealed partial class AnubisHost(
|
||||
/// <summary>The running services; null until the first successful start.</summary>
|
||||
public AppServices? Services => _status.Mode == HostMode.Ready ? _services : null;
|
||||
|
||||
/// <summary>Desktop first run: the password chosen in the wizard, used once the database is ready.</summary>
|
||||
public string? PendingPassword { get; set; }
|
||||
|
||||
public int PasswordIterations => overrides?.PasswordIterations ?? Passwords.DefaultIterations;
|
||||
|
||||
/// <summary>Why the last migration failed; the error page's "Riprova" clears it.</summary>
|
||||
internal string? MigrationFailed { get; set; }
|
||||
|
||||
/// <summary>Asks the loop to check again now (after the wizard or an error-page choice).</summary>
|
||||
/// <summary>Asks the loop to check again now (after an error-page choice).</summary>
|
||||
public void Wake()
|
||||
{
|
||||
lock (_gate)
|
||||
@@ -302,18 +302,6 @@ internal sealed partial class AnubisHost(
|
||||
|
||||
private async Task StepAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
// Desktop: the wizard may have written config.toml, or the user fixed it by hand.
|
||||
if (Config.Platform == PlatformKind.Desktop && !options.Demo && !Config.IsComplete)
|
||||
{
|
||||
Config = options.LoadConfig(environment);
|
||||
}
|
||||
|
||||
if (Config.NeedsFirstRun)
|
||||
{
|
||||
SetStatus(HostMode.FirstRun, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Config.IsComplete)
|
||||
{
|
||||
SetStatus(HostMode.ConfigProblem, null);
|
||||
@@ -406,11 +394,7 @@ internal sealed partial class AnubisHost(
|
||||
await DemoMode.SeedAsync(_db, Config.Data, clock, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (!await EnsureUserAsync(access, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
SetStatus(HostMode.FirstRun, null);
|
||||
return;
|
||||
}
|
||||
await EnsureUserAsync(access, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var scheduler = new Scheduler(clock, bus);
|
||||
|
||||
@@ -530,34 +514,24 @@ internal sealed partial class AnubisHost(
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> EnsureUserAsync(AccessStore access, CancellationToken cancellationToken)
|
||||
// The user is born from ANUBIS_ADMIN_PASSWORD, to be changed at the first access (ADR 0007, 0022). The loader
|
||||
// already made a missing or short password a problem of the configuration, so here it is always there.
|
||||
private async Task EnsureUserAsync(AccessStore access, CancellationToken cancellationToken)
|
||||
{
|
||||
if (await access.HasUserAsync(cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.Demo)
|
||||
{
|
||||
// The demo signs in by itself (see SessionAuthentication); the password exists only to fill the table.
|
||||
await access.EnsureUserAsync(Ids.NewToken(), mustChange: false, cancellationToken).ConfigureAwait(false);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.Platform == PlatformKind.Docker && Config.AdminPassword is { } initial)
|
||||
{
|
||||
await access.EnsureUserAsync(initial, mustChange: true, cancellationToken).ConfigureAwait(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PendingPassword is { } chosen)
|
||||
{
|
||||
await access.EnsureUserAsync(chosen, mustChange: false, cancellationToken).ConfigureAwait(false);
|
||||
PendingPassword = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
var initial = Config.AdminPassword ?? throw new InvalidOperationException("ANUBIS_ADMIN_PASSWORD is checked by the loader.");
|
||||
await access.EnsureUserAsync(initial, mustChange: true, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// While running: the database is checked every few seconds. If it stops answering, the error page shows and the
|
||||
|
||||
Reference in new issue
Block a user