feat: bootstrap solution, Docker image and Gitea pipelines (M0)
CI / Build and test (SQLite) (pull_request) Successful in 43s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / YAML check (pull_request) Successful in 15s
CI / Docker image (pull_request) Successful in 59s
CI / Build and test (SQLite) (pull_request) Successful in 43s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / YAML check (pull_request) Successful in 15s
CI / Docker image (pull_request) Successful in 59s
Start development with the skeleton every later milestone builds on, so that code, image and release path exist and are verified from day one. - Khaemhat.sln with the ten projects of SPEC section 3 and six MSTest projects; shared build rules with warnings as errors, analyzers and Central Package Management restricted to the allowlist. - Architecture tests and scripts/check-packages.sh fail on any project reference or package that SPEC does not allow. - Khaemhat.Web serves an Italian "under construction" page with the official icons and version, plus /health/live, /health/ready and /health (ADR 0012); honours KHAEMHAT_URLS and KHAEMHAT_LOG_LEVEL. - docker/Dockerfile (non-root app user aligned to PUID/PGID by the entrypoint, pg_dump 17, healthcheck, OCI and Unraid labels) and compose files for PostgreSQL and a standalone SQLite demo. - Gitea Actions: ci.yml (build, tests, image smoke test, PostgreSQL 16/17 on tags, YAML check), release.yml (image and release from a vX.Y.Z tag, skipping versions already published) and wiki.yml. - Development scripts, VS Code launch/tasks for debugging, and ADR 0012-0017 deciding the M0 open points of docs/STATUS.md. Closes #1, #2, #3, #4, #5, #114 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
88de272b3e
commit
12277733f5
101 files changed
+3245
-67
No files matched your search
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Application</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Core/Khaemhat.Core.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Data/Khaemhat.Data.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Infrastructure/Khaemhat.Infrastructure.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Fiscal.Abstractions/Khaemhat.Fiscal.Abstractions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Khaemhat.Core.Common;
|
||||
|
||||
/// <summary>
|
||||
/// The product version as shown to people (SPEC §16.5): the SemVer number, its <c>major.minor</c> short form for the
|
||||
/// top bar and the versioned icon, and the source revision for the status bar and the system status page.
|
||||
/// </summary>
|
||||
/// <param name="Version">SemVer without build metadata, for example <c>1.2.3</c> or <c>0.1.0-dev</c>.</param>
|
||||
/// <param name="Revision">Short source revision (git commit), or an empty string when unknown.</param>
|
||||
public sealed record ProductVersion(string Version, string Revision)
|
||||
{
|
||||
/// <summary>The <c>major.minor</c> part of <see cref="Version"/>, for example <c>1.2</c>.</summary>
|
||||
public string MajorMinor
|
||||
{
|
||||
get
|
||||
{
|
||||
var core = Version.Split('-', 2)[0];
|
||||
var parts = core.Split('.');
|
||||
return parts.Length >= 2 ? string.Create(CultureInfo.InvariantCulture, $"{parts[0]}.{parts[1]}") : core;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The full form, <c>version+revision</c> when the revision is known.</summary>
|
||||
public string Full => Revision.Length == 0 ? Version : $"{Version}+{Revision}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => Full;
|
||||
|
||||
/// <summary>
|
||||
/// Parses an informational version such as <c>1.2.3+abc1234</c>. A long revision (a full commit hash) is
|
||||
/// shortened to 7 characters.
|
||||
/// </summary>
|
||||
/// <param name="informationalVersion">The value of <see cref="AssemblyInformationalVersionAttribute"/>.</param>
|
||||
public static ProductVersion Parse(string? informationalVersion)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(informationalVersion))
|
||||
{
|
||||
return new ProductVersion("0.0.0-dev", string.Empty);
|
||||
}
|
||||
|
||||
var plus = informationalVersion.IndexOf('+', StringComparison.Ordinal);
|
||||
if (plus < 0)
|
||||
{
|
||||
return new ProductVersion(informationalVersion.Trim(), string.Empty);
|
||||
}
|
||||
|
||||
var version = informationalVersion[..plus].Trim();
|
||||
var revision = informationalVersion[(plus + 1)..].Trim();
|
||||
if (revision.Length > 7)
|
||||
{
|
||||
revision = revision[..7];
|
||||
}
|
||||
|
||||
return new ProductVersion(version, revision);
|
||||
}
|
||||
|
||||
/// <summary>Reads the version of the given assembly (by default the entry assembly).</summary>
|
||||
/// <param name="assembly">The assembly to read; <see langword="null"/> means the entry assembly.</param>
|
||||
public static ProductVersion FromAssembly(Assembly? assembly = null)
|
||||
{
|
||||
var source = assembly ?? Assembly.GetEntryAssembly() ?? typeof(ProductVersion).Assembly;
|
||||
return Parse(source.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Core</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Data.PostgreSql</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Data/Khaemhat.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Npgsql" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Data.Sqlite</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Data/Khaemhat.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Data</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Core/Khaemhat.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Fiscal.Abstractions</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Core/Khaemhat.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Fiscal.Italy</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Core/Khaemhat.Core.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Fiscal.Abstractions/Khaemhat.Fiscal.Abstractions.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Infrastructure/Khaemhat.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Infrastructure</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Core/Khaemhat.Core.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Data/Khaemhat.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#17243A" />
|
||||
<base href="/" />
|
||||
<link rel="icon" href="favicon.ico" sizes="any" />
|
||||
<link rel="icon" href="icon.svg" type="image/svg+xml" />
|
||||
<link rel="apple-touch-icon" href="icon-256.png" />
|
||||
<ResourcePreloader />
|
||||
<link rel="stylesheet" href="@Assets["app.css"]" />
|
||||
<link rel="stylesheet" href="@Assets["Khaemhat.Web.styles.css"]" />
|
||||
<ImportMap />
|
||||
<HeadOutlet @rendermode="InteractiveServer" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes @rendermode="InteractiveServer" />
|
||||
<ReconnectModal />
|
||||
<script src="@Assets["_framework/blazor.web.js"]"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
@Body
|
||||
|
||||
<div id="blazor-error-ui" data-nosnippet>
|
||||
Si è verificato un errore imprevisto.
|
||||
<a href="." class="reload">Ricarica</a>
|
||||
<span class="dismiss">×</span>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
#blazor-error-ui {
|
||||
color-scheme: light only;
|
||||
background: lightyellow;
|
||||
bottom: 0;
|
||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||
box-sizing: border-box;
|
||||
display: none;
|
||||
left: 0;
|
||||
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#blazor-error-ui .dismiss {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<script type="module" src="@Assets["Components/Layout/ReconnectModal.razor.js"]"></script>
|
||||
|
||||
<dialog id="components-reconnect-modal" data-nosnippet>
|
||||
<div class="components-reconnect-container">
|
||||
<div class="components-rejoining-animation" aria-hidden="true">
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<p class="components-reconnect-first-attempt-visible">
|
||||
Rejoining the server...
|
||||
</p>
|
||||
<p class="components-reconnect-repeated-attempt-visible">
|
||||
Rejoin failed... trying again in <span id="components-seconds-to-next-attempt"></span> seconds.
|
||||
</p>
|
||||
<p class="components-reconnect-failed-visible">
|
||||
Failed to rejoin.<br />Please retry or reload the page.
|
||||
</p>
|
||||
<button id="components-reconnect-button" class="components-reconnect-failed-visible">
|
||||
Retry
|
||||
</button>
|
||||
<p class="components-pause-visible">
|
||||
The session has been paused by the server.
|
||||
</p>
|
||||
<p class="components-resume-failed-visible">
|
||||
Failed to resume the session.<br />Please retry or reload the page.
|
||||
</p>
|
||||
<button id="components-resume-button" class="components-pause-visible components-resume-failed-visible">
|
||||
Resume
|
||||
</button>
|
||||
</div>
|
||||
</dialog>
|
||||
@@ -0,0 +1,157 @@
|
||||
.components-reconnect-first-attempt-visible,
|
||||
.components-reconnect-repeated-attempt-visible,
|
||||
.components-reconnect-failed-visible,
|
||||
.components-pause-visible,
|
||||
.components-resume-failed-visible,
|
||||
.components-rejoining-animation {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
|
||||
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
|
||||
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
|
||||
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
|
||||
#components-reconnect-modal.components-reconnect-retrying,
|
||||
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
|
||||
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
|
||||
#components-reconnect-modal.components-reconnect-failed,
|
||||
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
#components-reconnect-modal {
|
||||
background-color: white;
|
||||
width: 20rem;
|
||||
margin: 20vh auto;
|
||||
padding: 2rem;
|
||||
border: 0;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
|
||||
opacity: 0;
|
||||
transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
|
||||
animation: components-reconnect-modal-fadeOutOpacity 0.5s both;
|
||||
&[open]
|
||||
|
||||
{
|
||||
animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-modal-fadeInOpacity 0.5s ease-in-out 0.3s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#components-reconnect-modal::backdrop {
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
animation: components-reconnect-modal-fadeInOpacity 0.5s ease-in-out;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes components-reconnect-modal-slideUp {
|
||||
0% {
|
||||
transform: translateY(30px) scale(0.95);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes components-reconnect-modal-fadeInOpacity {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes components-reconnect-modal-fadeOutOpacity {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.components-reconnect-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#components-reconnect-modal p {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#components-reconnect-modal button {
|
||||
border: 0;
|
||||
background-color: #6b9ed2;
|
||||
color: white;
|
||||
padding: 4px 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#components-reconnect-modal button:hover {
|
||||
background-color: #3b6ea2;
|
||||
}
|
||||
|
||||
#components-reconnect-modal button:active {
|
||||
background-color: #6b9ed2;
|
||||
}
|
||||
|
||||
.components-rejoining-animation {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.components-rejoining-animation div {
|
||||
position: absolute;
|
||||
border: 3px solid #0087ff;
|
||||
opacity: 1;
|
||||
border-radius: 50%;
|
||||
animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
|
||||
}
|
||||
|
||||
.components-rejoining-animation div:nth-child(2) {
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
|
||||
@keyframes components-rejoining-animation {
|
||||
0% {
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
4.9% {
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
5% {
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Set up event handlers
|
||||
const reconnectModal = document.getElementById("components-reconnect-modal");
|
||||
reconnectModal.addEventListener("components-reconnect-state-changed", handleReconnectStateChanged);
|
||||
|
||||
const retryButton = document.getElementById("components-reconnect-button");
|
||||
retryButton.addEventListener("click", retry);
|
||||
|
||||
const resumeButton = document.getElementById("components-resume-button");
|
||||
resumeButton.addEventListener("click", resume);
|
||||
|
||||
function handleReconnectStateChanged(event) {
|
||||
if (event.detail.state === "show") {
|
||||
reconnectModal.showModal();
|
||||
} else if (event.detail.state === "hide") {
|
||||
reconnectModal.close();
|
||||
} else if (event.detail.state === "failed") {
|
||||
document.addEventListener("visibilitychange", retryWhenDocumentBecomesVisible);
|
||||
} else if (event.detail.state === "rejected") {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
async function retry() {
|
||||
document.removeEventListener("visibilitychange", retryWhenDocumentBecomesVisible);
|
||||
|
||||
try {
|
||||
// Reconnect will asynchronously return:
|
||||
// - true to mean success
|
||||
// - false to mean we reached the server, but it rejected the connection (e.g., unknown circuit ID)
|
||||
// - exception to mean we didn't reach the server (this can be sync or async)
|
||||
const successful = await Blazor.reconnect();
|
||||
if (!successful) {
|
||||
// We have been able to reach the server, but the circuit is no longer available.
|
||||
// We'll reload the page so the user can continue using the app as quickly as possible.
|
||||
const resumeSuccessful = await Blazor.resumeCircuit();
|
||||
if (!resumeSuccessful) {
|
||||
location.reload();
|
||||
} else {
|
||||
reconnectModal.close();
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// We got an exception, server is currently unavailable
|
||||
document.addEventListener("visibilitychange", retryWhenDocumentBecomesVisible);
|
||||
}
|
||||
}
|
||||
|
||||
async function resume() {
|
||||
try {
|
||||
const successful = await Blazor.resumeCircuit();
|
||||
if (!successful) {
|
||||
location.reload();
|
||||
}
|
||||
} catch {
|
||||
reconnectModal.classList.replace("components-reconnect-paused", "components-reconnect-resume-failed");
|
||||
}
|
||||
}
|
||||
|
||||
async function retryWhenDocumentBecomesVisible() {
|
||||
if (document.visibilityState === "visible") {
|
||||
await retry();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
@* The error code shown to people is the trace id, the same one written in the log (SPEC §9.5). *@
|
||||
<PageTitle>Khaemhat · errore</PageTitle>
|
||||
|
||||
<main class="kh-construction">
|
||||
<section class="hero">
|
||||
<h1>Si è verificato un errore</h1>
|
||||
<p class="lead">La richiesta non è stata completata. Se il problema si ripete, comunica all'amministratore il codice qui sotto.</p>
|
||||
@if (!string.IsNullOrEmpty(TraceId))
|
||||
{
|
||||
<p class="build">Codice errore: <code>@TraceId</code></p>
|
||||
}
|
||||
<ul class="links"><li><a href="/">Torna alla pagina iniziale</a></li></ul>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? TraceId { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialized() =>
|
||||
TraceId = Activity.Current?.TraceId.ToString() ?? HttpContext?.TraceIdentifier;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
@page "/"
|
||||
@using Khaemhat.Core.Common
|
||||
@inject ProductVersion Version
|
||||
|
||||
@* Placeholder until the shell of M3 (SPEC §20, M0): brand, icon and version, styled after the login hero (mockup 001).
|
||||
Texts move to the it-IT resources with the localization of M3. *@
|
||||
<PageTitle>Khaemhat · in costruzione</PageTitle>
|
||||
|
||||
<main class="kh-construction">
|
||||
<section class="hero">
|
||||
<img class="mark" src="icon.svg" alt="" width="96" height="96" />
|
||||
<h1>Khaemhat <span class="ver">v @Version.MajorMinor</span></h1>
|
||||
<p class="lead">Gestionale ERP + CRM per piccole e medie imprese italiane.</p>
|
||||
<p class="state">Installazione in costruzione: le funzioni arrivano milestone dopo milestone.</p>
|
||||
<ul class="links">
|
||||
<li><a href="https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/wiki/Roadmap">Roadmap</a></li>
|
||||
<li><a href="https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/wiki">Documentazione</a></li>
|
||||
</ul>
|
||||
<p class="build">Versione @Version.Full</p>
|
||||
</section>
|
||||
</main>
|
||||
@@ -0,0 +1,12 @@
|
||||
@page "/not-found"
|
||||
@layout MainLayout
|
||||
|
||||
<PageTitle>Khaemhat · pagina non trovata</PageTitle>
|
||||
|
||||
<main class="kh-construction">
|
||||
<section class="hero">
|
||||
<h1>Pagina non trovata</h1>
|
||||
<p class="lead">L'indirizzo richiesto non esiste.</p>
|
||||
<ul class="links"><li><a href="/">Torna alla pagina iniziale</a></li></ul>
|
||||
</section>
|
||||
</main>
|
||||
@@ -0,0 +1,6 @@
|
||||
<Router AppAssembly="typeof(Program).Assembly" NotFoundPage="typeof(Pages.NotFound)">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1" />
|
||||
</Found>
|
||||
</Router>
|
||||
@@ -0,0 +1,11 @@
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using Khaemhat.Web
|
||||
@using Khaemhat.Web.Components
|
||||
@using Khaemhat.Web.Components.Layout
|
||||
@@ -0,0 +1,43 @@
|
||||
using Khaemhat.Core.Common;
|
||||
|
||||
namespace Khaemhat.Web.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Health endpoints for Docker and reverse proxies (SPEC §16.1, ADR 0012):
|
||||
/// <c>/health/live</c> says the process answers (the image HEALTHCHECK), <c>/health/ready</c> says it can serve
|
||||
/// requests (from M1 it also checks the system database), <c>/health</c> summarises both with the version.
|
||||
/// They carry no personal or configuration data and need no authentication.
|
||||
/// </summary>
|
||||
public static class HealthEndpoints
|
||||
{
|
||||
/// <summary>Maps the three health endpoints.</summary>
|
||||
/// <param name="endpoints">The application's route builder.</param>
|
||||
public static IEndpointRouteBuilder MapHealthEndpoints(this IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(endpoints);
|
||||
|
||||
endpoints.MapGet("/health/live", () => Results.Text("live", "text/plain"))
|
||||
.ExcludeFromDescription();
|
||||
|
||||
endpoints.MapGet("/health/ready", () => Results.Text("ready", "text/plain"))
|
||||
.ExcludeFromDescription();
|
||||
|
||||
endpoints.MapGet("/health", (ProductVersion version) => Results.Json(new HealthReport(
|
||||
Status: "ok",
|
||||
Live: true,
|
||||
Ready: true,
|
||||
Version: version.Version,
|
||||
Revision: version.Revision)))
|
||||
.ExcludeFromDescription();
|
||||
|
||||
return endpoints;
|
||||
}
|
||||
|
||||
/// <summary>The body of <c>/health</c>.</summary>
|
||||
/// <param name="Status"><c>ok</c> when the instance is live and ready.</param>
|
||||
/// <param name="Live">Whether the process answers.</param>
|
||||
/// <param name="Ready">Whether the instance can serve requests.</param>
|
||||
/// <param name="Version">Product version (SemVer).</param>
|
||||
/// <param name="Revision">Source revision.</param>
|
||||
public sealed record HealthReport(string Status, bool Live, bool Ready, string Version, string Revision);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using Khaemhat.Core.Common;
|
||||
using Khaemhat.Web.Components;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
|
||||
namespace Khaemhat.Web.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Builds the Khaemhat web host: one process per instance (ADR 0001), Blazor Interactive Server (ADR 0003).
|
||||
/// Kept apart from <c>Program.cs</c> so tests can start the real host on a free port.
|
||||
/// </summary>
|
||||
public static class KhaemhatApp
|
||||
{
|
||||
/// <summary>Creates the configured application, ready to run.</summary>
|
||||
/// <param name="args">Command-line arguments (ASP.NET Core host conventions, e.g. <c>--urls</c>).</param>
|
||||
public static WebApplication Build(string[] args)
|
||||
{
|
||||
// ApplicationName pins the static web assets manifest to this assembly, also when tests host the app.
|
||||
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
|
||||
{
|
||||
Args = args,
|
||||
ApplicationName = typeof(KhaemhatApp).Assembly.GetName().Name,
|
||||
});
|
||||
|
||||
ApplyInstanceVariables(builder, args);
|
||||
|
||||
// One JSON line per event on stdout outside development (SPEC §9.5); the database sink arrives in M2.
|
||||
if (!builder.Environment.IsDevelopment())
|
||||
{
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddJsonConsole(o =>
|
||||
{
|
||||
o.IncludeScopes = true;
|
||||
o.UseUtcTimestamp = true;
|
||||
o.TimestampFormat = "yyyy-MM-ddTHH:mm:ss.fffZ";
|
||||
});
|
||||
}
|
||||
|
||||
// Until the database key store of M2 exists, keys live in memory: nothing is written outside the data
|
||||
// folder (SPEC §1.5). Antiforgery and circuit tokens therefore reset when the container restarts.
|
||||
builder.Services.AddDataProtection()
|
||||
.SetApplicationName("Khaemhat")
|
||||
.UseEphemeralDataProtectionProvider();
|
||||
|
||||
builder.Services.AddSingleton(ProductVersion.FromAssembly(typeof(KhaemhatApp).Assembly));
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// TLS ends at the reverse proxy in front of the container (docs/DEPLOY.md): no HTTPS redirection here.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||
}
|
||||
|
||||
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
|
||||
app.UseAntiforgery();
|
||||
|
||||
app.MapHealthEndpoints();
|
||||
app.MapStaticAssets();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
// The KHAEMHAT_* variables of SPEC §6 that the host itself needs. The full validation (KhaemhatOptions) is M1.
|
||||
private static void ApplyInstanceVariables(WebApplicationBuilder builder, string[] args)
|
||||
{
|
||||
// KHAEMHAT_URLS wins over ASPNETCORE_HTTP_PORTS of the image; an explicit --urls argument wins over both.
|
||||
var urls = builder.Configuration["KHAEMHAT_URLS"];
|
||||
if (!string.IsNullOrWhiteSpace(urls) && !args.Any(a => a.StartsWith("--urls", StringComparison.Ordinal)))
|
||||
{
|
||||
builder.WebHost.UseUrls(urls);
|
||||
}
|
||||
|
||||
var level = builder.Configuration["KHAEMHAT_LOG_LEVEL"];
|
||||
if (!string.IsNullOrWhiteSpace(level))
|
||||
{
|
||||
if (!Enum.TryParse<LogLevel>(level, ignoreCase: true, out var parsed) || !Enum.IsDefined(parsed))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"KHAEMHAT_LOG_LEVEL '{level}' is not valid: use Trace, Debug, Information, Warning, Error, Critical or None.");
|
||||
}
|
||||
|
||||
builder.Configuration["Logging:LogLevel:Default"] = parsed.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Web</RootNamespace>
|
||||
<BlazorDisableThrowNavigationException>true</BlazorDisableThrowNavigationException>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Web composes the application: it is the only project that references the concrete providers (SPEC §3). -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Khaemhat.Application/Khaemhat.Application.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Data.Sqlite/Khaemhat.Data.Sqlite.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Data.PostgreSql/Khaemhat.Data.PostgreSql.csproj" />
|
||||
<ProjectReference Include="../Khaemhat.Fiscal.Italy/Khaemhat.Fiscal.Italy.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="Khaemhat.Web.Tests" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
using Khaemhat.Web.Hosting;
|
||||
|
||||
await KhaemhatApp.Build(args).RunAsync().ConfigureAwait(false);
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5080",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/* Khaemhat: minimal styles of M0. The full token set (tokens.css from docs/mockups/mockup.css) arrives in M3. */
|
||||
:root {
|
||||
--kh-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
|
||||
--kh-brand: #C8962E;
|
||||
--kh-brand-deep: #8B6318;
|
||||
--kh-topbar: #17243A;
|
||||
--kh-bg: #F3F5F8;
|
||||
--kh-err: #C2453A;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; height: 100%; }
|
||||
body { font-family: var(--kh-font); font-size: 13px; background: var(--kh-bg); -webkit-font-smoothing: antialiased; }
|
||||
|
||||
.kh-construction { min-height: 100vh; display: grid; place-items: center; padding: 32px;
|
||||
background: radial-gradient(1200px 600px at 20% 10%, #243A5E 0%, #17243A 55%, #0F1826 100%); color: #E8EDF5; }
|
||||
.kh-construction .hero { max-width: 560px; text-align: center; }
|
||||
.kh-construction .mark { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
|
||||
.kh-construction h1 { font-size: 40px; letter-spacing: -.8px; margin: 26px 0 8px; font-weight: 650; }
|
||||
.kh-construction h1 .ver { font-size: 15px; font-weight: 600; color: var(--kh-brand); vertical-align: middle; margin-left: 6px; }
|
||||
.kh-construction .lead { font-size: 15px; color: #B8C5DA; line-height: 1.5; margin: 0; }
|
||||
.kh-construction .state { margin: 22px auto 0; padding: 12px 16px; border-radius: 10px; font-size: 13px; color: #D5DEEB;
|
||||
background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
|
||||
.kh-construction .links { list-style: none; padding: 0; margin: 22px 0 0; display: flex; gap: 18px; justify-content: center; }
|
||||
.kh-construction a { color: #F0C86A; text-decoration: none; font-weight: 600; }
|
||||
.kh-construction a:hover { text-decoration: underline; }
|
||||
.kh-construction .build { margin-top: 28px; font-size: 11.5px; color: #8391A3; font-variant-numeric: tabular-nums; }
|
||||
|
||||
#blazor-error-ui { background: #FADEDC; color: #1E2733; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
|
||||
display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
|
||||
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"><defs><linearGradient id="bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#243A5E"/><stop offset="1" stop-color="#0F1826"/></linearGradient><linearGradient id="gold" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#F0C86A"/><stop offset="1" stop-color="#C8962E"/></linearGradient></defs><rect width="512" height="512" rx="112" fill="url(#bg)"/><rect x="16" y="16" width="480" height="480" rx="100" fill="none" stroke="#FFFFFF" stroke-opacity=".07" stroke-width="2"/><g transform="translate(0 0) scale(1.0)"><rect x="76" y="76" width="150" height="150" rx="34" fill="url(#gold)"/><rect x="286" y="76" width="150" height="150" rx="34" fill="url(#gold)"/><rect x="76" y="286" width="150" height="150" rx="34" fill="url(#gold)"/><rect x="286" y="286" width="150" height="150" rx="34" fill="url(#gold)"/><path d="M110 104h36l20 20v68a6 6 0 0 1-6 6h-50a6 6 0 0 1-6-6V110a6 6 0 0 1 6-6z" fill="#17243A"/><path d="M146 104v20h20" fill="#2A4472"/><path d="M122 142h28" stroke="#E0B04A" stroke-width="6" stroke-linecap="round"/><path d="M122 158h34" stroke="#E0B04A" stroke-width="6" stroke-linecap="round"/><path d="M122 174h20" stroke="#E0B04A" stroke-width="6" stroke-linecap="round"/><text x="194" y="204" text-anchor="middle" font-family="Inter, Segoe UI, Arial, sans-serif" font-weight="800" font-size="46" fill="#17243A">€</text><path d="M361 107l44 22-44 22-44-22z" fill="#2A4472"/><path d="M317 129l44 22v52l-44-22z" fill="#17243A"/><path d="M405 129l-44 22v52l44-22z" fill="#1D3155"/><path d="M339 118l44 22" stroke="#E0B04A" stroke-width="5" stroke-linecap="round" opacity=".9"/><rect x="116" y="358" width="22" height="48" rx="5" fill="#17243A"/><rect x="148" y="330" width="22" height="76" rx="5" fill="#17243A"/><rect x="180" y="302" width="22" height="104" rx="5" fill="#17243A"/><path d="M120 340L152 326L184 308" fill="none" stroke="#E0B04A" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="184" cy="308" r="7" fill="#E0B04A"/><circle cx="378" cy="344" r="13" fill="#2A4472"/><path d="M354 398a24 22 0 0 1 48 0z" fill="#2A4472"/><circle cx="346" cy="340" r="19" fill="#17243A"/><path d="M310 406a36 30 0 0 1 72 0z" fill="#17243A"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
Reference in new issue
Block a user