fix(config): remove hardcoded service endpoints
Heimdall Gitea / Detect CI scope (pull_request) Successful in 26s
Heimdall Gitea / Build and tests (pull_request) Successful in 16m8s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 4m2s
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 10m56s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 2s
Heimdall Gitea / Detect CI scope (pull_request) Successful in 26s
Heimdall Gitea / Build and tests (pull_request) Successful in 16m8s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 4m2s
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 10m56s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 2s
This commit is contained in:
1 parent
89c4c43922
commit
c9519eb568
18 files changed
+121
-46
No files matched your search
@@ -48,6 +48,7 @@ SENTRY_RELEASE=heimdall@1.0.0
|
||||
|
||||
# Agent (for local development only; production Compose is supplied by Central)
|
||||
HEIMDALL_CENTRAL_URL=http://localhost:5000
|
||||
HEIMDALL_PUBLIC_IP_RESOLVER_URL=
|
||||
HEIMDALL_SITE_TOKEN=replace-with-actual-token
|
||||
HEIMDALL_AGENT_NAME=agent-01
|
||||
HEIMDALL_HEARTBEAT_INTERVAL=30
|
||||
|
||||
@@ -12,11 +12,12 @@ jobs:
|
||||
image: renovate/renovate:44.133.0
|
||||
env:
|
||||
RENOVATE_PLATFORM: gitea
|
||||
RENOVATE_ENDPOINT: https://sources.tordais.cc/api/v1/
|
||||
RENOVATE_ENDPOINT: ${{ vars.GITEA_API_ENDPOINT }}
|
||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||
RENOVATE_ONBOARDING: 'false'
|
||||
steps:
|
||||
- name: Create dependency pull requests
|
||||
run: |
|
||||
test -n "$RENOVATE_TOKEN"
|
||||
test -n "$RENOVATE_ENDPOINT"
|
||||
renovate arnaud.dartois/Heimdall
|
||||
@@ -11,6 +11,7 @@ services:
|
||||
environment:
|
||||
ASPNETCORE_URLS: http://127.0.0.1:8081
|
||||
Agent__CentralUrl: ${HEIMDALL_CENTRAL_URL:-http://localhost:5000}
|
||||
Agent__PublicIpResolverUrl: ${HEIMDALL_PUBLIC_IP_RESOLVER_URL:-}
|
||||
Agent__AllowInsecureHttp: "true"
|
||||
Agent__SiteToken: ${HEIMDALL_SITE_TOKEN:?HEIMDALL_SITE_TOKEN is required}
|
||||
Agent__AgentName: ${HEIMDALL_AGENT_NAME:-agent-dev}
|
||||
|
||||
@@ -11,7 +11,8 @@ For a new Linux server, run the interactive installer directly from the source
|
||||
repository; cloning the repository is not required:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main/install/install-server.sh | bash
|
||||
SOURCE_BASE_URL="${HEIMDALL_SOURCE_BASE_URL:-https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main}"
|
||||
curl -fsSL "$SOURCE_BASE_URL/install/install-server.sh" | HEIMDALL_SOURCE_BASE_URL="$SOURCE_BASE_URL" bash
|
||||
```
|
||||
|
||||
The installer uses `eltruncho/heimdall:latest` from Docker Hub, creates a
|
||||
@@ -51,8 +52,9 @@ On Windows 10/11 with Docker Desktop in Linux-container mode, use PowerShell to
|
||||
download and run the matching installer without cloning the repository:
|
||||
|
||||
```powershell
|
||||
$sourceBase = if ($env:HEIMDALL_SOURCE_BASE_URL) { $env:HEIMDALL_SOURCE_BASE_URL.TrimEnd('/') } else { 'https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main' }
|
||||
$installer = Join-Path $env:TEMP 'heimdall-install-server.ps1'
|
||||
Invoke-WebRequest -UseBasicParsing -Uri 'https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main/install/install-server.ps1' -OutFile $installer
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "$sourceBase/install/install-server.ps1" -OutFile $installer
|
||||
Set-ExecutionPolicy -Scope Process Bypass -Force
|
||||
& $installer
|
||||
Remove-Item $installer
|
||||
@@ -60,11 +62,11 @@ Remove-Item $installer
|
||||
|
||||
The execution-policy bypass applies only to the current PowerShell process; a
|
||||
Group Policy can still block script execution. Both installers generate secrets
|
||||
locally and keep them in the selected installation directory. To pin a reviewed
|
||||
revision, download the installer from that revision and set
|
||||
`HEIMDALL_SOURCE_BASE_URL` to its `raw/commit/<SHA>` URL before running it; the
|
||||
variable also selects the optional Compose and backup files fetched by the
|
||||
installer. An offline installation must also provide those selected assets.
|
||||
locally and keep them in the selected installation directory. The scripts use the
|
||||
source URL shown above by default. To pin a reviewed revision, set
|
||||
`HEIMDALL_SOURCE_BASE_URL` to its `raw/commit/<SHA>` URL before downloading and
|
||||
running the installer; this also selects optional Compose and backup files. An
|
||||
offline installation must provide those selected assets.
|
||||
|
||||
The repository's `docker/docker-compose.prod.yml` is a manual alternative for
|
||||
operators who need a custom layout. It includes the same scoped Watchtower
|
||||
|
||||
@@ -8,6 +8,8 @@ Les jobs exigent `runs-on: [ubuntu-latest, build-agent]`. Déclarer `build-agent
|
||||
|
||||
Chaque runner lit sa configuration au démarrage. Ne pas rediriger `sources.tordais.cc` vers `host-gateway` dans `container.options` : cela a empêché les checkouts. Le workflow ne publie pas de rapports comme artefacts distants : les fichiers `artifacts/` sont utilisés dans le job (par exemple pour le seuil de couverture), puis disparaissent avec celui-ci. Le run historique #442 a signalé `CreateArtifact: EHOSTUNREACH`; aucun job courant ne dépend du service artefacts pour réussir.
|
||||
|
||||
Le workflow Renovate lit l’API Gitea dans la variable d’action `GITEA_API_ENDPOINT` et échoue immédiatement si elle est absente. Renseigner l’URL API de la forge sans coder son domaine dans le dépôt.
|
||||
|
||||
`scripts/ci/cleanup-docker.sh` journalise l'espace et élimine avant/après les builds les anciennes images Heimdall, les volumes Trivy abandonnés, les couches de build inutilisées depuis plus de 30 minutes et les images pendantes. Il ne purge pas les volumes, réseaux ou images nommées des autres projets. Le run #194 sur `runner-odin` a récupéré 95,89 Go avant build et 7,703 Go après job ; les 1 965 tests, deux images et scans ont réussi.
|
||||
|
||||
## Tests
|
||||
|
||||
@@ -26,8 +26,13 @@ CONFIG_DIR="${HOME}/.config/heima-manager"
|
||||
LOG_DIR="${CONFIG_DIR}/logs"
|
||||
CLINE_DIR="${HOME}/.config/cline"
|
||||
KANBAN_DIR="${HOME}/.config/kanban"
|
||||
SKILL_SERVER="${SKILL_SERVER_URL:-https://skill.tordais.cc}"
|
||||
MEMORIZER_URL="${MEMORIZER_URL:-https://memorizer.tordais.cc}"
|
||||
SKILL_SERVER="${SKILL_SERVER_URL:-}"
|
||||
MEMORIZER_URL="${MEMORIZER_URL:-}"
|
||||
|
||||
if [[ -z "$SKILL_SERVER" || -z "$MEMORIZER_URL" ]]; then
|
||||
err "SKILL_SERVER_URL and MEMORIZER_URL must be set to their API origins."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$HEIMA_DIR" "$CONFIG_DIR" "$LOG_DIR" "$CLINE_DIR" "$KANBAN_DIR"
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ compte doit pouvoir utiliser Docker. La commande télécharge et exécute le scr
|
||||
interactif directement depuis le dépôt :
|
||||
|
||||
```bash
|
||||
curl -fsSL https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main/install/install-server.sh | bash
|
||||
SOURCE_BASE_URL="${HEIMDALL_SOURCE_BASE_URL:-https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main}"
|
||||
curl -fsSL "$SOURCE_BASE_URL/install/install-server.sh" | HEIMDALL_SOURCE_BASE_URL="$SOURCE_BASE_URL" bash
|
||||
```
|
||||
|
||||
L’installateur demande un terminal interactif et lit ses réponses directement
|
||||
@@ -56,8 +57,9 @@ Sur Windows 10/11 avec Docker Desktop configuré en conteneurs Linux, ouvre
|
||||
PowerShell avec les droits nécessaires pour utiliser Docker et lance :
|
||||
|
||||
```powershell
|
||||
$sourceBase = if ($env:HEIMDALL_SOURCE_BASE_URL) { $env:HEIMDALL_SOURCE_BASE_URL.TrimEnd('/') } else { 'https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main' }
|
||||
$installer = Join-Path $env:TEMP 'heimdall-install-server.ps1'
|
||||
Invoke-WebRequest -UseBasicParsing -Uri 'https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main/install/install-server.ps1' -OutFile $installer
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "$sourceBase/install/install-server.ps1" -OutFile $installer
|
||||
Set-ExecutionPolicy -Scope Process Bypass -Force
|
||||
& $installer
|
||||
Remove-Item $installer
|
||||
@@ -65,12 +67,11 @@ Remove-Item $installer
|
||||
|
||||
Le contournement PowerShell est limité au processus courant. Une stratégie
|
||||
imposée par une GPO peut toujours interdire l’exécution. Les deux installateurs
|
||||
génèrent les secrets localement et ne les envoient pas au dépôt. Pour installer
|
||||
depuis une révision précise, télécharge l’installateur depuis cette révision et
|
||||
définis `HEIMDALL_SOURCE_BASE_URL` sur son URL `raw/commit/<SHA>` avant de le
|
||||
lancer; cette valeur sert aussi à récupérer les Compose facultatifs. Une
|
||||
installation sans accès Internet doit recevoir également les scripts Compose et
|
||||
de sauvegarde choisis.
|
||||
génèrent les secrets localement et ne les envoient pas au dépôt. Les installateurs utilisent cette URL source par défaut. Pour installer depuis
|
||||
une révision précise, définis `HEIMDALL_SOURCE_BASE_URL` sur son URL
|
||||
`raw/commit/<SHA>` avant la commande; la même valeur sert aux fichiers
|
||||
facultatifs téléchargés par l’installateur. Une installation sans accès Internet
|
||||
doit recevoir également les scripts Compose et de sauvegarde choisis.
|
||||
|
||||
Voir aussi le [guide de déploiement](docs/docker-compose.md).
|
||||
|
||||
|
||||
@@ -7,6 +7,17 @@ description: Maintain Central server installation, Compose refresh, and Docker i
|
||||
|
||||
Use this skill when changing the Linux or Windows Central installer, its generated Compose, or Central container update behavior.
|
||||
|
||||
## Central and release endpoints
|
||||
|
||||
- The Central address embedded in generated Agent installation commands must come from the browser's exposed `NavigationManager.BaseUri`; do not store a deployment hostname in a Razor page or installer template. Preserve the path base and trim only its trailing slash.
|
||||
- The release API source is the global `updates.releaseapiurl` setting edited in Settings and read by `UpdatesController`; keep it empty until an operator configures an HTTPS API URL. Agent release checks must go through the authenticated Central `/api/updates/agent/latest` endpoint, which returns the configured manifest and asset URLs.
|
||||
- Native Agent installers require an explicit Central URL, and Docker Agent configuration must pass `Agent:CentralUrl` from the generated command or deployment environment. Localhost defaults are permitted only in explicitly local development Compose/configuration.
|
||||
- Optional Agent public-IP discovery has no built-in provider hostname; configure `Agent:PublicIpResolverUrl` with an HTTPS endpoint or leave it empty to report no public IP. Validate the URL before creating the HTTP client.
|
||||
- Server-side API calls from Blazor circuits must prefer the process's Kestrel loopback binding over a retained browser `Host`; a public reverse-proxy host may not be reachable from inside the Central container. Normalize wildcard Kestrel binds (`0.0.0.0`, `[::]`, and `+`) to loopback while preserving the bound port.
|
||||
- Installer scripts should embed the official Heimdall source base as their standalone default and allow `HEIMDALL_SOURCE_BASE_URL` to override it for reviewed revisions or mirrors. Use it only for Heimdall-owned source assets; keep vendor dependencies on their official distribution sources.
|
||||
- Configure the Gitea API endpoint used by Renovate through the Actions variable `GITEA_API_ENDPOINT`; do not embed the forge hostname in workflow YAML.
|
||||
- Keep Compose network names project-scoped by omitting a fixed `networks.*.name`, especially for disposable validation projects.
|
||||
|
||||
## Deployment behavior
|
||||
|
||||
- Keep the installer-generated core stack limited to PostgreSQL, Central, and the updater. Only Central receives the Watchtower enable label; do not update PostgreSQL automatically.
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class AgentOptions
|
||||
{
|
||||
public const string SectionName = "Agent";
|
||||
|
||||
/// <summary>URL of the Heimdall Central server (e.g. http://heimdall-central:8080).</summary>
|
||||
/// <summary>URL of the Heimdall Central server, supplied by the installation or deployment configuration.</summary>
|
||||
[Required, Url]
|
||||
public string CentralUrl { get; init; } = string.Empty;
|
||||
|
||||
@@ -97,10 +97,13 @@ public sealed class AgentOptions
|
||||
|
||||
/// <summary>
|
||||
/// URL of the remote analysis broker (required when AnalysisMode = Remote).
|
||||
/// Example: http://heimdall-broker:8080
|
||||
/// Supply the broker URL through deployment configuration when remote analysis is enabled.
|
||||
/// </summary>
|
||||
public string? BrokerUrl { get; init; }
|
||||
|
||||
/// <summary>Optional HTTPS endpoint used to resolve this agent's public IP address.</summary>
|
||||
public string? PublicIpResolverUrl { get; init; }
|
||||
|
||||
public string DockerSocketPath { get; init; } = "/var/run/docker.sock";
|
||||
public bool AutoUpdateEnabled { get; set; }
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ builder.Services.AddOptions<AgentOptions>()
|
||||
(centralUri.Scheme == Uri.UriSchemeHttps ||
|
||||
(options.AllowInsecureHttp && centralUri.Scheme == Uri.UriSchemeHttp)),
|
||||
"Agent:CentralUrl must use HTTPS unless Agent:AllowInsecureHttp is explicitly enabled.")
|
||||
.Validate(options => string.IsNullOrWhiteSpace(options.PublicIpResolverUrl) ||
|
||||
(Uri.TryCreate(options.PublicIpResolverUrl, UriKind.Absolute, out var resolverUri) &&
|
||||
resolverUri.Scheme == Uri.UriSchemeHttps && string.IsNullOrEmpty(resolverUri.UserInfo) &&
|
||||
string.IsNullOrEmpty(resolverUri.Fragment)),
|
||||
"Agent:PublicIpResolverUrl must be empty or an absolute HTTPS URL without credentials or fragment.")
|
||||
.ValidateOnStart();
|
||||
|
||||
// HTTP clients
|
||||
@@ -56,9 +61,12 @@ builder.Services.AddHttpClient("Central", (sp, client) =>
|
||||
client.Timeout = TimeSpan.FromSeconds(10);
|
||||
});
|
||||
|
||||
builder.Services.AddHttpClient("IpResolver", client =>
|
||||
builder.Services.AddHttpClient("IpResolver", (sp, client) =>
|
||||
{
|
||||
client.Timeout = TimeSpan.FromSeconds(5);
|
||||
var configuredUrl = sp.GetRequiredService<IOptions<AgentOptions>>().Value.PublicIpResolverUrl;
|
||||
if (!string.IsNullOrWhiteSpace(configuredUrl))
|
||||
client.BaseAddress = new Uri(configuredUrl, UriKind.Absolute);
|
||||
});
|
||||
|
||||
// Broker HTTP client — used by RemoteFrameBrokerService when AnalysisMode=Remote.
|
||||
|
||||
@@ -331,8 +331,10 @@ public class AgentRegistrationService : BackgroundService
|
||||
try
|
||||
{
|
||||
var http = _httpClientFactory.CreateClient("IpResolver");
|
||||
if (http.BaseAddress is null)
|
||||
return null;
|
||||
http.Timeout = TimeSpan.FromSeconds(5);
|
||||
var ip = await http.GetStringAsync("https://api.ipify.org", ct);
|
||||
var ip = await http.GetStringAsync(string.Empty, ct);
|
||||
ip = ip?.Trim();
|
||||
_logger.LogDebug("Public IP resolved: {Ip}", ip);
|
||||
return ip;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
"Agent": {
|
||||
"CentralUrl": "",
|
||||
"PublicIpResolverUrl": "",
|
||||
"SiteToken": "",
|
||||
"AgentName": "",
|
||||
"HeartbeatIntervalSeconds": 30,
|
||||
|
||||
@@ -394,6 +394,6 @@ else
|
||||
|
||||
private string GenerateDockerComposeSnippet(string token) => "";
|
||||
|
||||
/// <summary>URL publique du serveur Heimdall (utilisée dans le compose généré).</summary>
|
||||
private string CentralUrl => "https://heimdall.tordais.cc";
|
||||
/// <summary>Origin exposed by the browser that operators use to reach Central.</summary>
|
||||
private string CentralUrl => Nav.BaseUri.TrimEnd('/');
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
@inject ISnackbar Snackbar
|
||||
@inject UiText Text
|
||||
@inject UiLanguageService Language
|
||||
@inject NavigationManager Nav
|
||||
@implements IDisposable
|
||||
|
||||
<MudText Typo="Typo.h1" Class="mb-1">
|
||||
@@ -286,18 +287,8 @@ else
|
||||
private bool? _editAutoUpdate;
|
||||
private string _editError = "";
|
||||
|
||||
/// <summary>URL publique du serveur Heimdall (utilisée dans le compose généré).</summary>
|
||||
private string CentralUrl
|
||||
=> _centralUrl ??= ResolveCentralUrl();
|
||||
|
||||
private string? _centralUrl;
|
||||
|
||||
private static string ResolveCentralUrl()
|
||||
{
|
||||
// Défaut : URL du serveur local ; à remplacer par la config publique
|
||||
// (ex: https://heimdall.tordais.cc) quand elle sera exposée.
|
||||
return "https://heimdall.tordais.cc";
|
||||
}
|
||||
/// <summary>Origin exposed by the browser that operators use to reach Central.</summary>
|
||||
private string CentralUrl => Nav.BaseUri.TrimEnd('/');
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ public static class ApiBaseUrlResolver
|
||||
{
|
||||
/// <summary>Placeholder used when no explicit base URL is configured; the
|
||||
/// SameOriginHttpMessageHandler rewrites it to the request origin.</summary>
|
||||
public const string PlaceholderBase = "http://heimdall.local/";
|
||||
public const string PlaceholderBase = "http://127.0.0.1/";
|
||||
|
||||
/// <summary>True when an explicit base URL is configured (config or env).</summary>
|
||||
public static bool IsConfigured(IConfiguration configuration) =>
|
||||
@@ -63,9 +63,11 @@ public static class ApiBaseUrlResolver
|
||||
// Wildcard binds (0.0.0.0 / [::]) cannot be dialed by an HttpClient —
|
||||
// replace the host with loopback, keeping the bound port.
|
||||
if (httpAddress.Contains("0.0.0.0", StringComparison.OrdinalIgnoreCase)
|
||||
|| httpAddress.Contains("[::]", StringComparison.OrdinalIgnoreCase))
|
||||
|| httpAddress.Contains("[::]", StringComparison.OrdinalIgnoreCase)
|
||||
|| httpAddress.Contains("://+:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var port = new Uri(httpAddress).Port;
|
||||
var parseableAddress = httpAddress.Replace("://+:", "://localhost:", StringComparison.OrdinalIgnoreCase);
|
||||
var port = new Uri(parseableAddress).Port;
|
||||
httpAddress = $"http://localhost:{port}/";
|
||||
}
|
||||
|
||||
@@ -135,8 +137,12 @@ public class SameOriginHttpMessageHandler : DelegatingHandler
|
||||
&& request.RequestUri.OriginalString.StartsWith(
|
||||
ApiBaseUrlResolver.PlaceholderBase, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var origin = ApiBaseUrlResolver.ResolveOrigin(_httpContextAccessor)
|
||||
?? ApiBaseUrlResolver.ResolveFromServer(_server);
|
||||
// A circuit can retain the browser-facing host, which is not
|
||||
// reachable from inside a container. Prefer this process's Kestrel
|
||||
// binding for server-side API calls; use the request origin only
|
||||
// when the host exposes no binding.
|
||||
var origin = ApiBaseUrlResolver.ResolveFromServer(_server)
|
||||
?? ApiBaseUrlResolver.ResolveOrigin(_httpContextAccessor);
|
||||
if (!string.IsNullOrWhiteSpace(origin))
|
||||
{
|
||||
var path = request.RequestUri.OriginalString[ApiBaseUrlResolver.PlaceholderBase.Length..];
|
||||
|
||||
@@ -65,6 +65,7 @@ public class SiteDetailTests : PageTestBase
|
||||
var compose = cut.Find("pre code").TextContent;
|
||||
compose.ShouldContain("registry.example/heimdall-agent@sha256:");
|
||||
compose.ShouldContain("network_mode: host");
|
||||
compose.ShouldContain("Agent__CentralUrl: \"http://localhost\"");
|
||||
compose.ShouldContain("Agent__SiteToken: \"tok-detail-42\"");
|
||||
compose.ShouldNotContain("postgresql");
|
||||
compose.ShouldNotContain("ollama");
|
||||
|
||||
@@ -2,7 +2,9 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using Heimdall.Web.Services;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NSubstitute;
|
||||
using Shouldly;
|
||||
@@ -24,17 +26,54 @@ public class SameOriginHttpMessageHandlerTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolveFromServer_WildcardKestrelHost_UsesLoopbackAddress()
|
||||
{
|
||||
var addresses = new ServerAddressesFeature();
|
||||
addresses.Addresses.Add("http://+:8080");
|
||||
var features = new FeatureCollection();
|
||||
features.Set<IServerAddressesFeature>(addresses);
|
||||
var server = Substitute.For<IServer>();
|
||||
server.Features.Returns(features);
|
||||
|
||||
ApiBaseUrlResolver.ResolveFromServer(server).ShouldBe("http://localhost:8080/");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SendAsync_UsesKestrelBindingInsteadOfBrowserHostForServerCall()
|
||||
{
|
||||
var addresses = new ServerAddressesFeature();
|
||||
addresses.Addresses.Add("http://+:8080");
|
||||
var features = new FeatureCollection();
|
||||
features.Set<IServerAddressesFeature>(addresses);
|
||||
var server = Substitute.For<IServer>();
|
||||
server.Features.Returns(features);
|
||||
var httpContext = new DefaultHttpContext();
|
||||
httpContext.Request.Scheme = "https";
|
||||
httpContext.Request.Host = new HostString("public.example.net");
|
||||
var accessor = Substitute.For<IHttpContextAccessor>();
|
||||
accessor.HttpContext.Returns(httpContext);
|
||||
var capture = new CapturingHandler();
|
||||
var handler = CreateHandler(new AuthState(), accessor, capture, server);
|
||||
using var client = new HttpClient(handler) { BaseAddress = new(ApiBaseUrlResolver.PlaceholderBase) };
|
||||
|
||||
await client.GetAsync("api/auth/bootstrap-status");
|
||||
|
||||
capture.LastRequest!.RequestUri!.GetLeftPart(UriPartial.Authority)
|
||||
.ShouldBe("http://localhost:8080");
|
||||
}
|
||||
|
||||
private static SameOriginHttpMessageHandler CreateHandler(
|
||||
AuthState authState,
|
||||
IHttpContextAccessor? accessor = null,
|
||||
HttpMessageHandler? inner = null)
|
||||
HttpMessageHandler? inner = null,
|
||||
IServer? server = null)
|
||||
{
|
||||
var config = Substitute.For<IConfiguration>();
|
||||
var server = Substitute.For<IServer>();
|
||||
var handler = new SameOriginHttpMessageHandler(
|
||||
accessor ?? Substitute.For<IHttpContextAccessor>(),
|
||||
config,
|
||||
server,
|
||||
server ?? Substitute.For<IServer>(),
|
||||
authState)
|
||||
{
|
||||
InnerHandler = inner ?? new CapturingHandler()
|
||||
|
||||
@@ -4,7 +4,7 @@ Ce fichier remplace les rapports de `docs/audits/` et constitue le suivi courant
|
||||
|
||||
## P0 — CI et publication
|
||||
|
||||
- [x] Rétablir le checkout des jobs : retirer `--add-host=sources.tordais.cc:host-gateway` de la configuration des runners. Le run #442 a franchi le checkout et les tests.
|
||||
- [x] Rétablir le checkout des jobs : retirer la redirection de l’hôte de forge configuré vers `host-gateway` de la configuration des runners. Le run #442 a franchi le checkout et les tests.
|
||||
- [x] Séparer les suites .NET en étapes nommées et planifier les suites affectées pour les PR ; conserver la validation complète sur `main` et les tags. PR #67, test isolé : seuls IntegrationTests ont tourné (147 réussis). PR #68, changement Application + Web : toutes les suites affectées ont passé ; Domain a été ignorée. Le run push #227 confirme `Test plan: all` sur `main`. Les chemins qui lancent le workflow sont désormais filtrés pour les PR et les pushes de branche `main`; les tags `v*` conservent les validations complètes.
|
||||
- [x] Construire et scanner les images serveur et Agent dans deux jobs CI distincts après `verify`. Le run PR #196 a passé `verify` et les deux jobs en parallèle, serveur sur `runner-murin` et Agent sur `runner-hugin`. Le run main #227 a aussi validé la publication des tags Docker Hub après les deux succès (preuve ci-dessous).
|
||||
- [x] Retirer `build-agent` de `runner-aaja` et le réserver aux runners de build autorisés. Le run PR #193 lui avait été affecté puis annulé ; le propriétaire a confirmé le retrait du label le 24 octobre 2026. Le run PR #194 s'exécute sur `runner-odin`.
|
||||
@@ -30,7 +30,7 @@ Ce fichier remplace les rapports de `docs/audits/` et constitue le suivi courant
|
||||
- [ ] **Heartbeat / failover** La PR #87 aligne le délai Offline sur la fréquence configurée (globalement ou par Agent), supprime le job concurrent qui pouvait empêcher la réaffectation, et relance celle-ci pour les Agents Offline qui gardent des caméras actives. La plage est limitée à 5–300 s comme côté Agent (timeout effectif maximal : 660 s). Les fixtures de failover utilisent un heartbeat vieux de 900 s pour tester un Agent effectivement expiré. Le run PR #276 a validé build/tests et les scans des images serveur et Agent; la validation sur plusieurs Agents reste à faire.
|
||||
- [ ] **PIPE-10 / FEAT-05** La PR #74 fait remonter les erreurs ntfy; la PR #76 ajoute une outbox SQL atomique avec état, leases, reprise périodique et unicité par notification/canal. Sa CI (run #242) a validé les tests et scans d’images. La PR #110 ajoute des tests PostgreSQL du succès, du backoff après erreur, de la reprise de lease expirée, de l’ignorance des livraisons différées ou déjà prises et du routage Hangfire par canal. Le run PR #332 a passé les 155 tests d’intégration et les 35 E2E sans test ignoré, les builds/scans des deux images et `CI policy`; la publication Docker Hub a été ignorée comme prévu. Restent les essais SMTP/ntfy réels. La livraison reste au moins une fois : une panne après acceptation fournisseur mais avant l’acquittement SQL peut produire un doublon; aucune garantie exactement une fois n’est possible avec ces interfaces.
|
||||
- [ ] **OPS-02** Les PR #62, #63 et #106 protègent les références de caméras supprimées logiquement, enregistrent l'inventaire des destinations avant upload et font parcourir ces destinations par le nettoyage final. Le run PR #317 a passé les 284 tests Infrastructure, dont les scénarios de changement de destination (snapshot référencé conservé, puis orphelin supprimé) et de S3 historique inaccessible (références conservées). Restent les objets recording tant que FEAT-02 n'a pas de producteur, les lignes historiques sans provenance (ne pas deviner), et la validation du changement de provider sur stockage déployé.
|
||||
- [ ] **OPS-05 / AGENT-06** Les Compose sont simplifiés en un noyau Central + PostgreSQL (avec Watchtower pour la mise à jour Central), un Compose Agent de développement local et des Compose facultatifs séparés par logiciel. En production, le Compose Agent est fourni par l’IHM pour le site sélectionné; le Compose statique de production a été supprimé. La PR #114 retire du Compose les réglages métier (SMTP, ntfy, Ollama, stockage, source des releases et URL API) pour les gérer par l’IHM avec portée globale, en laissant les destinations de notification à leur portée site/utilisateur. La PR #117 ajoute l’installateur interactif Linux Central + PostgreSQL et fixe les images à Docker Hub; sa CI PR #394 a passé tests et scans des deux images ainsi que `CI policy`, puis a été fusionnée sur `main` (`d1f3f1a`). Restent l’installation des clés de signature CI et la validation réelle de la génération IHM, digest/signature Agent, mise à jour native/Docker, arrêt propre et rollback.
|
||||
- [ ] **OPS-05 / AGENT-06** Les Compose sont simplifiés en un noyau Central + PostgreSQL (avec Watchtower pour la mise à jour Central), un Compose Agent de développement local et des Compose facultatifs séparés par logiciel. En production, le Compose Agent est fourni par l’IHM pour le site sélectionné; le Compose statique de production a été supprimé. La PR #114 retire du Compose les réglages métier (SMTP, ntfy, Ollama, stockage, source des releases et URL API) pour les gérer par l’IHM avec portée globale, en laissant les destinations de notification à leur portée site/utilisateur. La PR #117 ajoute l’installateur interactif Linux Central + PostgreSQL; CI PR #394 passée puis fusionnée (`d1f3f1a`). Le scan du 4 novembre 2026 a retiré les domaines Central des pages Sites/Détail; ces commandes prennent l’origine exposée par l’UI. La source de releases est `updates.releaseapiurl`, vide jusqu’à configuration. DSN Sentry retirés d’appsettings. L’IP publique Agent est optionnelle via `Agent:PublicIpResolverUrl`. `HEIMDALL_SOURCE_BASE_URL` ne sert qu’aux fichiers Heimdall; les installateurs serveur ont l’origine officielle en défaut et permettent un override pour épingler une révision; les dépendances .NET restent distribuées par les sources Microsoft officielles. Renovate lit son endpoint Gitea depuis `GITEA_API_ENDPOINT`; `heima-manager` exige ses origines API en variables d’environnement. Une recette Compose Central jetable avec identifiants, ports loopback et volumes propres au projet a validé `/healthz`, `/setup` et CORS sur l’origine configurée; conteneurs, volumes, réseau et fichiers temporaires supprimés et absence de résidu confirmée. Tests Web 414/414 et Agent 388/388. `bash -n` et `git diff --check` passés. Restent les validations réelles de signature et de mise à jour Agent.
|
||||
- [ ] **Installateurs Agent / mises à jour façon Pangolin** La PR #120 ajoute les choix d’OS et méthodes supportés dans l’IHM, les commandes Bash/PowerShell qui téléchargent les scripts depuis Central, les installs natives Linux/Windows vérifiant signature et digest, le mode service, le rollback après contrôle de démarrage, le réglage global avec surcharge nullable de site, et les mises à jour natives après 24 h de stabilité (les conteneurs restent gérés par l’orchestrateur). La migration conserve les choix existants. La PR #127 rend la commande PowerShell compatible avec les postes `Restricted` en appliquant le contournement d’exécution à la session courante seulement; une GPO peut encore prévaloir. Le run PR #437 a passé tests/build, scans des deux images et `CI policy`. Restent les validations réelles d’installation, mise à jour et rollback sur hôtes Linux et Windows.
|
||||
- [ ] **Installateur Central sans clone (Linux/Windows)** Les scripts `install/install-server.sh` et `install/install-server.ps1` peuvent être téléchargés depuis la branche `main` et exécutés directement; ils créent le Compose Central + PostgreSQL + Watchtower, les secrets locaux protégés et téléchargent seulement les Compose facultatifs choisis. Les images publiées des Compose d’exploitation utilisent `pull_policy: always`; Watchtower (fork actif `nickfedor/watchtower`) ne surveille que Central, vérifie toutes les 24 h et supprime les anciennes images après mise à jour (`--cleanup`), sans effacer les volumes. Une réexécution peut sauvegarder/remplacer le Compose, sauvegarder les fichiers optionnels sélectionnés et compléter uniquement les variables absentes, en conservant `.env`, secrets existants et volumes. La recette Linux première installation + réexécution a passé; le Compose Central/PostgreSQL/Watchtower a passé la recette jetable, le health check Central et le nettoyage ciblé. Restent la validation Windows réelle/ACL, les hôtes propres et les services facultatifs démarrés.
|
||||
- [ ] **AGENT-08** Valider reconnexion, remplacement atomique de configuration caméra et ACK persisté sur Agent déployé.
|
||||
|
||||
Reference in new issue
Block a user