M0 · Bootstrap: soluzione, immagine Docker, Gitea Actions #115
No files matched your search
@@ -0,0 +1,17 @@
|
||||
# Build context for docker/Dockerfile: sources and build files only.
|
||||
**/bin/
|
||||
**/obj/
|
||||
.git/
|
||||
.gitea/
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
.claude/
|
||||
.data/
|
||||
out/
|
||||
docs/
|
||||
deploy/
|
||||
*.md
|
||||
!README.md
|
||||
**/*.user
|
||||
**/.env
|
||||
@@ -0,0 +1,73 @@
|
||||
# Khaemhat code style (SPEC §1.11, §19). Build enforces analyzers and code style (EnforceCodeStyleInBuild).
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{csproj,props,targets,xml,json,yml,yaml,razor.css,css,js,html,svg}]
|
||||
indent_size = 2
|
||||
|
||||
[*.razor]
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.sh]
|
||||
end_of_line = lf
|
||||
|
||||
[*.cs]
|
||||
# Namespaces and usings
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
dotnet_sort_system_directives_first = true
|
||||
csharp_using_directive_placement = outside_namespace:warning
|
||||
|
||||
# var and expression style
|
||||
csharp_style_var_for_built_in_types = true:suggestion
|
||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_properties = true:suggestion
|
||||
csharp_prefer_braces = when_multiline:suggestion
|
||||
dotnet_style_qualification_for_field = false:warning
|
||||
dotnet_style_qualification_for_property = false:warning
|
||||
dotnet_style_qualification_for_method = false:warning
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
|
||||
dotnet_style_readonly_field = true:warning
|
||||
csharp_style_prefer_primary_constructors = true:suggestion
|
||||
|
||||
# Naming: private fields _camelCase, constants PascalCase
|
||||
dotnet_naming_rule.private_fields.symbols = private_fields
|
||||
dotnet_naming_rule.private_fields.style = underscore_camel
|
||||
dotnet_naming_rule.private_fields.severity = warning
|
||||
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
|
||||
dotnet_naming_style.underscore_camel.required_prefix = _
|
||||
dotnet_naming_style.underscore_camel.capitalization = camel_case
|
||||
dotnet_naming_rule.constants.symbols = constants
|
||||
dotnet_naming_rule.constants.style = pascal
|
||||
dotnet_naming_rule.constants.severity = warning
|
||||
dotnet_naming_symbols.constants.applicable_kinds = field
|
||||
dotnet_naming_symbols.constants.required_modifiers = const
|
||||
dotnet_naming_style.pascal.capitalization = pascal_case
|
||||
|
||||
# Analyzer adjustments (each with its reason)
|
||||
# CA1515 (make types internal): Khaemhat is an application, but its libraries are consumed across projects.
|
||||
dotnet_diagnostic.CA1515.severity = none
|
||||
# CA1848/CA1873 (LoggerMessage delegates): adopted where logging is hot (Infrastructure/Logging, M2), not everywhere.
|
||||
dotnet_diagnostic.CA1848.severity = suggestion
|
||||
dotnet_diagnostic.CA1873.severity = suggestion
|
||||
# CA2007 (ConfigureAwait): ASP.NET Core has no synchronization context.
|
||||
dotnet_diagnostic.CA2007.severity = none
|
||||
# IDE0005 (unnecessary using) needs GenerateDocumentationFile, which is on: keep it as an error-free warning.
|
||||
dotnet_diagnostic.IDE0005.severity = warning
|
||||
|
||||
[tests/**.cs]
|
||||
# CA1707 (underscores in names): test names read as Method_Condition_Result.
|
||||
dotnet_diagnostic.CA1707.severity = none
|
||||
# MSTEST0037 and friends stay at their defaults.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Parses each YAML file given on the command line and fails on the first syntax error (Gitea rejects a workflow that
|
||||
# does not parse, Docker Compose a compose file). Workflows must also declare "on" and "jobs".
|
||||
require "yaml"
|
||||
|
||||
failed = false
|
||||
ARGV.each do |path|
|
||||
begin
|
||||
document = YAML.safe_load(File.read(path), aliases: true)
|
||||
if path.include?(".gitea/workflows/")
|
||||
# YAML 1.1 reads the bare key "on" as true.
|
||||
missing = []
|
||||
missing << "on" unless document.key?("on") || document.key?(true)
|
||||
missing << "jobs" unless document.key?("jobs")
|
||||
raise "missing #{missing.join(', ')}" unless missing.empty?
|
||||
end
|
||||
puts "ok #{path}"
|
||||
rescue StandardError => e
|
||||
failed = true
|
||||
puts "ERROR #{path}: #{e.message}"
|
||||
end
|
||||
end
|
||||
exit(failed ? 1 : 0)
|
||||
@@ -0,0 +1,180 @@
|
||||
name: CI
|
||||
|
||||
# Gitea Actions (ADR 0009). The runner is act_runner in Docker mode on the server that also runs Gitea: one job at a
|
||||
# time, so the triggers are frugal. The .NET jobs use the SDK image and check out with git (the image has no Node.js
|
||||
# for JavaScript actions); nothing is cached or uploaded. Builds use BUILD_CPUS cores so the host keeps room for Gitea.
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
paths-ignore: ["docs/**", "*.md", "assets/**", "deploy/**"]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: "1"
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
|
||||
BUILD_CPUS: "4"
|
||||
KHAEMHAT_LICENSE_MODE: test
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test (SQLite)
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
timeout-minutes: 30
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git config --global --add safe.directory "$PWD"
|
||||
git init -q .
|
||||
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
||||
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
git log -1 --format='%h %s'
|
||||
|
||||
- name: Package allowlist
|
||||
run: bash scripts/check-packages.sh
|
||||
|
||||
- name: Build (warnings are errors)
|
||||
run: dotnet build Khaemhat.sln -c Release -warnaserror -m:"$BUILD_CPUS"
|
||||
|
||||
- name: Test
|
||||
run: dotnet test Khaemhat.sln -c Release --no-build
|
||||
|
||||
# PostgreSQL integration (SPEC §20): only on release tags and manual runs, against the two supported servers.
|
||||
postgres:
|
||||
name: PostgreSQL ${{ matrix.pg }} integration
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pg: ["16", "17"]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
timeout-minutes: 30
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:${{ matrix.pg }}
|
||||
env:
|
||||
POSTGRES_USER: khaemhat
|
||||
POSTGRES_PASSWORD: khaemhat-ci
|
||||
POSTGRES_DB: khaemhat_test
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
env:
|
||||
KHAEMHAT_TEST_PG: postgres://khaemhat:khaemhat-ci@postgres:5432/khaemhat_test
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git config --global --add safe.directory "$PWD"
|
||||
git init -q .
|
||||
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
||||
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
|
||||
- name: Test · Data (PostgreSQL)
|
||||
run: dotnet test tests/Khaemhat.Data.Tests -c Release -m:"$BUILD_CPUS"
|
||||
|
||||
# The image builds and answers /health/live (issue #2). The runner's own image has the docker CLI and talks to the
|
||||
# host's daemon; the job joins a network of its own to reach the container. Everything is labelled with the job
|
||||
# container's id: a cancelled job skips its clean-up, so the next one removes what a vanished job left on the host.
|
||||
# Release tags skip it: release.yml builds and tests the same image.
|
||||
docker:
|
||||
name: Docker image
|
||||
needs: build
|
||||
if: "!startsWith(github.ref, 'refs/tags/')"
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Remove what cancelled jobs left
|
||||
run: |
|
||||
echo "NAME=khaemhat-ci-$(hostname)" >> "$GITHUB_ENV"
|
||||
for c in $(docker ps -aq --filter label=khaemhat-ci.job); do
|
||||
job="$(docker inspect -f '{{index .Config.Labels "khaemhat-ci.job"}}' "$c")"
|
||||
docker inspect "$job" > /dev/null 2>&1 || docker rm -f -v "$c"
|
||||
done
|
||||
for n in $(docker network ls -q --filter label=khaemhat-ci.job); do
|
||||
job="$(docker network inspect -f '{{index .Labels "khaemhat-ci.job"}}' "$n")"
|
||||
docker inspect "$job" > /dev/null 2>&1 || docker network rm "$n"
|
||||
done
|
||||
for i in $(docker image ls -q --filter label=khaemhat-ci.job | sort -u); do
|
||||
job="$(docker image inspect -f '{{index .Config.Labels "khaemhat-ci.job"}}' "$i")"
|
||||
docker inspect "$job" > /dev/null 2>&1 || docker image rm -f "$i"
|
||||
done
|
||||
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git config --global --add safe.directory "$PWD"
|
||||
git init -q .
|
||||
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
||||
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build -f docker/Dockerfile --build-arg VERSION=0.0.0-ci --build-arg GIT_SHA="$(git rev-parse --short HEAD)" \
|
||||
--label khaemhat-ci.job="$(hostname)" -t "$NAME:image" .
|
||||
|
||||
- name: Smoke test (/health/live, non-root user, PUID/PGID)
|
||||
run: |
|
||||
docker network create --label khaemhat-ci.job="$(hostname)" "$NAME"
|
||||
docker network connect "$NAME" "$(hostname)"
|
||||
docker run -d --name "$NAME-app" --network "$NAME" --label khaemhat-ci.job="$(hostname)" \
|
||||
-e KHAEMHAT_SYSTEM_DB=sqlite:///data/system.db -e KHAEMHAT_LICENSE_MODE=test -e PUID=99 -e PGID=100 "$NAME:image"
|
||||
for i in $(seq 1 30); do
|
||||
if curl -fsS --max-time 5 "http://$NAME-app:8080/health/live"; then echo; break; fi
|
||||
sleep 2
|
||||
done
|
||||
curl -fsS --max-time 5 "http://$NAME-app:8080/health"
|
||||
echo
|
||||
curl -fsS --max-time 5 "http://$NAME-app:8080/" | grep -q "in costruzione"
|
||||
test "$(docker exec "$NAME-app" sh -c 'stat -c %u:%g /proc/1')" = "99:100"
|
||||
test "$(docker exec "$NAME-app" stat -c %u:%g /data)" = "99:100"
|
||||
docker exec "$NAME-app" pg_dump --version
|
||||
|
||||
- name: Container logs and clean-up
|
||||
if: always()
|
||||
run: |
|
||||
docker logs "$NAME-app" || true
|
||||
docker rm -f -v "$NAME-app" || true
|
||||
docker network disconnect "$NAME" "$(hostname)" || true
|
||||
docker network rm "$NAME" || true
|
||||
docker image rm "$NAME:image" || true
|
||||
|
||||
# Gitea fails a workflow that does not parse. The Ruby image has no git: the sources come as an archive.
|
||||
yaml:
|
||||
name: YAML check
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ruby:3.3-alpine
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Workflows and compose files
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
wget -q --header "Authorization: token $TOKEN" -O /tmp/sources.tar.gz \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${{ github.sha }}.tar.gz"
|
||||
mkdir -p /tmp/sources && tar -xzf /tmp/sources.tar.gz -C /tmp/sources
|
||||
cd /tmp/sources/*/
|
||||
ruby .gitea/scripts/check-yaml.rb .gitea/workflows/*.yml deploy/*.yml
|
||||
@@ -0,0 +1,184 @@
|
||||
name: Release
|
||||
|
||||
# A tag vX.Y.Z[-pre] publishes the image gitea.encke-hake.ts.net/balbosoft/khaemhat:X.Y.Z (ADR 0009, 0010, 0015) and a
|
||||
# Gitea release whose notes are the CHANGELOG.md section of that version (no binaries). When the version is already
|
||||
# in the registry (published by scripts/publish-image.sh) the build is skipped and only the release is created.
|
||||
# The runner's own image has the docker CLI and builds with the host's daemon.
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag esistente da (ri)pubblicare, es. v0.0.1"
|
||||
required: true
|
||||
arm64:
|
||||
description: "Anche linux/arm64 (richiede QEMU e buildx sull'host)"
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
env:
|
||||
TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
||||
# Where people and programs reach Gitea (the runner itself uses github.server_url). Variable PUBLIC_URL overrides it.
|
||||
PUBLIC_URL: ${{ vars.PUBLIC_URL || 'https://gitea.encke-hake.ts.net' }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Image and release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Remove what cancelled jobs left
|
||||
run: |
|
||||
echo "NAME=khaemhat-rel-$(hostname)" >> "$GITHUB_ENV"
|
||||
for c in $(docker ps -aq --filter label=khaemhat-ci.job); do
|
||||
job="$(docker inspect -f '{{index .Config.Labels "khaemhat-ci.job"}}' "$c")"
|
||||
docker inspect "$job" > /dev/null 2>&1 || docker rm -f -v "$c"
|
||||
done
|
||||
for n in $(docker network ls -q --filter label=khaemhat-ci.job); do
|
||||
job="$(docker network inspect -f '{{index .Labels "khaemhat-ci.job"}}' "$n")"
|
||||
docker inspect "$job" > /dev/null 2>&1 || docker network rm "$n"
|
||||
done
|
||||
|
||||
- name: Version
|
||||
run: |
|
||||
case "$TAG" in
|
||||
v[0-9]*.[0-9]*.[0-9]*) ;;
|
||||
*) echo "::error title=Tag::$TAG is not vX.Y.Z[-pre]"; exit 1 ;;
|
||||
esac
|
||||
version="${TAG#v}"
|
||||
prerelease=false
|
||||
case "$version" in *-*) prerelease=true ;; esac
|
||||
major_minor="${version%%-*}"
|
||||
major_minor="${major_minor%.*}"
|
||||
owner="$(printf '%s' "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
|
||||
registry="${{ vars.REGISTRY }}"
|
||||
registry="${registry:-$(printf '%s' "$PUBLIC_URL" | sed -E 's#^[a-z]+://##; s#/.*$##')}"
|
||||
{
|
||||
echo "VERSION=$version"
|
||||
echo "PRERELEASE=$prerelease"
|
||||
echo "MAJOR_MINOR=$major_minor"
|
||||
echo "REGISTRY_HOST=$registry"
|
||||
echo "IMAGE=$registry/$owner/khaemhat"
|
||||
} >> "$GITHUB_ENV"
|
||||
echo "Tag $TAG -> image $registry/$owner/khaemhat:$version (prerelease: $prerelease)"
|
||||
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git config --global --add safe.directory "$PWD"
|
||||
git init -q .
|
||||
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
||||
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "refs/tags/$TAG:refs/tags/$TAG"
|
||||
git checkout -q "refs/tags/$TAG"
|
||||
echo "GIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Sign in to the registry
|
||||
env:
|
||||
USER: ${{ vars.REGISTRY_USER || github.actor }}
|
||||
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$TOKEN" ] || ! printf '%s' "$TOKEN" | docker login "$REGISTRY_HOST" -u "$USER" --password-stdin; then
|
||||
echo "::error title=Registry::Sign-in to $REGISTRY_HOST refused. The organisation secret REGISTRY_TOKEN must be an access token with package read and write."
|
||||
exit 1
|
||||
fi
|
||||
status="$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $TOKEN" \
|
||||
"${{ github.server_url }}/api/v1/packages/${{ github.repository_owner }}/container/khaemhat/$VERSION")"
|
||||
if [ "$status" = "200" ]; then
|
||||
echo "Version $VERSION is already in the registry: build and push skipped (ADR 0015)."
|
||||
echo "PUBLISHED=true" >> "$GITHUB_ENV"
|
||||
else
|
||||
echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
- name: Build image
|
||||
if: env.PUBLISHED != 'true'
|
||||
run: |
|
||||
icon="$PUBLIC_URL/${{ github.repository }}/raw/branch/main/assets/icon-256.png"
|
||||
if [ -f "assets/icon-v$MAJOR_MINOR-256.png" ]; then
|
||||
icon="$PUBLIC_URL/${{ github.repository }}/raw/branch/main/assets/icon-v$MAJOR_MINOR-256.png"
|
||||
fi
|
||||
echo "ICON_URL=$icon" >> "$GITHUB_ENV"
|
||||
docker build -f docker/Dockerfile \
|
||||
--build-arg VERSION="$VERSION" \
|
||||
--build-arg GIT_SHA="$GIT_SHA" \
|
||||
--build-arg CREATED="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
--build-arg SOURCE_URL="$PUBLIC_URL/${{ github.repository }}" \
|
||||
--build-arg ICON_URL="$icon" \
|
||||
--label khaemhat-ci.job="$(hostname)" \
|
||||
-t "$IMAGE:$VERSION" .
|
||||
|
||||
- name: Smoke test (/health/live)
|
||||
if: env.PUBLISHED != 'true'
|
||||
run: |
|
||||
docker network create --label khaemhat-ci.job="$(hostname)" "$NAME"
|
||||
docker network connect "$NAME" "$(hostname)"
|
||||
docker run -d --name "$NAME-app" --network "$NAME" --label khaemhat-ci.job="$(hostname)" \
|
||||
-e KHAEMHAT_SYSTEM_DB=sqlite:///data/system.db -e KHAEMHAT_LICENSE_MODE=test "$IMAGE:$VERSION"
|
||||
for i in $(seq 1 30); do
|
||||
if curl -fsS --max-time 5 "http://$NAME-app:8080/health/live"; then echo; break; fi
|
||||
sleep 2
|
||||
done
|
||||
report="$(curl -fsS --max-time 5 "http://$NAME-app:8080/health")"
|
||||
echo "$report"
|
||||
echo "$report" | grep -q "\"version\":\"$VERSION\""
|
||||
|
||||
- name: Push
|
||||
if: env.PUBLISHED != 'true'
|
||||
run: |
|
||||
docker push "$IMAGE:$VERSION"
|
||||
if [ "$PRERELEASE" != "true" ]; then
|
||||
docker tag "$IMAGE:$VERSION" "$IMAGE:latest"
|
||||
docker push "$IMAGE:latest"
|
||||
fi
|
||||
echo "Image: $IMAGE:$VERSION$([ "$PRERELEASE" != "true" ] && echo " and :latest")"
|
||||
|
||||
- name: Multi-architecture push (arm64)
|
||||
if: env.PUBLISHED != 'true' && github.event.inputs.arm64 == 'true'
|
||||
run: |
|
||||
docker buildx build --platform linux/amd64,linux/arm64 -f docker/Dockerfile \
|
||||
--build-arg VERSION="$VERSION" --build-arg GIT_SHA="$GIT_SHA" \
|
||||
--build-arg SOURCE_URL="$PUBLIC_URL/${{ github.repository }}" --build-arg ICON_URL="$ICON_URL" \
|
||||
-t "$IMAGE:$VERSION" --push .
|
||||
|
||||
# Notes: the "## [X.Y.Z]" section of CHANGELOG.md. The release is created or, when it exists, left as it is.
|
||||
- name: Gitea release
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||
if curl -fs -o /dev/null -H "Authorization: token $TOKEN" "$api/releases/tags/$TAG"; then
|
||||
echo "Release $TAG already exists."
|
||||
exit 0
|
||||
fi
|
||||
awk -v v="$VERSION" '
|
||||
index($0, "## [" v "]") == 1 { on = 1; next }
|
||||
on && /^## \[/ { exit }
|
||||
on { print }
|
||||
' CHANGELOG.md > "$RUNNER_TEMP/notes.md"
|
||||
if [ ! -s "$RUNNER_TEMP/notes.md" ]; then
|
||||
echo "::warning title=Changelog::No section [$VERSION] in CHANGELOG.md"
|
||||
echo "Vedi CHANGELOG.md." > "$RUNNER_TEMP/notes.md"
|
||||
fi
|
||||
printf '\nImmagine: `%s:%s`\n' "$IMAGE" "$VERSION" >> "$RUNNER_TEMP/notes.md"
|
||||
body="$(awk 'BEGIN { ORS = "\\n" } { gsub(/\r/, ""); gsub(/\\/, "\\\\"); gsub(/"/, "\\\""); gsub(/\t/, "\\t"); print }' "$RUNNER_TEMP/notes.md")"
|
||||
printf '{"tag_name":"%s","name":"Khaemhat %s","body":"%s","draft":false,"prerelease":%s}' \
|
||||
"$TAG" "$VERSION" "$body" "$PRERELEASE" > "$RUNNER_TEMP/release.json"
|
||||
curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
--data-binary "@$RUNNER_TEMP/release.json" "$api/releases" > /dev/null
|
||||
echo "Release $TAG created."
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: |
|
||||
docker logs "$NAME-app" 2> /dev/null || true
|
||||
docker rm -f -v "$NAME-app" 2> /dev/null || true
|
||||
docker network disconnect "$NAME" "$(hostname)" 2> /dev/null || true
|
||||
docker network rm "$NAME" 2> /dev/null || true
|
||||
docker image rm "$IMAGE:$VERSION" "$IMAGE:latest" 2> /dev/null || true
|
||||
docker logout "$REGISTRY_HOST" || true
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Wiki
|
||||
|
||||
# docs/wiki/ is the source of the Gitea wiki (ADR 0009): every push to main that touches it publishes it with
|
||||
# scripts/publish-wiki.sh, which makes Khaemhat.wiki.git an exact copy. The secret WIKI_TOKEN (an access token with
|
||||
# repository write) overrides the workflow's own token if that one cannot push to the wiki.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths: ["docs/wiki/**"]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: wiki
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish the wiki
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git config --global --add safe.directory "$PWD"
|
||||
git init -q .
|
||||
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
||||
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
|
||||
- name: Publish docs/wiki
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.WIKI_TOKEN || github.token }}
|
||||
WIKI_REMOTE: ${{ github.server_url }}/${{ github.repository }}.wiki.git
|
||||
GIT_AUTHOR_NAME: Khaemhat CI
|
||||
GIT_AUTHOR_EMAIL: ci@khaemhat.invalid
|
||||
run: bash scripts/publish-wiki.sh
|
||||
+10
@@ -414,3 +414,13 @@ FodyWeavers.xsd
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
|
||||
# Khaemhat
|
||||
# Real deploy settings and secrets never go to the repository (deploy/.env.example is the template).
|
||||
.env
|
||||
deploy/.env
|
||||
# Local development data (scripts/run-dev.sh) and test output.
|
||||
.data/
|
||||
out/
|
||||
# License signing keys (tools/Khaemhat.LicenseTool): the private key never enters the repository (ADR 0008).
|
||||
*.khkey
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-dotnettools.csdevkit",
|
||||
"ms-dotnettools.csharp",
|
||||
"editorconfig.editorconfig",
|
||||
"ms-azuretools.vscode-docker"
|
||||
]
|
||||
}
|
||||
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
{
|
||||
// Debug di Khaemhat da Visual Studio Code (estensione C# / C# Dev Kit, vedi extensions.json).
|
||||
// Le variabili sono quelle di scripts/run-dev.sh: SQLite in .data/dev, licenze di test, solo per sviluppo.
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Khaemhat (web, SQLite)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/Khaemhat.Web/bin/Debug/net10.0/Khaemhat.Web.dll",
|
||||
"args": ["--urls", "http://localhost:5080"],
|
||||
"cwd": "${workspaceFolder}/src/Khaemhat.Web",
|
||||
"stopAtEntry": false,
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "Now listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"KHAEMHAT_DATA_DIR": "${workspaceFolder}/.data/dev",
|
||||
"KHAEMHAT_SYSTEM_DB": "sqlite:///${workspaceFolder}/.data/dev/system.db",
|
||||
"KHAEMHAT_SECRET_KEY": "a2hhZW1oYXQtZGV2ZWxvcG1lbnQtb25seS1ub3QtYS1zZWNyZXQ=",
|
||||
"KHAEMHAT_SUPERUSER": "root",
|
||||
"KHAEMHAT_SUPERUSER_PASSWORD": "Khaemhat-dev-1",
|
||||
"KHAEMHAT_COMPANY_CODE": "DEMO",
|
||||
"KHAEMHAT_COMPANY_NAME": "Khaemhat Demo S.r.l.",
|
||||
"KHAEMHAT_LICENSE_MODE": "test",
|
||||
"KHAEMHAT_SEED_DEMO": "true",
|
||||
"KHAEMHAT_LOG_LEVEL": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Khaemhat (web, PostgreSQL)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/Khaemhat.Web/bin/Debug/net10.0/Khaemhat.Web.dll",
|
||||
"args": ["--urls", "http://localhost:5080"],
|
||||
"cwd": "${workspaceFolder}/src/Khaemhat.Web",
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "Now listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
// Server locale, ad esempio: docker run -d --name khaemhat-pg -p 5432:5432 -e POSTGRES_USER=khaemhat
|
||||
// -e POSTGRES_PASSWORD=khaemhat-dev -e POSTGRES_DB=khaemhat_system postgres:17
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"KHAEMHAT_DATA_DIR": "${workspaceFolder}/.data/dev-pg",
|
||||
"KHAEMHAT_SYSTEM_DB": "postgres://khaemhat:khaemhat-dev@localhost:5432/khaemhat_system",
|
||||
"KHAEMHAT_DB_SERVER": "postgres://khaemhat:khaemhat-dev@localhost:5432/",
|
||||
"KHAEMHAT_SECRET_KEY": "a2hhZW1oYXQtZGV2ZWxvcG1lbnQtb25seS1ub3QtYS1zZWNyZXQ=",
|
||||
"KHAEMHAT_SUPERUSER": "root",
|
||||
"KHAEMHAT_SUPERUSER_PASSWORD": "Khaemhat-dev-1",
|
||||
"KHAEMHAT_COMPANY_CODE": "DEMO",
|
||||
"KHAEMHAT_COMPANY_NAME": "Khaemhat Demo S.r.l.",
|
||||
"KHAEMHAT_LICENSE_MODE": "test",
|
||||
"KHAEMHAT_SEED_DEMO": "true",
|
||||
"KHAEMHAT_LOG_LEVEL": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Collega a un processo",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
{
|
||||
// Attività di Visual Studio Code: Terminale > Esegui attività. "build" è quella usata dal debug (launch.json).
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"type": "process",
|
||||
"command": "dotnet",
|
||||
"args": ["build", "${workspaceFolder}/Khaemhat.sln", "-c", "Debug", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary"],
|
||||
"group": { "kind": "build", "isDefault": true },
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "test",
|
||||
"type": "process",
|
||||
"command": "dotnet",
|
||||
"args": ["test", "${workspaceFolder}/Khaemhat.sln", "-c", "Debug", "/property:GenerateFullPaths=true"],
|
||||
"options": { "env": { "KHAEMHAT_LICENSE_MODE": "test" } },
|
||||
"group": { "kind": "test", "isDefault": true },
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch (web)",
|
||||
"type": "process",
|
||||
"command": "dotnet",
|
||||
"args": ["watch", "run", "--project", "${workspaceFolder}/src/Khaemhat.Web", "--", "--urls", "http://localhost:5080"],
|
||||
"options": {
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"KHAEMHAT_DATA_DIR": "${workspaceFolder}/.data/dev",
|
||||
"KHAEMHAT_SYSTEM_DB": "sqlite:///${workspaceFolder}/.data/dev/system.db",
|
||||
"KHAEMHAT_LICENSE_MODE": "test"
|
||||
}
|
||||
},
|
||||
"isBackground": true,
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "check-packages",
|
||||
"type": "shell",
|
||||
"command": "bash scripts/check-packages.sh",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "docker build",
|
||||
"type": "shell",
|
||||
"command": "docker build -f docker/Dockerfile -t khaemhat:dev .",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,6 +7,36 @@ un'immagine `gitea.encke-hake.ts.net/balbosoft/khaemhat:X.Y.Z`.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.0.1] - 2026-11-11
|
||||
|
||||
Prima versione: M0 — Bootstrap. Nessuna funzione gestionale ancora; c'è lo scheletro su cui costruirle.
|
||||
|
||||
### Added
|
||||
- Soluzione `Khaemhat.sln` con i progetti di SPEC §3 e i relativi progetti di test (MSTest); regole di build comuni,
|
||||
warning come errori, analyzer, `.editorconfig`, Central Package Management con l'allowlist dei pacchetti.
|
||||
- Test architetturali: riferimenti fra progetti ammessi da SPEC §3 e pacchetti ammessi da SPEC §1.2;
|
||||
`scripts/check-packages.sh` fa lo stesso controllo prima di ogni build.
|
||||
- Pagina "in costruzione" in italiano con marca, icone e versione; pagine di errore e 404.
|
||||
- Endpoint di salute `/health/live`, `/health/ready` e `/health` con stato e versione (ADR 0012).
|
||||
- Variabili `KHAEMHAT_URLS` e `KHAEMHAT_LOG_LEVEL`; log JSON su stdout fuori dallo sviluppo.
|
||||
- Immagine Docker `gitea.encke-hake.ts.net/balbosoft/khaemhat`: multi-stage, utente non root con `PUID`/`PGID`
|
||||
(ADR 0013), `pg_dump` 17, `HEALTHCHECK`, etichette OCI e Unraid, `restore-system.sh` incluso (ADR 0017).
|
||||
- `deploy/docker-compose.yml` (PostgreSQL 17, Redis facoltativo) e `deploy/docker-compose.sqlite.yml` (demo);
|
||||
versione dell'immagine scelta con `KHAEMHAT_VERSION`.
|
||||
- Gitea Actions: `ci.yml` (build, test, immagine con smoke test, PostgreSQL 16/17 sui tag, controllo YAML),
|
||||
`release.yml` (immagine e release dal tag, ADR 0015), `wiki.yml` (pubblicazione della wiki).
|
||||
- Script `build.sh`, `test.sh`, `run-dev.sh`, `publish-image.sh`, `publish-wiki.sh` e stub delle milestone successive.
|
||||
- Configurazioni di Visual Studio Code per debug, attività ed estensioni consigliate (`.vscode/`).
|
||||
- ADR 0012-0017 sui punti aperti di M0 (salute, utente, varianti `_FILE`, tag e pubblicazione, icona versionata,
|
||||
script di ripristino).
|
||||
|
||||
### Changed
|
||||
- I file di `deploy/` puntano alla versione `0.0.1` e all'icona non versionata fino alla 1.0 (ADR 0016).
|
||||
|
||||
## Preparazione - 2026-11-10
|
||||
|
||||
Documentazione e pianificazione, nessun codice e nessun tag.
|
||||
|
||||
### Added
|
||||
- Specifica di progetto in `docs/SPEC.md` ed emendamenti in `CLAUDE.md` (Gitea al posto di GitHub, solo Docker).
|
||||
- ADR 0001-0011 sulle decisioni di base.
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<Project>
|
||||
<!-- Shared build rules for every project (SPEC §1.1, §1.11, §2 Versioning; ADR 0001). -->
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<LangVersion>14</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AnalysisLevel>latest</AnalysisLevel>
|
||||
<AnalysisMode>Recommended</AnalysisMode>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<Deterministic>true</Deterministic>
|
||||
<InvariantGlobalization>false</InvariantGlobalization>
|
||||
<SatelliteResourceLanguages>it;en</SatelliteResourceLanguages>
|
||||
<NeutralLanguage>it-IT</NeutralLanguage>
|
||||
|
||||
<Company>BalboSoft</Company>
|
||||
<Product>Khaemhat</Product>
|
||||
<Copyright>BalboSoft</Copyright>
|
||||
<RepositoryUrl>https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat</RepositoryUrl>
|
||||
|
||||
<!--
|
||||
Version: SemVer from the git tag (vX.Y.Z). Release builds pass it explicitly
|
||||
(/p:Version=X.Y.Z /p:SourceRevisionId=<sha>, see docker/Dockerfile and scripts/build.sh);
|
||||
a plain local build asks git through the KhaemhatGitVersion target below.
|
||||
-->
|
||||
<Version Condition="'$(Version)' == ''">0.0.0-dev</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>true</IncludeSourceRevisionInInformationalVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<!-- Test methods are public by MSTest convention; XML docs are not required on them (the file stays on for IDE0005). -->
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<Project>
|
||||
<!--
|
||||
Local builds without an explicit version read it from git: the nearest tag vX.Y.Z (as X.Y.Z) and the short
|
||||
commit. Release builds pass /p:Version, and the Docker build context has no .git, so they skip this target.
|
||||
-->
|
||||
<Target Name="KhaemhatGitVersion" BeforeTargets="GetAssemblyVersion;GenerateAssemblyInfo"
|
||||
Condition="'$(Version)' == '0.0.0-dev' And Exists('$(MSBuildThisFileDirectory).git')">
|
||||
<Exec Command="git describe --tags --match v[0-9]* --abbrev=0" ConsoleToMSBuild="true" IgnoreExitCode="true"
|
||||
StandardOutputImportance="low" StandardErrorImportance="low" WorkingDirectory="$(MSBuildThisFileDirectory)">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="_KhGitTag" />
|
||||
<Output TaskParameter="ExitCode" PropertyName="_KhGitTagExit" />
|
||||
</Exec>
|
||||
<Exec Command="git rev-parse --short HEAD" ConsoleToMSBuild="true" IgnoreExitCode="true"
|
||||
StandardOutputImportance="low" StandardErrorImportance="low" WorkingDirectory="$(MSBuildThisFileDirectory)">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="_KhGitSha" />
|
||||
</Exec>
|
||||
<PropertyGroup>
|
||||
<Version Condition="'$(_KhGitTagExit)' == '0' And '$(_KhGitTag)' != ''">$(_KhGitTag.TrimStart('v'))-dev</Version>
|
||||
<SourceRevisionId Condition="'$(SourceRevisionId)' == ''">$(_KhGitSha)</SourceRevisionId>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project>
|
||||
<!--
|
||||
Central Package Management: the ONLY packages Khaemhat may use (SPEC §1.2, ADR 0002).
|
||||
Anything else is written in the repository. scripts/check-packages.sh and the architecture tests
|
||||
fail the build if a PackageReference outside this list appears, or a test package lands outside tests/.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Database providers (runtime)">
|
||||
<PackageVersion Include="Npgsql" Version="10.0.3" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.15" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Tests only (never in the image)">
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.11.1" />
|
||||
<PackageVersion Include="MSTest" Version="4.5.2" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Application", "src\Khaemhat.Application\Khaemhat.Application.csproj", "{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Core", "src\Khaemhat.Core\Khaemhat.Core.csproj", "{B212CA0C-F7FF-4223-8FC5-961116D937B8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Data", "src\Khaemhat.Data\Khaemhat.Data.csproj", "{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Infrastructure", "src\Khaemhat.Infrastructure\Khaemhat.Infrastructure.csproj", "{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Fiscal.Abstractions", "src\Khaemhat.Fiscal.Abstractions\Khaemhat.Fiscal.Abstractions.csproj", "{F0A94F81-8CAB-4803-A209-C7E350160726}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Data.PostgreSql", "src\Khaemhat.Data.PostgreSql\Khaemhat.Data.PostgreSql.csproj", "{37AAC975-29AB-4649-A961-4115005042F1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Data.Sqlite", "src\Khaemhat.Data.Sqlite\Khaemhat.Data.Sqlite.csproj", "{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Fiscal.Italy", "src\Khaemhat.Fiscal.Italy\Khaemhat.Fiscal.Italy.csproj", "{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Web", "src\Khaemhat.Web\Khaemhat.Web.csproj", "{64DD5604-A3E4-45C0-9588-A1E38363C0C9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Application.Tests", "tests\Khaemhat.Application.Tests\Khaemhat.Application.Tests.csproj", "{8BE00CC7-FE33-412E-8CE5-86425869D301}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Core.Tests", "tests\Khaemhat.Core.Tests\Khaemhat.Core.Tests.csproj", "{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Data.Tests", "tests\Khaemhat.Data.Tests\Khaemhat.Data.Tests.csproj", "{AD3903F9-037E-48AE-B555-84345C4895E0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Fiscal.Italy.Tests", "tests\Khaemhat.Fiscal.Italy.Tests\Khaemhat.Fiscal.Italy.Tests.csproj", "{ECD0F91C-C8D7-4686-9609-56F2A93F4113}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Infrastructure.Tests", "tests\Khaemhat.Infrastructure.Tests\Khaemhat.Infrastructure.Tests.csproj", "{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.Web.Tests", "tests\Khaemhat.Web.Tests\Khaemhat.Web.Tests.csproj", "{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{07C2787E-EAC7-C090-1BA3-A61EC2A24D84}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Khaemhat.LicenseTool", "tools\Khaemhat.LicenseTool\Khaemhat.LicenseTool.csproj", "{4317FFD0-9473-43FD-8543-F80EF9BA812A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Release|x64.Build.0 = Release|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726}.Release|x86.Build.0 = Release|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{37AAC975-29AB-4649-A961-4115005042F1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Release|x64.Build.0 = Release|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302}.Release|x86.Build.0 = Release|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Release|x64.Build.0 = Release|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113}.Release|x86.Build.0 = Release|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Release|x64.Build.0 = Release|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6A70BA3E-47A7-40EC-AF2A-FB6FA9BFD6C5} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{B212CA0C-F7FF-4223-8FC5-961116D937B8} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{6A4CD6EB-E529-4A76-B028-CFF8F5D59E2F} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{4E7F3565-DD8A-4B25-BB27-7090F1144F4C} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{F0A94F81-8CAB-4803-A209-C7E350160726} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{37AAC975-29AB-4649-A961-4115005042F1} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{EF1EDA79-1E49-41CB-AF44-1C1ACC94611F} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{0CAFB3CA-3C92-4816-A63A-4670D7AD2302} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{64DD5604-A3E4-45C0-9588-A1E38363C0C9} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{8BE00CC7-FE33-412E-8CE5-86425869D301} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
{F6C68A01-8C27-47D5-8C45-E2D00D9BC32D} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
{AD3903F9-037E-48AE-B555-84345C4895E0} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
{ECD0F91C-C8D7-4686-9609-56F2A93F4113} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
{C5C8124F-3B12-43A9-BD0F-5AA5F7261699} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
{FDCAC352-BB40-4B5E-948A-2CDAA48B9E6A} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
{4317FFD0-9473-43FD-8543-F80EF9BA812A} = {07C2787E-EAC7-C090-1BA3-A61EC2A24D84}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -8,7 +8,8 @@
|
||||
Blazor Server, PostgreSQL (o SQLite per demo e test) e **nessuna libreria esterna**. Si installa **solo con Docker**:
|
||||
l'unico artefatto distribuito è l'immagine nel registro pacchetti di Gitea.
|
||||
|
||||
> **Stato:** progettazione completata, sviluppo non ancora avviato. Vedi [`docs/STATUS.md`](docs/STATUS.md) e la
|
||||
> **Stato:** sviluppo avviato. M0 (struttura, immagine Docker, CI) consegna la versione 0.0.1 con una pagina
|
||||
> "in costruzione"; le funzioni arrivano milestone dopo milestone. Vedi [`docs/STATUS.md`](docs/STATUS.md) e la
|
||||
> [Roadmap](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/wiki/Roadmap).
|
||||
|
||||
Il nome viene da Khaemhat (Mahu), scriba reale e sovrintendente al doppio granaio dell'Alto e del Basso Egitto sotto
|
||||
@@ -25,18 +26,34 @@ Amenhotep III: un contabile e un magazziniere dell'antichità. Vedi
|
||||
- Più aziende sulla stessa istanza (un database di sistema + un database per azienda), moduli attivabili con
|
||||
licenza, temi chiaro/scuro, dashboard a widget.
|
||||
|
||||
## Installazione (dalla prima versione rilasciata)
|
||||
## Installazione
|
||||
|
||||
```bash
|
||||
docker pull gitea.encke-hake.ts.net/balbosoft/khaemhat:<versione>
|
||||
```
|
||||
|
||||
- Qualunque host Docker: [`deploy/docker-compose.yml`](deploy/docker-compose.yml) (con PostgreSQL) e
|
||||
[`deploy/.env.example`](deploy/.env.example); per una prova veloce
|
||||
[`deploy/docker-compose.sqlite.yml`](deploy/docker-compose.sqlite.yml).
|
||||
- Unraid: template [`deploy/unraid/khaemhat.xml`](deploy/unraid/khaemhat.xml) o
|
||||
[`deploy/docker-compose.unraid.yml`](deploy/docker-compose.unraid.yml) con [`deploy/.env.example`](deploy/.env.example).
|
||||
- Guide: [Installazione Unraid](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/wiki/Installazione-Unraid) ·
|
||||
[Installazione Docker](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/wiki/Installazione-Docker) ·
|
||||
[Primi passi](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/wiki/Primi-passi).
|
||||
|
||||
## Sviluppo
|
||||
|
||||
Serve l'SDK .NET 10 (`global.json`); Docker solo per costruire e provare l'immagine.
|
||||
|
||||
```bash
|
||||
scripts/build.sh # allowlist dei pacchetti + build con warning come errori
|
||||
scripts/test.sh # tutti i test (PostgreSQL con KHAEMHAT_TEST_PG, Redis con KHAEMHAT_TEST_REDIS)
|
||||
scripts/run-dev.sh # avvio locale su http://localhost:5080 con SQLite in .data/dev
|
||||
docker build -f docker/Dockerfile -t khaemhat:dev .
|
||||
```
|
||||
|
||||
Processo, rami e Definition of Done in [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md).
|
||||
|
||||
## Documentazione
|
||||
|
||||
| Cosa | Dove |
|
||||
|
||||
+5
-1
@@ -1,4 +1,6 @@
|
||||
# Copia in .env accanto a docker-compose.unraid.yml (mai committare .env)
|
||||
# Copia in .env accanto al file compose (docker-compose.yml o docker-compose.unraid.yml); mai committare .env.
|
||||
# Versione dell'immagine: sempre esplicita, mai latest in produzione (ADR 0015).
|
||||
KHAEMHAT_VERSION=0.0.1
|
||||
POSTGRES_PASSWORD=cambiami-subito
|
||||
KHAEMHAT_SECRET_KEY= # openssl rand -base64 48
|
||||
KHAEMHAT_SUPERUSER=root
|
||||
@@ -11,3 +13,5 @@ KHAEMHAT_LICENSE_MODE=production
|
||||
KHAEMHAT_SEED_DEMO=false
|
||||
# KHAEMHAT_REDIS=redis://:cambiami@khaemhat-redis:6379/0
|
||||
# REDIS_PASSWORD=cambiami
|
||||
# PUID=99 # utente e gruppo proprietari di /data (ADR 0013); predefiniti 1654 = utente app dell'immagine
|
||||
# PGID=100
|
||||
@@ -0,0 +1,29 @@
|
||||
# Demo autonoma: un solo container, database SQLite nel volume /data, dati di esempio al primo avvio.
|
||||
# Solo per prove: per lavorare con più utenti serve PostgreSQL (docker-compose.yml).
|
||||
# docker compose -f docker-compose.sqlite.yml up
|
||||
services:
|
||||
khaemhat:
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:${KHAEMHAT_VERSION:-0.0.1}
|
||||
ports:
|
||||
- "${KHAEMHAT_PORT:-8080}:8080"
|
||||
environment:
|
||||
KHAEMHAT_SYSTEM_DB: sqlite:///data/system.db
|
||||
KHAEMHAT_SECRET_KEY: ${KHAEMHAT_SECRET_KEY:-}
|
||||
KHAEMHAT_SUPERUSER: root
|
||||
KHAEMHAT_SUPERUSER_PASSWORD: ${KHAEMHAT_SUPERUSER_PASSWORD:-}
|
||||
KHAEMHAT_COMPANY_CODE: DEMO
|
||||
KHAEMHAT_COMPANY_NAME: Khaemhat Demo S.r.l.
|
||||
KHAEMHAT_SEED_DEMO: "true"
|
||||
KHAEMHAT_LICENSE_MODE: test
|
||||
TZ: ${TZ:-Europe/Rome}
|
||||
volumes:
|
||||
- khaemhat-demo:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fs", "http://localhost:8080/health/live"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
volumes:
|
||||
khaemhat-demo:
|
||||
@@ -3,7 +3,7 @@
|
||||
# Le etichette net.unraid.docker.* mostrano icona e link WebUI nella pagina Docker di Unraid.
|
||||
services:
|
||||
khaemhat:
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:1.0.0
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:${KHAEMHAT_VERSION:-0.0.1}
|
||||
container_name: khaemhat
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
@@ -32,7 +32,7 @@ services:
|
||||
labels:
|
||||
net.unraid.docker.managed: composeman
|
||||
net.unraid.docker.webui: "http://[IP]:[PORT:8080]/"
|
||||
net.unraid.docker.icon: "https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-v1.0-256.png"
|
||||
net.unraid.docker.icon: "https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-256.png"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fs", "http://localhost:8080/health/live"]
|
||||
interval: 30s
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Khaemhat con PostgreSQL su qualunque host Docker (installazione consigliata, wiki Installazione-Docker).
|
||||
# Copia accanto a questo file .env.example come .env e compila i valori. Usa sempre una versione esplicita.
|
||||
# docker compose up -d applicazione + PostgreSQL
|
||||
# docker compose --profile redis up -d anche Redis (poi imposta KHAEMHAT_REDIS nel .env)
|
||||
services:
|
||||
khaemhat:
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:${KHAEMHAT_VERSION:-0.0.1}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
khaemhat-db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "${KHAEMHAT_PORT:-8080}:8080"
|
||||
environment:
|
||||
KHAEMHAT_SYSTEM_DB: postgres://khaemhat:${POSTGRES_PASSWORD:?imposta POSTGRES_PASSWORD nel .env}@khaemhat-db:5432/khaemhat_system
|
||||
KHAEMHAT_DB_SERVER: postgres://khaemhat:${POSTGRES_PASSWORD}@khaemhat-db:5432/
|
||||
KHAEMHAT_SECRET_KEY: ${KHAEMHAT_SECRET_KEY:-}
|
||||
KHAEMHAT_SUPERUSER: ${KHAEMHAT_SUPERUSER:-root}
|
||||
KHAEMHAT_SUPERUSER_PASSWORD: ${KHAEMHAT_SUPERUSER_PASSWORD:-}
|
||||
KHAEMHAT_SUPERUSER_EMAIL: ${KHAEMHAT_SUPERUSER_EMAIL:-}
|
||||
KHAEMHAT_COMPANY_CODE: ${KHAEMHAT_COMPANY_CODE:-DEMO}
|
||||
KHAEMHAT_COMPANY_NAME: ${KHAEMHAT_COMPANY_NAME:-La mia azienda S.r.l.}
|
||||
KHAEMHAT_PUBLIC_URL: ${KHAEMHAT_PUBLIC_URL:-http://localhost:8080}
|
||||
KHAEMHAT_REDIS: ${KHAEMHAT_REDIS:-}
|
||||
KHAEMHAT_LICENSE_MODE: ${KHAEMHAT_LICENSE_MODE:-production}
|
||||
KHAEMHAT_LICENSE: ${KHAEMHAT_LICENSE:-}
|
||||
KHAEMHAT_SEED_DEMO: ${KHAEMHAT_SEED_DEMO:-false}
|
||||
KHAEMHAT_LOG_LEVEL: ${KHAEMHAT_LOG_LEVEL:-Information}
|
||||
TZ: ${TZ:-Europe/Rome}
|
||||
PUID: ${PUID:-1654}
|
||||
PGID: ${PGID:-1654}
|
||||
volumes:
|
||||
- khaemhat-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fs", "http://localhost:8080/health/live"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
khaemhat-db:
|
||||
image: postgres:17
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: khaemhat_system
|
||||
POSTGRES_USER: khaemhat
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
TZ: ${TZ:-Europe/Rome}
|
||||
volumes:
|
||||
- khaemhat-pg:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U khaemhat -d khaemhat_system"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
khaemhat-redis:
|
||||
image: redis:7
|
||||
restart: unless-stopped
|
||||
profiles: ["redis"]
|
||||
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD:-cambiami}", "--save", "", "--appendonly", "no"]
|
||||
|
||||
volumes:
|
||||
khaemhat-data:
|
||||
khaemhat-pg:
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Template Unraid (formato Community Applications) per Khaemhat.
|
||||
Importalo da Docker › Add Container › Template. Immagine dal registro pacchetti di Gitea (ADR 0009).
|
||||
Importalo da Docker → Add Container → Template. Immagine dal registro pacchetti di Gitea (ADR 0009).
|
||||
Icona e template sono serviti come file raw dal repository pubblico BalboSoft/Khaemhat. -->
|
||||
<Container version="2">
|
||||
<Name>khaemhat</Name>
|
||||
<Repository>gitea.encke-hake.ts.net/balbosoft/khaemhat:1.0.0</Repository>
|
||||
<Repository>gitea.encke-hake.ts.net/balbosoft/khaemhat:0.0.1</Repository>
|
||||
<Registry>https://gitea.encke-hake.ts.net/BalboSoft/-/packages/container/khaemhat</Registry>
|
||||
<Network>khaemhat-net</Network>
|
||||
<Privileged>false</Privileged>
|
||||
@@ -14,7 +14,7 @@
|
||||
<Category>Productivity: Tools:</Category>
|
||||
<WebUI>http://[IP]:[PORT:8080]/</WebUI>
|
||||
<TemplateURL>https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/deploy/unraid/khaemhat.xml</TemplateURL>
|
||||
<Icon>https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-v1.0-256.png</Icon>
|
||||
<Icon>https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-256.png</Icon>
|
||||
<ExtraParams>--health-cmd="curl -fs http://localhost:8080/health/live || exit 1" --health-interval=30s --health-timeout=5s --health-retries=3</ExtraParams>
|
||||
<Requires>Un database PostgreSQL 16 o 17 raggiungibile (consigliato il template ufficiale postgres sulla rete khaemhat-net) e un ruolo con permesso CREATEDB.</Requires>
|
||||
<Config Name="Porta web" Target="8080" Default="8080" Mode="tcp" Description="Interfaccia web (dietro reverse proxy TLS)" Type="Port" Display="always" Required="true" Mask="false">8080</Config>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Khaemhat image (SPEC §16.1, ADR 0009, 0010, 0013, 0015, 0016, 0017). Build from the repository root:
|
||||
# docker build -f docker/Dockerfile --build-arg VERSION=0.0.1 --build-arg GIT_SHA=$(git rev-parse --short HEAD) .
|
||||
|
||||
ARG DOTNET_VERSION=10.0
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
|
||||
ARG VERSION=0.0.0-dev
|
||||
ARG GIT_SHA=unknown
|
||||
ARG RUN_TESTS=false
|
||||
ENV DOTNET_NOLOGO=1 DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
WORKDIR /src
|
||||
|
||||
# Restore first, from the build files only, so the layer is reused while no project or package changes.
|
||||
COPY global.json Directory.Build.props Directory.Build.targets Directory.Packages.props .editorconfig ./
|
||||
COPY src/Khaemhat.Core/Khaemhat.Core.csproj src/Khaemhat.Core/
|
||||
COPY src/Khaemhat.Fiscal.Abstractions/Khaemhat.Fiscal.Abstractions.csproj src/Khaemhat.Fiscal.Abstractions/
|
||||
COPY src/Khaemhat.Fiscal.Italy/Khaemhat.Fiscal.Italy.csproj src/Khaemhat.Fiscal.Italy/
|
||||
COPY src/Khaemhat.Data/Khaemhat.Data.csproj src/Khaemhat.Data/
|
||||
COPY src/Khaemhat.Data.Sqlite/Khaemhat.Data.Sqlite.csproj src/Khaemhat.Data.Sqlite/
|
||||
COPY src/Khaemhat.Data.PostgreSql/Khaemhat.Data.PostgreSql.csproj src/Khaemhat.Data.PostgreSql/
|
||||
COPY src/Khaemhat.Infrastructure/Khaemhat.Infrastructure.csproj src/Khaemhat.Infrastructure/
|
||||
COPY src/Khaemhat.Application/Khaemhat.Application.csproj src/Khaemhat.Application/
|
||||
COPY src/Khaemhat.Web/Khaemhat.Web.csproj src/Khaemhat.Web/
|
||||
RUN dotnet restore src/Khaemhat.Web/Khaemhat.Web.csproj
|
||||
|
||||
COPY . .
|
||||
RUN bash scripts/check-packages.sh
|
||||
RUN if [ "$RUN_TESTS" = "true" ]; then \
|
||||
dotnet test Khaemhat.sln -c Release /p:Version="$VERSION" /p:SourceRevisionId="$GIT_SHA"; \
|
||||
fi
|
||||
RUN dotnet publish src/Khaemhat.Web/Khaemhat.Web.csproj -c Release -o /app --no-restore \
|
||||
/p:Version="$VERSION" /p:SourceRevisionId="$GIT_SHA" /p:UseAppHost=false
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} AS runtime
|
||||
ARG VERSION=0.0.0-dev
|
||||
ARG GIT_SHA=unknown
|
||||
ARG CREATED=unknown
|
||||
ARG SOURCE_URL=https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat
|
||||
ARG ICON_URL=https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-256.png
|
||||
|
||||
# OS tools allowed by SPEC §1.2 (not application components): pg_dump/pg_restore 17 from the PGDG repository (a
|
||||
# client >= the server: works with PostgreSQL 16 and 17), curl for the health check, tzdata for TZ.
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl tzdata; \
|
||||
. /etc/os-release; \
|
||||
install -d /usr/share/postgresql-common/pgdg; \
|
||||
curl -fsSL -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc; \
|
||||
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt ${VERSION_CODENAME}-pgdg main" \
|
||||
> /etc/apt/sources.list.d/pgdg.list; \
|
||||
apt-get update; \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-client-17; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
pg_dump --version
|
||||
|
||||
ENV ASPNETCORE_ENVIRONMENT=Production \
|
||||
ASPNETCORE_HTTP_PORTS=8080 \
|
||||
KHAEMHAT_DATA_DIR=/data \
|
||||
DOTNET_NOLOGO=1 \
|
||||
TZ=Europe/Rome
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build /app ./
|
||||
COPY docker/entrypoint.sh /app/entrypoint.sh
|
||||
COPY scripts/restore-system.sh /app/scripts/restore-system.sh
|
||||
RUN chmod 0755 /app/entrypoint.sh /app/scripts/restore-system.sh \
|
||||
&& install -d -o app -g app -m 0750 /data
|
||||
|
||||
LABEL org.opencontainers.image.title="Khaemhat" \
|
||||
org.opencontainers.image.description="Gestionale ERP e CRM per PMI italiane" \
|
||||
org.opencontainers.image.vendor="BalboSoft" \
|
||||
org.opencontainers.image.version="${VERSION}" \
|
||||
org.opencontainers.image.revision="${GIT_SHA}" \
|
||||
org.opencontainers.image.created="${CREATED}" \
|
||||
org.opencontainers.image.source="${SOURCE_URL}" \
|
||||
org.opencontainers.image.url="${SOURCE_URL}" \
|
||||
org.opencontainers.image.documentation="${SOURCE_URL}/wiki" \
|
||||
net.unraid.docker.icon="${ICON_URL}" \
|
||||
net.unraid.docker.webui="http://[IP]:[PORT:8080]/"
|
||||
|
||||
VOLUME /data
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||
CMD curl -fs http://localhost:8080/health/live || exit 1
|
||||
|
||||
# Starts as root only to align the app user with PUID/PGID; the .NET process runs as "app" (ADR 0013).
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
# Container entrypoint (docs/DEPLOY.md §2.4, ADR 0013, ADR 0014). It only prepares the user, waits for the system
|
||||
# database and starts the app: migrations and bootstrap live in the .NET code.
|
||||
set -euo pipefail
|
||||
|
||||
APP_DLL=/app/Khaemhat.Web.dll
|
||||
DATA_DIR="${KHAEMHAT_DATA_DIR:-/data}"
|
||||
DB_WAIT_SECONDS=120
|
||||
|
||||
log() { printf '%s khaemhat-entrypoint: %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$*" >&2; }
|
||||
fail() { log "ERRORE: $*"; exit 1; }
|
||||
|
||||
# The system database URL, from KHAEMHAT_SYSTEM_DB or KHAEMHAT_SYSTEM_DB_FILE (ADR 0014). Only host and port are used.
|
||||
system_db() {
|
||||
if [[ -n "${KHAEMHAT_SYSTEM_DB:-}" && -n "${KHAEMHAT_SYSTEM_DB_FILE:-}" ]]; then
|
||||
fail "KHAEMHAT_SYSTEM_DB e KHAEMHAT_SYSTEM_DB_FILE sono entrambe impostate: usane una sola."
|
||||
fi
|
||||
if [[ -n "${KHAEMHAT_SYSTEM_DB_FILE:-}" ]]; then
|
||||
[[ -r "$KHAEMHAT_SYSTEM_DB_FILE" ]] || fail "KHAEMHAT_SYSTEM_DB_FILE: file non leggibile ($KHAEMHAT_SYSTEM_DB_FILE)."
|
||||
head -n 1 "$KHAEMHAT_SYSTEM_DB_FILE" | tr -d '\r\n'
|
||||
else
|
||||
printf '%s' "${KHAEMHAT_SYSTEM_DB:-}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Waits until the PostgreSQL server of the system database accepts connections. SQLite needs no wait.
|
||||
wait_for_database() {
|
||||
local url host port rest deadline
|
||||
url="$(system_db)"
|
||||
case "$url" in
|
||||
postgres://* | postgresql://*) ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
|
||||
rest="${url#*://}" # user:pwd@host:port/db?x
|
||||
rest="${rest##*@}" # host:port/db?x
|
||||
rest="${rest%%/*}" # host:port
|
||||
rest="${rest%%\?*}"
|
||||
host="${rest%%:*}"
|
||||
port=5432
|
||||
[[ "$rest" == *:* ]] && port="${rest##*:}"
|
||||
[[ -n "$host" ]] || fail "KHAEMHAT_SYSTEM_DB: host mancante."
|
||||
|
||||
deadline=$((SECONDS + DB_WAIT_SECONDS))
|
||||
until pg_isready -q -h "$host" -p "$port" -t 3; do
|
||||
if (( SECONDS >= deadline )); then
|
||||
fail "il database di sistema su $host:$port non risponde dopo ${DB_WAIT_SECONDS}s."
|
||||
fi
|
||||
log "attendo il database di sistema su $host:$port..."
|
||||
sleep 2
|
||||
done
|
||||
log "database di sistema raggiungibile su $host:$port."
|
||||
}
|
||||
|
||||
# Aligns the "app" user with PUID/PGID and gives it /data (ADR 0013). Only when started as root.
|
||||
prepare_user() {
|
||||
local puid="${PUID:-$(id -u app)}" pgid="${PGID:-$(id -g app)}"
|
||||
[[ "$puid" =~ ^[0-9]+$ && "$pgid" =~ ^[0-9]+$ ]] || fail "PUID e PGID devono essere numeri (PUID=$puid, PGID=$pgid)."
|
||||
(( puid != 0 && pgid != 0 )) || fail "PUID e PGID non possono essere 0: l'applicazione non gira come root."
|
||||
|
||||
if [[ "$(id -g app)" != "$pgid" ]]; then
|
||||
groupmod -o -g "$pgid" app
|
||||
fi
|
||||
if [[ "$(id -u app)" != "$puid" ]]; then
|
||||
usermod -o -u "$puid" app
|
||||
fi
|
||||
|
||||
mkdir -p "$DATA_DIR"
|
||||
if [[ "$(stat -c '%u:%g' "$DATA_DIR")" != "$puid:$pgid" ]]; then
|
||||
log "assegno $DATA_DIR a $puid:$pgid..."
|
||||
chown -R "$puid:$pgid" "$DATA_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_database
|
||||
|
||||
if [[ "$(id -u)" == "0" ]]; then
|
||||
prepare_user
|
||||
log "avvio Khaemhat come utente app ($(id -u app):$(id -g app))."
|
||||
exec setpriv --reuid=app --regid=app --init-groups -- dotnet "$APP_DLL" "$@"
|
||||
fi
|
||||
|
||||
log "avvio Khaemhat come utente $(id -u):$(id -g)."
|
||||
exec dotnet "$APP_DLL" "$@"
|
||||
@@ -0,0 +1,14 @@
|
||||
-- Optional init script for the official postgres image (mount it in /docker-entrypoint-initdb.d/): it runs once,
|
||||
-- when the data directory is empty. Khaemhat creates every table itself (migrations in .NET, one database per
|
||||
-- company), so this only sets defaults for the application role.
|
||||
--
|
||||
-- The role must be able to create databases (CREATEDB): the POSTGRES_USER of the official image is a superuser and
|
||||
-- already can; for an existing server see docs/DEPLOY.md.
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
-- Timestamps are stored as timestamptz and handled in UTC by the application.
|
||||
EXECUTE format('ALTER ROLE %I SET timezone TO %L', current_user, 'UTC');
|
||||
EXECUTE format('ALTER ROLE %I SET client_encoding TO %L', current_user, 'UTF8');
|
||||
END
|
||||
$$;
|
||||
@@ -1,6 +1,6 @@
|
||||
# Architettura di Khaemhat
|
||||
|
||||
> Stato: bozza · Revisione 2026-11-10 · Fonte: SPEC §1, §2, §3, §4, §5, §7, §9, §13, §15, §19, §21; ADR 0009-0011
|
||||
> Stato: bozza · Revisione 2026-11-11 · Fonte: SPEC §1, §2, §3, §4, §5, §7, §9, §13, §15, §19, §21; ADR 0009-0017
|
||||
|
||||
Questo documento descrive l'architettura **prevista** del gestionale: livelli, progetti, regole di dipendenza,
|
||||
composizione dei moduli, gestione multi-database, ciclo di una richiesta e servizi trasversali. Il codice non esiste
|
||||
@@ -391,8 +391,12 @@ Khaemhat/
|
||||
Differenze rispetto a SPEC §4: `.gitea/workflows/` al posto di `.github/workflows/`; registro pacchetti Gitea al
|
||||
posto di GHCR; nessun repository `khaemhat-assets` (icona servita come file raw del repository pubblico);
|
||||
`docs/SPEC.md` contiene la specifica e `CLAUDE.md` è breve (ADR 0011); `docs/mockups/thumbs/` aggiunta;
|
||||
`scripts/restore-system.sh` è citato in SPEC §13 e qui riportato nell'albero. Nessun installer né binario
|
||||
distribuito (ADR 0010).
|
||||
`scripts/restore-system.sh` è citato in SPEC §13 e qui riportato nell'albero; è copiato nell'immagine in
|
||||
`/app/scripts/` (ADR 0017). Nessun installer né binario distribuito (ADR 0010). In più `.vscode/` (debug e attività
|
||||
di Visual Studio Code) e `.gitea/scripts/check-yaml.rb` (controllo YAML della CI).
|
||||
|
||||
Le regole di dipendenza della §3 e l'allowlist dei pacchetti sono verificate da test: `Khaemhat.Core.Tests`,
|
||||
cartella `Architecture/`, legge i file di progetto e fallisce su ogni riferimento non ammesso.
|
||||
|
||||
## 10. Classi principali per progetto
|
||||
|
||||
|
||||
+19
-17
@@ -103,7 +103,8 @@ Note:
|
||||
### 2.3 Utente e `PUID`/`PGID`
|
||||
|
||||
Le immagini `aspnet:10.0` includono già un utente non root `app`. SPEC chiede che i file in `/data` appartengano a
|
||||
`PUID`/`PGID` (predefiniti 99/100 per Unraid). Due realizzazioni possibili, da fissare con un ADR in M0:
|
||||
`PUID`/`PGID` (99/100 per Unraid). Le due realizzazioni valutate; **ADR 0013 sceglie la 1** (predefiniti `1654`,
|
||||
l'utente `app` dell'immagine; la 2 resta possibile perché l'entrypoint salta la preparazione se non è root):
|
||||
|
||||
1. **avvio come root e cessione dei privilegi** in `entrypoint.sh`: allinea UID/GID di `app` a `PUID`/`PGID`,
|
||||
esegue `chown` su `/data` solo se necessario e rilancia il processo come `app` con `setpriv` (util-linux, già
|
||||
@@ -118,7 +119,8 @@ gira mai come root.
|
||||
|
||||
Sequenza (SPEC §4, §5.4):
|
||||
|
||||
1. legge le varianti `_FILE` delle variabili e le esporta (§5);
|
||||
1. legge `KHAEMHAT_SYSTEM_DB` (o `KHAEMHAT_SYSTEM_DB_FILE`) solo per ricavarne host e porta: le varianti `_FILE` le
|
||||
risolve l'applicazione, senza esportare segreti nell'ambiente (ADR 0014, §5);
|
||||
2. se previsto, allinea utente e permessi (§2.3);
|
||||
3. attende che `KHAEMHAT_SYSTEM_DB` sia raggiungibile (retry con backoff, timeout esplicito, messaggio chiaro);
|
||||
4. avvia l'applicazione (`exec dotnet Khaemhat.Web.dll`), che in `StartupOrchestrator` valida le opzioni
|
||||
@@ -128,7 +130,7 @@ Sequenza (SPEC §4, §5.4):
|
||||
|
||||
Le migrazioni restano nel codice .NET (`MigrationRunner`), non nello script shell: l'entrypoint fa solo attesa,
|
||||
ambiente e `exec`. `docker/postgres/init.sql` è uno script di inizializzazione opzionale per il container PostgreSQL
|
||||
(contenuto da definire in M0).
|
||||
(montato in `/docker-entrypoint-initdb.d/`: imposta per il ruolo dell'applicazione fuso `UTC` e codifica `UTF8`).
|
||||
|
||||
## 3. File in `deploy/`
|
||||
|
||||
@@ -182,8 +184,8 @@ L'elenco completo e normativo delle variabili è SPEC §6 con le modifiche di E1
|
||||
- `KHAEMHAT_SECRET_KEY` è obbligatoria (≥ 32 byte base64): cifra con AES-256-GCM i segreti in `sys_companies`,
|
||||
`sys_settings` ecc. e i file di backup. Senza chiave l'app non parte.
|
||||
- `KHAEMHAT_SUPERUSER*`, `KHAEMHAT_COMPANY_*` sono lette solo se le tabelle corrispondenti sono vuote.
|
||||
- Varianti `_FILE` (Docker secrets): SPEC le prevede per `KHAEMHAT_SYSTEM_DB` e `KHAEMHAT_SUPERUSER_*`. Proposta da
|
||||
confermare in M2: supportarle per **tutte** le variabili sensibili (`KHAEMHAT_SECRET_KEY`,
|
||||
- Varianti `_FILE` (Docker secrets): SPEC le prevede per `KHAEMHAT_SYSTEM_DB` e `KHAEMHAT_SUPERUSER_*`. **Deciso con
|
||||
ADR 0014**: sono supportate per **tutte** le variabili sensibili (`KHAEMHAT_SECRET_KEY`,
|
||||
`KHAEMHAT_SECRET_KEY_NEW`, `KHAEMHAT_DB_SERVER`, `KHAEMHAT_REDIS`, `KHAEMHAT_LICENSE`, `KHAEMHAT_SMTP_PASSWORD`,
|
||||
`KHAEMHAT_UPDATE_TOKEN`) con una sola regola in `EnvironmentConfigurationReader`: se esiste `X_FILE`, il valore è il
|
||||
contenuto del file senza il fine riga finale; `X` e `X_FILE` insieme sono un errore di configurazione.
|
||||
@@ -206,8 +208,8 @@ Regole (SPEC §16.6, E1):
|
||||
`https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-v<major.minor>-256.png`;
|
||||
il file deve quindi essere **committato su `main` prima** del rilascio che lo referenzia;
|
||||
- la conversione SVG → PNG richiede un rasterizzatore che l'applicazione non contiene (né deve contenere): si esegue
|
||||
sulla macchina di sviluppo con uno strumento di sistema e il PNG si committa. La scelta dello strumento va
|
||||
registrata in un ADR;
|
||||
sulla macchina di sviluppo con uno strumento di sistema e il PNG si committa. Strumenti accettati:
|
||||
`rsvg-convert`, `inkscape`, `magick` (ADR 0016);
|
||||
- finché manca la variante della nuova versione si usa `icon-256.png` (non versionata).
|
||||
|
||||
## 7. Versioning
|
||||
@@ -226,7 +228,7 @@ Regole (SPEC §16.6, E1):
|
||||
|---|---|---|
|
||||
| `GET /health/live` | liveness: il processo risponde. Usato da `HEALTHCHECK`, dal compose e da `<ExtraParams>` del template. Non deve dipendere dal database, altrimenti un DB lento fa riavviare il container | previsto da SPEC (§16.1, App. C) |
|
||||
| `GET /health` | endpoint di base introdotto in M0 | previsto da SPEC (§20, M0) |
|
||||
| readiness (proposta `GET /health/ready`) | database di sistema raggiungibile, migrazioni di sistema applicate, bootstrap concluso; `503` durante l'avvio | da definire con `HealthEndpoints` |
|
||||
| readiness (proposta `GET /health/ready`) | database di sistema raggiungibile, migrazioni di sistema applicate, bootstrap concluso; `503` durante l'avvio | ADR 0012: in M0 sempre `200`, i controlli arrivano in M1-M2 |
|
||||
| metriche (`MetricsEndpoint`) | formato e percorso | da definire |
|
||||
|
||||
Regole: risposte senza autenticazione e senza dati sensibili (niente versioni dei componenti, connection string o
|
||||
@@ -278,9 +280,9 @@ Differenze rispetto all'Appendice D (ADR 0009): registro pacchetti di Gitea, var
|
||||
`GITEA_TOKEN`, tag immagine senza `v`. La rigenerazione dell'icona sta in `scripts/build.sh` (§6).
|
||||
|
||||
**Tag git e doppio build.** Se lo script creasse e spingesse anche il tag `vX.Y.Z`, il push farebbe partire
|
||||
`release.yml` e l'immagine verrebbe costruita due volte. Proposta: lo script **non** crea tag; il tag si crea alla
|
||||
chiusura della milestone (E6). In alternativa `release.yml` controlla prima del build se la versione esiste già nel
|
||||
registro (`GET /api/v1/packages/BalboSoft/container/khaemhat/<X.Y.Z>` → `200`) e in quel caso salta il push.
|
||||
`release.yml` e l'immagine verrebbe costruita due volte. **Deciso con ADR 0015**: lo script **non** crea tag; il tag si crea alla
|
||||
chiusura della milestone (E6). In più `release.yml` controlla prima del build se la versione esiste già nel
|
||||
registro (`GET /api/v1/packages/BalboSoft/container/khaemhat/<X.Y.Z>` → `200`) e in quel caso salta build e push e crea solo la release.
|
||||
|
||||
## 10. Checklist di rilascio
|
||||
|
||||
@@ -307,7 +309,7 @@ registro (`GET /api/v1/packages/BalboSoft/container/khaemhat/<X.Y.Z>` → `200`)
|
||||
- `MigrationRunner` rifiuta di partire se trova in `schema_version` versioni non note: il **downgrade non è
|
||||
supportato**.
|
||||
- Rollback: tag precedente; se la versione nuova ha applicato migrazioni, prima si ripristinano database di sistema
|
||||
(`scripts/restore-system.sh`, istanza ferma) e aziende dai backup fatti prima dell'aggiornamento.
|
||||
(`/app/scripts/restore-system.sh` nell'immagine, ADR 0017, istanza ferma) e aziende dai backup fatti prima dell'aggiornamento.
|
||||
- Per questo ogni voce del changelog dichiara se contiene migrazioni.
|
||||
|
||||
Procedura per l'utente: wiki *Aggiornamento*.
|
||||
@@ -346,11 +348,11 @@ documentazione utente chiede di conservare la vecchia chiave per tutta la retent
|
||||
|
||||
| Punto | Proposta | Quando |
|
||||
|---|---|---|
|
||||
| `PUID`/`PGID` con utente non root | avvio root + `setpriv` nell'entrypoint (§2.3) | ADR in M0 |
|
||||
| Elenco delle variabili con `_FILE` | tutte le sensibili (§5) | M2 |
|
||||
| Endpoint di readiness e metriche | `/health/ready`; metriche da definire (§8) | M0/M2 |
|
||||
| Doppio build tag + script | lo script non crea tag (§9.2) | M0 |
|
||||
| Rasterizzazione dell'icona versionata | strumento di sistema sulla macchina di sviluppo, PNG committato (§6) | M13 |
|
||||
| `PUID`/`PGID` con utente non root | avvio root + `setpriv` nell'entrypoint (§2.3) | **deciso: ADR 0013** |
|
||||
| Elenco delle variabili con `_FILE` | tutte le sensibili (§5) | **deciso: ADR 0014**; implementazione in M1-M2 |
|
||||
| Endpoint di readiness e metriche | `/health/ready` (**ADR 0012**); metriche da definire (§8) | M2 |
|
||||
| Doppio build tag + script | lo script non crea tag (§9.2) | **deciso: ADR 0015** |
|
||||
| Rasterizzazione dell'icona versionata | strumento di sistema sulla macchina di sviluppo, PNG committato (§6) | **deciso: ADR 0016** |
|
||||
| Backup cifrati dopo la rotazione della chiave | registro delle chiavi storiche o ri-cifratura (§13) | M12 |
|
||||
| Connection string delle aziende e rotazione della password PostgreSQL | per le aziende create su `KHAEMHAT_DB_SERVER`, salvare un riferimento "credenziali del server" invece della stringa completa | M1/M2 |
|
||||
| Decifratura dei backup fuori dall'applicazione | comando in `restore-system.sh` o sottocomando dedicato | M12 |
|
||||
+59
-6
@@ -1,10 +1,9 @@
|
||||
# Processo di sviluppo
|
||||
|
||||
> Stato: bozza · Revisione 2026-11-10 · Fonte: SPEC §17-§20, §23, `CLAUDE.md`
|
||||
> Stato: completo per M0 · Revisione 2026-11-11 · Fonte: SPEC §17-§20, §23, `CLAUDE.md`
|
||||
|
||||
Questo documento dice **come** si lavora su Khaemhat: unità di lavoro, rami, commit, verifica, chiusura delle
|
||||
milestone. Le regole di prodotto stanno in [`SPEC.md`](SPEC.md) e negli emendamenti di [`CLAUDE.md`](../CLAUDE.md).
|
||||
I comandi di build e test reali verranno completati in M0, quando esisterà il codice.
|
||||
|
||||
## 1. Prerequisiti
|
||||
|
||||
@@ -16,7 +15,42 @@ I comandi di build e test reali verranno completati in M0, quando esisterà il c
|
||||
| PostgreSQL | 16 o 17 | facoltativo in locale: `KHAEMHAT_TEST_PG` attiva i test sul motore reale |
|
||||
| Redis | 7 | facoltativo: `KHAEMHAT_TEST_REDIS` attiva i test del client RESP |
|
||||
|
||||
Se manca l'SDK 10 ci si ferma e lo si chiede al titolare (SPEC §23).
|
||||
Se manca l'SDK 10 ci si ferma e lo si chiede al titolare (SPEC §23). Su Windows gli script si eseguono da Git Bash.
|
||||
|
||||
### 1.1 Comandi
|
||||
|
||||
| Comando | Cosa fa |
|
||||
|---|---|
|
||||
| `scripts/build.sh` | `check-packages.sh` + `dotnet build Khaemhat.sln -c Release -warnaserror` |
|
||||
| `scripts/build.sh --icon [X.Y]` | anche l'icona versionata `assets/icon-vX.Y.svg` e, se c'è un rasterizzatore, i PNG (ADR 0016) |
|
||||
| `scripts/test.sh [argomenti di dotnet test]` | allowlist + tutti i test; PostgreSQL con `KHAEMHAT_TEST_PG`, Redis con `KHAEMHAT_TEST_REDIS` |
|
||||
| `scripts/run-dev.sh` | avvio locale su `http://localhost:5080`, SQLite in `.data/dev`, licenze di test |
|
||||
| `scripts/check-packages.sh` | fallisce se un file MSBuild usa un pacchetto fuori allowlist o fuori dal suo progetto |
|
||||
| `docker build -f docker/Dockerfile -t khaemhat:dev .` | immagine locale (`--build-arg RUN_TESTS=true` per eseguire i test nel build) |
|
||||
| `docker compose -f deploy/docker-compose.sqlite.yml up` | demo autonoma (con `KHAEMHAT_VERSION` per scegliere l'immagine) |
|
||||
| `scripts/publish-image.sh vX.Y.Z [--arm64]` | pubblicazione dalla macchina di sviluppo se il runner non c'è (ADR 0015) |
|
||||
| `scripts/publish-wiki.sh` | pubblica `docs/wiki/` nel wiki Gitea senza passare dal runner |
|
||||
|
||||
Gli stub `new-migration.sh` (M1), `gen-datamodel.sh` (M1), `seed.sh` (M4) e `restore-system.sh` (M12, incluso
|
||||
nell'immagine, ADR 0017) spiegano l'uso previsto ed escono con errore finché la loro milestone non li completa.
|
||||
|
||||
### 1.2 Visual Studio Code
|
||||
|
||||
La cartella `.vscode/` è nel repository:
|
||||
|
||||
- `launch.json`: **Khaemhat (web, SQLite)** compila (attività `build`) e avvia `Khaemhat.Web` in debug su
|
||||
`http://localhost:5080` con le stesse variabili di `scripts/run-dev.sh` (SQLite in `.data/dev`, licenze di test,
|
||||
log `Debug`) e apre il browser quando il server è pronto; **Khaemhat (web, PostgreSQL)** fa lo stesso contro un
|
||||
PostgreSQL locale (comando per avviarlo nel commento); **Collega a un processo** si aggancia a un'istanza già avviata;
|
||||
- `tasks.json`: `build` (predefinita, `Ctrl+Shift+B`), `test`, `watch (web)` con ricaricamento a caldo,
|
||||
`check-packages`, `docker build`;
|
||||
- `extensions.json`: C# Dev Kit, C#, EditorConfig, Docker.
|
||||
|
||||
Si apre la cartella del repository, si sceglie la configurazione nel pannello *Esegui e debug* e si preme `F5`. Le
|
||||
chiavi e le password di `launch.json` valgono solo per lo sviluppo locale.
|
||||
|
||||
I test architetturali (`Khaemhat.Core.Tests/Architecture`) leggono i `.csproj`: un riferimento fra progetti non
|
||||
previsto da SPEC §3 o un pacchetto fuori allowlist li fa fallire, oltre a far fallire `check-packages.sh`.
|
||||
|
||||
## 2. Ripresa di una sessione
|
||||
|
||||
@@ -108,9 +142,26 @@ La wiki si pubblica nel wiki Gitea da `wiki.yml` (push su `main` che tocca `docs
|
||||
| `.gitea/workflows/release.yml` | tag `v*`; manuale | immagine, smoke test `/health/live`, push nel registro Gitea, release con note dal `CHANGELOG.md` |
|
||||
| `.gitea/workflows/wiki.yml` | push su `main` che tocca `docs/wiki/**` | sincronizza il wiki Gitea |
|
||||
|
||||
Segreti e variabili: `REGISTRY_TOKEN` (segreto di organizzazione `BalboSoft`, permesso `write:package`, già presente);
|
||||
il token automatico del job per checkout e wiki. Il runner è condiviso con altri progetti: niente matrici superflue,
|
||||
`concurrency` con cancellazione dei job superati, `timeout-minutes` su ogni job.
|
||||
`ci.yml` costruisce e prova anche l'immagine (job *Docker image*: `/health/live`, utente `PUID`/`PGID`, `pg_dump`)
|
||||
su PR, push e avvio manuale; sui tag lo fa `release.yml`. Un controllo YAML (Ruby) valida workflow e compose.
|
||||
|
||||
| Nome | Tipo | Uso |
|
||||
|---|---|---|
|
||||
| `REGISTRY_TOKEN` | segreto di organizzazione (già presente) | login al registro e controllo delle versioni già pubblicate; permesso pacchetti lettura e scrittura |
|
||||
| `REGISTRY_USER` | variabile (facoltativa) | utente del login al registro; predefinito: chi ha spinto il tag (`github.actor`), che deve essere il proprietario del token |
|
||||
| `REGISTRY`, `PUBLIC_URL` | variabili (facoltative) | host del registro e indirizzo pubblico di Gitea; predefiniti `gitea.encke-hake.ts.net` |
|
||||
| `WIKI_TOKEN` | segreto (facoltativo) | solo se il token automatico del job non può scrivere nel wiki |
|
||||
| token automatico | del job | checkout, archivio per il controllo YAML, release Gitea, wiki |
|
||||
|
||||
Il runner (`act_runner` in modalità Docker, etichetta `ubuntu-latest`) deve vedere il daemon Docker dell'host: i job
|
||||
senza `container:` usano la CLI `docker` dell'immagine del runner, come in Chronos. Il runner è condiviso con altri
|
||||
progetti: niente matrici superflue (solo PostgreSQL 16/17 sui tag), `concurrency` con cancellazione dei job superati,
|
||||
`timeout-minutes` su ogni job. Ciò che un job annullato lascia sull'host (container, reti, immagini con l'etichetta
|
||||
`khaemhat-ci.job`) lo rimuove il job successivo.
|
||||
|
||||
**Rilascio** (ADR 0015): `CHANGELOG.md` con la sezione `## [X.Y.Z] - data`, commit su `main`, poi
|
||||
`git tag -a vX.Y.Z -m "Khaemhat X.Y.Z" && git push origin vX.Y.Z`. Tag git `vX.Y.Z`, immagine `X.Y.Z` (più `latest`
|
||||
se non è una pre-release). Se si è pubblicato con `publish-image.sh`, il push del tag crea solo la release.
|
||||
|
||||
## 10. Chiusura di una milestone
|
||||
|
||||
@@ -122,6 +173,8 @@ L'issue *Chiusura milestone* verifica la **Definition of Done** (SPEC §20):
|
||||
- [ ] log per sezione dei nuovi moduli
|
||||
- [ ] wiki delle funzioni consegnate *completa*; `docs/*.md` aggiornati; `CHANGELOG.md`
|
||||
- [ ] `docs/STATUS.md` aggiornato con il punto di ripresa
|
||||
- [ ] versione nei file di `deploy/` (`KHAEMHAT_VERSION` dei compose e di `.env.example`, `<Repository>` del template
|
||||
Unraid); icona versionata con `scripts/build.sh --icon` se cambia `major.minor` dalla 1.0 in poi (ADR 0016)
|
||||
- [ ] commit, tag `vX.Y.Z`, immagine `gitea.encke-hake.ts.net/balbosoft/khaemhat:X.Y.Z`, release Gitea
|
||||
- [ ] l'immagine si costruisce in locale e la demo SQLite parte da zero
|
||||
- [ ] le issue della milestone successiva passano in *Da fare*
|
||||
|
||||
+25
-14
@@ -2,11 +2,10 @@
|
||||
|
||||
> Punto di ripresa per ogni sessione. Aggiornare a fine sessione.
|
||||
|
||||
**Ultimo aggiornamento:** 2026-11-10
|
||||
**Milestone corrente:** nessuna — documentazione e pianificazione completate, **sviluppo non ancora avviato**
|
||||
**Prossimo passo:** attendere il via del titolare (emendamento E5 di `CLAUDE.md`), poi M0 — Bootstrap, partendo
|
||||
dall'issue #1 *M0 · Soluzione, progetti e regole di build*
|
||||
(colonna *Da fare* del progetto *Khaemhat 1.0 — Sviluppo*).
|
||||
**Ultimo aggiornamento:** 2026-11-11
|
||||
**Milestone corrente:** M0 — Bootstrap (via allo sviluppo dato dal titolare il 2026-11-11)
|
||||
**Prossimo passo:** chiudere M0 (PR `feat/m0-bootstrap` → `main`, CI verde, tag `v0.0.1`, immagine e release), poi
|
||||
M1 — Fondamenta dati, partendo dall'issue #7 (colonna *Da fare* del progetto *Khaemhat 1.0 — Sviluppo*).
|
||||
|
||||
## Fatto
|
||||
|
||||
@@ -17,6 +16,12 @@ dall'issue #1 *M0 · Soluzione, progetti e regole di build*
|
||||
- Documentazione tecnica: `ARCHITECTURE.md`, `DATA-MODEL.md` (provvisorio, sarà generato), `MODULES.md`, `API.md`,
|
||||
`MCP.md`, `DEPLOY.md`, `SECURITY.md`, `DEVELOPMENT.md`.
|
||||
- Wiki completa in bozza in `docs/wiki/`, pubblicata nel wiki Gitea.
|
||||
- **M0 (in chiusura):** soluzione `Khaemhat.sln` con i 10 progetti di SPEC §3 e 6 progetti di test; regole di build
|
||||
(`Directory.Build.props/targets`, Central Package Management con l'allowlist, `.editorconfig`, warning come errori);
|
||||
test architetturali delle dipendenze e dei pacchetti; `Khaemhat.Web` con pagina "in costruzione", icone,
|
||||
`/health/live`, `/health/ready`, `/health` (ADR 0012); `docker/Dockerfile`, `entrypoint.sh` con `PUID`/`PGID`
|
||||
(ADR 0013), `postgres/init.sql`; `deploy/docker-compose.yml` e `docker-compose.sqlite.yml`; Gitea Actions `ci.yml`,
|
||||
`release.yml`, `wiki.yml` con controllo YAML; script di build, test, avvio, pubblicazione e stub; ADR 0012-0017.
|
||||
- Su Gitea: etichette, milestone M0-M14, 114 issue con checklist, progetti *Khaemhat 1.0 — Sviluppo* (M0-M13)
|
||||
e *Khaemhat 1.1+ — Fase 2* (M14). Numerazione: M0 #1-#6 e #114, M1 #7-#14, M2 #15-#24, M3 #25-#36,
|
||||
M4 #37-#46, M5 #47-#54, M6 #55-#61, M7 #62-#68, M8 #69-#73, M9 #74-#81, M10 #82-#87, M11 #88-#91,
|
||||
@@ -24,11 +29,17 @@ dall'issue #1 *M0 · Soluzione, progetti e regole di build*
|
||||
|
||||
## Ambiente verificato
|
||||
|
||||
Da compilare all'inizio di M0: versioni di `dotnet`, `docker`, `git`; runner Gitea Actions disponibile.
|
||||
Rilevato il 2026-11-11 sulla macchina di sviluppo (Windows 11, Git Bash per gli script):
|
||||
|
||||
| Strumento | Versione |
|
||||
|---|---|
|
||||
| .NET SDK | 10.0.403 (`global.json`: 10.0.100, `rollForward: latestFeature`) |
|
||||
| Docker | 29.1.3 (Docker Desktop, daemon da avviare a mano) |
|
||||
| Git | 2.54 |
|
||||
| Runner Gitea Actions | `act_runner` in modalità Docker, etichetta `ubuntu-latest` (condiviso con Chronos) |
|
||||
|
||||
## In attesa del titolare
|
||||
|
||||
- Via allo sviluppo.
|
||||
- PNG ad alta risoluzione delle 66 schermate disponibili solo come miniatura (issue #35, non bloccante).
|
||||
- Scelta degli intermediari SDI e accreditamento SdICoop (issue #78, non bloccante).
|
||||
- Prova del template su Unraid (issue #106).
|
||||
@@ -43,14 +54,14 @@ Emersi durante la stesura della documentazione. Si decidono con un ADR quando si
|
||||
|
||||
### Installazione, aggiornamento, backup (dalla stesura di DEPLOY e wiki installazione)
|
||||
|
||||
1. `scripts/restore-system.sh` è l'unico modo di ripristinare il DB di sistema (§13), ma gli script non sono distribuiti (ADR 0010): oggi la wiki dice di scaricarlo dal repository. Valutare di includerlo nell'immagine (`/app/scripts/`).
|
||||
1. `scripts/restore-system.sh` è l'unico modo di ripristinare il DB di sistema (§13), ma gli script non sono distribuiti (ADR 0010): oggi la wiki dice di scaricarlo dal repository. Valutare di includerlo nell'immagine (`/app/scripts/`). **Deciso in M0: ADR 0017.**
|
||||
2. Backup cifrati con `KHAEMHAT_SECRET_KEY`: manca uno strumento di decifratura fuori dall'app e non è definito cosa succede ai backup vecchi dopo la rotazione della chiave (oggi: conservare la chiave vecchia per tutta la retention).
|
||||
3. `PUID`/`PGID` e utente non root (§16.1): proposta di avviare come root e scendere di privilegi con `setpriv` nell'entrypoint; da decidere con ADR in M0.
|
||||
4. Varianti `_FILE` definite solo per `KHAEMHAT_SYSTEM_DB` e `KHAEMHAT_SUPERUSER_*`: proposta di estenderle a tutte le variabili sensibili (incluso `KHAEMHAT_SECRET_KEY`).
|
||||
5. Salute: la specifica ha `/health/live` e `/health`; `/health/ready` e le metriche sono da definire.
|
||||
6. Tag e doppia build: `publish-image.sh` (Appendice D) crea il tag git, ma con `release.yml` sui tag `v*` l'immagine verrebbe costruita due volte. Proposta: lo script non crea tag, oppure `release.yml` salta le versioni già nel registro.
|
||||
7. Formato tag: tag git `vX.Y.Z`, tag immagine `X.Y.Z` (senza `v`).
|
||||
8. Icona versionata: `build.sh` deve produrre PNG, serve un rasterizzatore; proposta: generarla sulla macchina di sviluppo e committarla prima del rilascio.
|
||||
3. `PUID`/`PGID` e utente non root (§16.1): proposta di avviare come root e scendere di privilegi con `setpriv` nell'entrypoint; da decidere con ADR in M0. **Deciso in M0: ADR 0013.**
|
||||
4. Varianti `_FILE` definite solo per `KHAEMHAT_SYSTEM_DB` e `KHAEMHAT_SUPERUSER_*`: proposta di estenderle a tutte le variabili sensibili (incluso `KHAEMHAT_SECRET_KEY`). **Deciso in M0: ADR 0014.**
|
||||
5. Salute: la specifica ha `/health/live` e `/health`; `/health/ready` e le metriche sono da definire. **Deciso in M0: ADR 0012.**
|
||||
6. Tag e doppia build: `publish-image.sh` (Appendice D) crea il tag git, ma con `release.yml` sui tag `v*` l'immagine verrebbe costruita due volte. Proposta: lo script non crea tag, oppure `release.yml` salta le versioni già nel registro. **Deciso in M0: ADR 0015.**
|
||||
7. Formato tag: tag git `vX.Y.Z`, tag immagine `X.Y.Z` (senza `v`). **Deciso in M0: ADR 0015.**
|
||||
8. Icona versionata: `build.sh` deve produrre PNG, serve un rasterizzatore; proposta: generarla sulla macchina di sviluppo e committarla prima del rilascio. **Deciso in M0: ADR 0016.**
|
||||
9. Rotazione della password PostgreSQL: le connection string delle aziende sono cifrate per intero in `sys_companies`; serve una procedura di aggiornamento.
|
||||
10. Il mockup 085 mostra ancora `ghcr.io`: l'app mostrerà il registro Gitea (ADR 0009).
|
||||
11. Non definiti: schermata di attivazione TOTP, nome dell'impostazione "migra aziende all'avvio", recupero password del super utente senza SMTP, chi modifica le impostazioni di backup cloud (scritto: super utente), flusso di ripristino da backup logico.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# ADR 0012 - Endpoint di salute
|
||||
|
||||
- **Stato:** accettata
|
||||
- **Data:** 2026-11-11
|
||||
- **Modifica:** SPEC §16.1, §20 (M0); chiude il punto aperto 5 di `docs/STATUS.md` (issue #114)
|
||||
|
||||
## Contesto
|
||||
|
||||
SPEC nomina `/health/live` (usato da `HEALTHCHECK`, dal compose e dal template Unraid) e un endpoint `/health` di
|
||||
base in M0, ma non definisce la readiness né il contenuto delle risposte. Un controllo di liveness che dipende dal
|
||||
database fa riavviare il container quando il database è solo lento.
|
||||
|
||||
## Decisione
|
||||
|
||||
| Endpoint | Risposta | Significato |
|
||||
|---|---|---|
|
||||
| `GET /health/live` | `200 text/plain "live"` | il processo risponde. Non tocca database, cache né file. È l'unico usato da `HEALTHCHECK` e dal compose |
|
||||
| `GET /health/ready` | `200 "ready"` oppure `503 "starting"` | l'istanza può servire richieste: database di sistema raggiungibile, migrazioni di sistema applicate, bootstrap concluso. In M0 non ci sono dipendenze e risponde sempre `200`; i controlli si aggiungono in M1-M2 |
|
||||
| `GET /health` | `200 application/json` `{status, live, ready, version, revision}` | riepilogo per l'amministratore e per la pagina *Stato sistema*; `status` è `ok` o `starting` |
|
||||
|
||||
Regole:
|
||||
|
||||
- risposte **senza autenticazione** e **senza dati sensibili**: niente versioni dei componenti, connection string,
|
||||
nomi di aziende o percorsi. La versione del prodotto è pubblica (compare anche nella pagina di accesso);
|
||||
- la modalità manutenzione di un'azienda non cambia la salute dell'istanza;
|
||||
- le metriche (formato e percorso) si decidono in M2 con un ADR separato.
|
||||
|
||||
## Conseguenze
|
||||
|
||||
- `HealthEndpoints` in `Khaemhat.Web/Hosting` mappa i tre percorsi; i test web li chiamano su un host reale.
|
||||
- In M1-M2 la readiness legge lo stato di `StartupOrchestrator`; un orchestratore esterno (Kubernetes o simili)
|
||||
può usare `/health/ready` senza modifiche all'immagine.
|
||||
@@ -0,0 +1,32 @@
|
||||
# ADR 0013 - Utente non root con `PUID`/`PGID`
|
||||
|
||||
- **Stato:** accettata
|
||||
- **Data:** 2026-11-11
|
||||
- **Modifica:** SPEC §16.1, §16.4; chiude il punto aperto 3 di `docs/STATUS.md` (issue #114)
|
||||
|
||||
## Contesto
|
||||
|
||||
SPEC chiede un utente `app` non root e che i file in `/data` appartengano a `PUID`/`PGID` (99/100 su Unraid). Le
|
||||
immagini `mcr.microsoft.com/dotnet/aspnet:10.0` hanno già un utente `app` (UID 1654). Le alternative erano: avviare
|
||||
come root e cedere i privilegi nell'entrypoint, oppure avviare già come `app` e lasciare all'host la proprietà di
|
||||
`/data` (rendendo inutili `PUID`/`PGID`).
|
||||
|
||||
## Decisione
|
||||
|
||||
- Il container **parte come root** solo per la preparazione; `docker/entrypoint.sh`:
|
||||
1. legge `PUID`/`PGID` (predefiniti `1654`, l'utente `app` dell'immagine; i compose per Unraid passano `99`/`100`);
|
||||
2. allinea UID e GID di `app` con `usermod`/`groupmod` se diversi;
|
||||
3. crea `/data` se manca ed esegue `chown` **solo se** il proprietario della radice di `/data` non è già
|
||||
`PUID:PGID` (niente `chown -R` a ogni avvio su volumi grandi);
|
||||
4. avvia l'applicazione con `setpriv --reuid --regid --init-groups` (util-linux, già nell'immagine base): il
|
||||
processo .NET **non gira mai come root**.
|
||||
- Se il container è avviato già non root (`user:` nel compose, `--user`), l'entrypoint salta i passi 2-3 e avvia
|
||||
direttamente l'applicazione: anche questa configurazione è supportata.
|
||||
- `PUID=0` o `PGID=0` sono rifiutati con un messaggio esplicito.
|
||||
|
||||
## Conseguenze
|
||||
|
||||
- Funziona alla lettera con il template Unraid (variabili `PUID`/`PGID`) e con qualunque host Docker.
|
||||
- Nessun pacchetto aggiuntivo (`setpriv`, `usermod`, `groupmod` sono nella base Debian dell'immagine).
|
||||
- L'entrypoint è l'unico codice che gira come root; resta corto e senza logica applicativa (migrazioni e bootstrap
|
||||
stanno nel codice .NET).
|
||||
@@ -0,0 +1,28 @@
|
||||
# ADR 0014 - Varianti `_FILE` delle variabili sensibili
|
||||
|
||||
- **Stato:** accettata
|
||||
- **Data:** 2026-11-11
|
||||
- **Modifica:** SPEC §6; chiude il punto aperto 4 di `docs/STATUS.md` (issue #114)
|
||||
|
||||
## Contesto
|
||||
|
||||
SPEC prevede la variante `_FILE` (Docker secrets) solo per `KHAEMHAT_SYSTEM_DB` e `KHAEMHAT_SUPERUSER_*`. Altre
|
||||
variabili contengono segreti altrettanto delicati, a partire da `KHAEMHAT_SECRET_KEY`.
|
||||
|
||||
## Decisione
|
||||
|
||||
- Ammettono `_FILE` tutte le variabili sensibili: `KHAEMHAT_SYSTEM_DB`, `KHAEMHAT_DB_SERVER`,
|
||||
`KHAEMHAT_SECRET_KEY`, `KHAEMHAT_SECRET_KEY_NEW`, `KHAEMHAT_SUPERUSER`, `KHAEMHAT_SUPERUSER_PASSWORD`,
|
||||
`KHAEMHAT_SUPERUSER_EMAIL`, `KHAEMHAT_LICENSE`, `KHAEMHAT_REDIS`, `KHAEMHAT_SMTP_PASSWORD`,
|
||||
`KHAEMHAT_UPDATE_TOKEN`.
|
||||
- Una sola regola, in `EnvironmentConfigurationReader` (M1-M2): se esiste `X_FILE`, il valore di `X` è il contenuto
|
||||
del file senza il fine riga finale; `X` e `X_FILE` impostati insieme sono un **errore di configurazione** che ferma
|
||||
l'avvio con un messaggio esplicito; un file illeggibile è un errore.
|
||||
- La risoluzione la fa **l'applicazione**, non l'entrypoint: i segreti non vengono esportati nell'ambiente dei
|
||||
processi figli. L'entrypoint legge soltanto `KHAEMHAT_SYSTEM_DB` / `KHAEMHAT_SYSTEM_DB_FILE` per attendere il
|
||||
database (ne usa host e porta, mai la password).
|
||||
|
||||
## Conseguenze
|
||||
|
||||
- La wiki *Installazione-Docker* e `docs/DEPLOY.md` elencano le variabili con `_FILE` secondo questo ADR.
|
||||
- I test di `KhaemhatOptions` coprono: valore diretto, valore da file, entrambi (errore), file mancante (errore).
|
||||
@@ -0,0 +1,29 @@
|
||||
# ADR 0015 - Tag, versioni e pubblicazione dell'immagine
|
||||
|
||||
- **Stato:** accettata
|
||||
- **Data:** 2026-11-11
|
||||
- **Modifica:** SPEC §16.3, §16.5, Appendice D (con ADR 0009); chiude i punti aperti 6 e 7 di `docs/STATUS.md`
|
||||
(issue #114)
|
||||
|
||||
## Contesto
|
||||
|
||||
Appendice D fa creare il tag git a `publish-image.sh`; con ADR 0009 `release.yml` parte sui tag `v*` e costruisce a
|
||||
sua volta l'immagine: la stessa versione verrebbe costruita due volte. Il formato dei tag non era fissato.
|
||||
|
||||
## Decisione
|
||||
|
||||
- **Formato:** tag git `vX.Y.Z` (annotato, creato alla chiusura della milestone, E6); tag immagine `X.Y.Z` **senza
|
||||
`v`**, più `latest` come comodità (mai in produzione). Versioni di prova: `vX.Y.Z-rc.N` → immagine `X.Y.Z-rc.N`,
|
||||
senza `latest`.
|
||||
- **Percorso normale:** push del tag → `release.yml` sul runner Gitea: build, smoke test di `/health/live`, push nel
|
||||
registro pacchetti, release Gitea con le note dal `CHANGELOG.md`.
|
||||
- **Percorso alternativo:** `scripts/publish-image.sh vX.Y.Z` costruisce e pubblica dalla macchina di sviluppo e
|
||||
**non crea tag** git. Se in seguito si spinge il tag, `release.yml` vede che `X.Y.Z` è già nel registro
|
||||
(`GET /api/v1/packages/<owner>/container/khaemhat/<X.Y.Z>` → `200`), salta build e push e crea solo la release.
|
||||
- **Versione nel binario:** `/p:Version=X.Y.Z /p:SourceRevisionId=<sha>`; nelle build di sviluppo
|
||||
`Directory.Build.targets` calcola `X.Y.Z-dev` dall'ultimo tag e lo SHA corrente.
|
||||
|
||||
## Conseguenze
|
||||
|
||||
- Ogni versione si costruisce una volta sola, qualunque sia il percorso.
|
||||
- Il controllo aggiornamenti (§12.8, `GiteaPackagesClient`) confronta versioni SemVer senza `v`.
|
||||
@@ -0,0 +1,28 @@
|
||||
# ADR 0016 - Icona versionata generata sulla macchina di sviluppo
|
||||
|
||||
- **Stato:** accettata
|
||||
- **Data:** 2026-11-11
|
||||
- **Modifica:** SPEC §16.6 (con ADR 0009); chiude il punto aperto 8 di `docs/STATUS.md` (issue #114)
|
||||
|
||||
## Contesto
|
||||
|
||||
L'etichetta `net.unraid.docker.icon` e il template Unraid puntano a un PNG raggiungibile senza autenticazione (URL
|
||||
raw del repository pubblico, ADR 0009). `scripts/build.sh` genera la variante SVG `icon-v<major.minor>.svg` con una
|
||||
sostituzione di stringa, ma per il PNG serve un rasterizzatore, che l'applicazione non contiene né deve contenere
|
||||
(SPEC §1.2).
|
||||
|
||||
## Decisione
|
||||
|
||||
- `scripts/build.sh --icon` genera `assets/icon-v<major.minor>.svg` dal modello `assets/icon-v1.0.svg` e, se sulla
|
||||
macchina c'è un rasterizzatore, i PNG 128/256/512. Strumenti accettati, in ordine: `rsvg-convert` (librsvg),
|
||||
`inkscape`, `magick` (ImageMagick). Senza nessuno dei tre lo script genera solo l'SVG e lo dice.
|
||||
- I file generati si **committano su `main` prima** del tag che li usa.
|
||||
- Al build dell'immagine (`release.yml`, `publish-image.sh`) l'URL dell'icona è
|
||||
`.../raw/branch/main/assets/icon-v<major.minor>-256.png` se il file esiste nel repository, altrimenti
|
||||
`.../assets/icon-256.png`. Le versioni `0.x` usano `icon-256.png`: la fascia "v 0.x" non serve prima della 1.0.
|
||||
|
||||
## Conseguenze
|
||||
|
||||
- Nessuna dipendenza nell'immagine né nella CI per la grafica.
|
||||
- La checklist di chiusura milestone (`docs/DEVELOPMENT.md`) include la generazione dell'icona quando cambia
|
||||
`major.minor`.
|
||||
@@ -0,0 +1,25 @@
|
||||
# ADR 0017 - `restore-system.sh` incluso nell'immagine
|
||||
|
||||
- **Stato:** accettata
|
||||
- **Data:** 2026-11-11
|
||||
- **Modifica:** SPEC §13, §16.1 (con ADR 0010); chiude il punto aperto 1 di `docs/STATUS.md` (issue #114)
|
||||
|
||||
## Contesto
|
||||
|
||||
Il database di sistema si ripristina solo da riga di comando, con l'istanza ferma (`scripts/restore-system.sh`,
|
||||
SPEC §13). Con ADR 0010 l'unico artefatto distribuito è l'immagine: chi installa non ha il repository, e scaricare
|
||||
uno script a parte al momento del bisogno è fragile (versione diversa da quella installata).
|
||||
|
||||
## Decisione
|
||||
|
||||
- L'immagine contiene `/app/scripts/restore-system.sh`, copiato dal repository alla stessa versione dell'app.
|
||||
- Si usa con un container temporaneo sullo stesso volume e sulla stessa rete, con l'istanza ferma:
|
||||
`docker compose run --rm --entrypoint /app/scripts/restore-system.sh khaemhat <file-di-backup>`.
|
||||
- Lo script usa gli strumenti già presenti nell'immagine (`pg_restore` di `postgresql-client-17`, `curl`) e la
|
||||
configurazione del container (`KHAEMHAT_SYSTEM_DB`, `KHAEMHAT_SECRET_KEY`). La logica completa arriva in M12; in
|
||||
M0 è uno stub che spiega l'uso ed esce con errore.
|
||||
|
||||
## Conseguenze
|
||||
|
||||
- La wiki *Backup-e-ripristino* e *Aggiornamento* indicano il comando con `docker compose run`, non il download.
|
||||
- Nessun altro script di sviluppo entra nell'immagine.
|
||||
@@ -109,7 +109,7 @@ che non conosce. Il rollback dipende quindi dalle migrazioni:
|
||||
**Caso 2 — la nuova versione ha applicato migrazioni.**
|
||||
|
||||
1. Ferma l'applicazione: `docker compose stop khaemhat`.
|
||||
2. Ripristina il **database di sistema** dal backup fatto prima dell'aggiornamento con `scripts/restore-system.sh`
|
||||
2. Ripristina il **database di sistema** dal backup fatto prima dell'aggiornamento con `restore-system.sh` incluso nell'immagine
|
||||
(vedi [Backup e ripristino](Backup-e-ripristino#ripristino-del-database-di-sistema)).
|
||||
3. Ripristina i **database delle aziende** migrate, dagli stessi backup (con la procedura manuale `pg_restore`
|
||||
descritta in [Backup e ripristino](Backup-e-ripristino#procedura-manuale-equivalente), perché l'applicazione è
|
||||
|
||||
@@ -183,16 +183,19 @@ Khaemhat esegue un backup preventivo anche:
|
||||
## Ripristino del database di sistema
|
||||
|
||||
Il database di sistema non si ripristina dall'interfaccia (l'interfaccia stessa dipende da lui). Si usa lo script
|
||||
`scripts/restore-system.sh` del repository, **con l'istanza ferma**:
|
||||
`restore-system.sh`, incluso nell'immagine in `/app/scripts/`, **con l'istanza ferma**:
|
||||
|
||||
1. Ferma l'applicazione: `docker compose stop khaemhat` (PostgreSQL resta acceso).
|
||||
2. Esegui lo script indicando il file di backup del database di sistema. I parametri esatti sono documentati
|
||||
nell'intestazione dello script, che sarà scritto nella milestone M12.
|
||||
2. Esegui lo script in un container temporaneo, sullo stesso volume e sulla stessa rete, indicando il file di
|
||||
backup del database di sistema:
|
||||
```bash
|
||||
docker compose run --rm --entrypoint /app/scripts/restore-system.sh khaemhat /data/backups/<file-di-backup>
|
||||
```
|
||||
Lo script completo arriva con la milestone M12; fino ad allora spiega l'uso ed esce senza fare nulla.
|
||||
3. Riavvia: `docker compose start khaemhat`. All'avvio vengono applicate le eventuali migrazioni mancanti.
|
||||
4. Accedi come super utente e controlla **Stato sistema** e l'elenco delle aziende.
|
||||
|
||||
Lo script è uno strumento del repository e non è incluso nell'immagine: scaricalo da
|
||||
[`scripts/`](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/src/branch/main/scripts) sul server che esegue Docker.
|
||||
Lo script ha sempre la stessa versione dell'applicazione installata, quindi non va scaricato a parte (ADR 0017).
|
||||
|
||||
## Procedura manuale equivalente
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
> **Stato:** bozza · **Ultima revisione:** 2026-11-10
|
||||
> **Stato:** completa per 0.0.1 · **Ultima revisione:** 2026-11-11
|
||||
|
||||
Le novità di ogni versione sono nel file
|
||||
[`CHANGELOG.md`](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/src/branch/main/CHANGELOG.md) del repository
|
||||
@@ -11,7 +11,8 @@ Le novità di ogni versione sono nel file
|
||||
|
||||
| Versione | Data | Contenuto |
|
||||
|---|---|---|
|
||||
| *non rilasciata* | 2026-11-10 | Documentazione, specifica, mockup, wiki e pianificazione su Gitea. Nessun software ancora. |
|
||||
| 0.0.1 | 2026-11-11 | M0 — Bootstrap: struttura del codice, immagine Docker con pagina "in costruzione" ed endpoint di salute, compose, CI e rilascio su Gitea Actions. Nessuna funzione gestionale ancora. |
|
||||
| *preparazione* | 2026-11-10 | Documentazione, specifica, mockup, wiki e pianificazione su Gitea. Nessun software. |
|
||||
|
||||
Ogni immagine Docker pubblicata ha lo stesso numero di versione del tag git (senza la `v` iniziale), ad esempio
|
||||
`gitea.encke-hake.ts.net/balbosoft/khaemhat:0.1.0`. Prima di aggiornare leggi [Aggiornamento](Aggiornamento).
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Khaemhat
|
||||
|
||||
> **Stato:** bozza · **Ultima revisione:** 2026-11-10 · **Versione software:** non ancora rilasciata (sviluppo da avviare)
|
||||
> **Stato:** bozza · **Ultima revisione:** 2026-11-10 · **Versione software:** 0.0.1 (M0, pagina "in costruzione"; sviluppo in corso)
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -65,13 +65,14 @@ Regole pratiche:
|
||||
|
||||
### Il file compose
|
||||
|
||||
Il file definitivo è `deploy/docker-compose.yml` nel repository (sarà creato nella milestone M0). La struttura
|
||||
prevista è questa: applicazione, `postgres:17` e `redis:7` attivabile con un profilo.
|
||||
Il file è [`deploy/docker-compose.yml`](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/src/branch/main/deploy/docker-compose.yml)
|
||||
nel repository: applicazione, `postgres:17` e `redis:7` attivabile con un profilo. La versione dell'immagine si
|
||||
sceglie con `KHAEMHAT_VERSION` nel `.env`. In sintesi:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
khaemhat:
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:1.0.0
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:${KHAEMHAT_VERSION:-0.0.1}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
khaemhat-db: { condition: service_healthy }
|
||||
@@ -128,12 +129,12 @@ Note:
|
||||
## Demo autonoma con SQLite
|
||||
|
||||
Per provare Khaemhat senza PostgreSQL esiste `deploy/docker-compose.sqlite.yml`: un solo container, database di
|
||||
sistema e aziende come file SQLite nel volume `/data`, dati di esempio caricati al primo avvio. Struttura prevista:
|
||||
sistema e aziende come file SQLite nel volume `/data`, dati di esempio caricati al primo avvio. In sintesi:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
khaemhat:
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:1.0.0
|
||||
image: gitea.encke-hake.ts.net/balbosoft/khaemhat:${KHAEMHAT_VERSION:-0.0.1}
|
||||
ports: ["8080:8080"]
|
||||
environment:
|
||||
KHAEMHAT_SYSTEM_DB: sqlite:///data/system.db
|
||||
@@ -189,7 +190,7 @@ obbligatoria, termina con un messaggio che indica quale.
|
||||
| `KHAEMHAT_UPDATE_FEED` | no | `https://gitea.encke-hake.ts.net/api/v1/packages/BalboSoft?type=container&q=khaemhat` | API dei pacchetti Gitea per il controllo aggiornamenti |
|
||||
| `KHAEMHAT_UPDATE_TOKEN` | no | token Gitea in sola lettura | solo se il pacchetto non è pubblico |
|
||||
| `TZ` | no | `Europe/Rome` | fuso orario |
|
||||
| `PUID` / `PGID` | no | `99` / `100` | utente e gruppo proprietari dei file in `/data` |
|
||||
| `PUID` / `PGID` | no | `1654` / `1654` (Unraid: `99` / `100`) | utente e gruppo proprietari dei file in `/data`; l'applicazione non gira mai come root |
|
||||
|
||||
Le variabili del super utente e della prima azienda sono lette solo al primo avvio (quando le tabelle
|
||||
corrispondenti sono vuote): cambiarle dopo non ha effetto. `KHAEMHAT_TEST_PG` e `KHAEMHAT_TEST_REDIS` servono solo
|
||||
@@ -198,8 +199,11 @@ ai test automatici e non vanno impostate in un'installazione.
|
||||
## Docker secrets
|
||||
|
||||
Per non scrivere le password in chiaro nel file compose, le variabili sensibili ammettono la variante `_FILE`: invece
|
||||
del valore contengono il percorso di un file da cui leggerlo. La specifica la prevede per `KHAEMHAT_SYSTEM_DB` e per
|
||||
le variabili `KHAEMHAT_SUPERUSER_*`; l'elenco completo delle variabili che la accettano sarà fissato in sviluppo.
|
||||
del valore contengono il percorso di un file da cui leggerlo. La accettano tutte le variabili sensibili: `KHAEMHAT_SYSTEM_DB`,
|
||||
`KHAEMHAT_DB_SERVER`, `KHAEMHAT_SECRET_KEY`, `KHAEMHAT_SECRET_KEY_NEW`, `KHAEMHAT_SUPERUSER`,
|
||||
`KHAEMHAT_SUPERUSER_PASSWORD`, `KHAEMHAT_SUPERUSER_EMAIL`, `KHAEMHAT_LICENSE`, `KHAEMHAT_REDIS`,
|
||||
`KHAEMHAT_SMTP_PASSWORD`, `KHAEMHAT_UPDATE_TOKEN`. Il valore è il contenuto del file senza il fine riga finale;
|
||||
impostare insieme `X` e `X_FILE` è un errore che ferma l'avvio.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
||||
@@ -30,8 +30,8 @@ Il lavoro di dettaglio è nelle issue di Gitea, raggruppate per
|
||||
|
||||
## Stato attuale
|
||||
|
||||
La documentazione e la pianificazione sono pronte (2026-11-10). Lo sviluppo parte dalla milestone M0 dopo il via
|
||||
del titolare del progetto. Lo stato aggiornato è in
|
||||
Sviluppo avviato il 2026-11-11. M0 consegna la versione 0.0.1 (struttura, immagine Docker, CI); poi si prosegue
|
||||
milestone dopo milestone, a partire da M1 — Fondamenta dati. Lo stato aggiornato è in
|
||||
[`docs/STATUS.md`](https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/src/branch/main/docs/STATUS.md).
|
||||
|
||||
## Pagine correlate
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "10.0.100",
|
||||
"rollForward": "latestFeature",
|
||||
"allowPrerelease": false
|
||||
}
|
||||
}
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the solution with warnings as errors (SPEC §19).
|
||||
# scripts/build.sh [-c Debug|Release] build
|
||||
# scripts/build.sh --icon [X.Y] also generate the versioned icon (ADR 0016); X.Y from the last tag
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
configuration=Release
|
||||
icon=""
|
||||
while (( $# > 0 )); do
|
||||
case "$1" in
|
||||
-c | --configuration) configuration="${2:?manca la configurazione}"; shift 2 ;;
|
||||
--icon)
|
||||
if [[ "${2:-}" =~ ^[0-9]+\.[0-9]+$ ]]; then icon="$2"; shift 2; else icon="auto"; shift; fi ;;
|
||||
-h | --help) sed -n '2,5p' "$0"; exit 0 ;;
|
||||
*) echo "argomento sconosciuto: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Generates assets/icon-v<X.Y>.svg from the template by string replacement, then the PNGs if a rasterizer exists.
|
||||
generate_icon() {
|
||||
local version="$1" svg png size tool=""
|
||||
if [[ "$version" == "auto" ]]; then
|
||||
version="$(git describe --tags --match 'v[0-9]*' --abbrev=0 2>/dev/null || true)"
|
||||
[[ -n "$version" ]] || { echo "nessun tag vX.Y.Z: indica la versione, es. --icon 1.0" >&2; exit 2; }
|
||||
version="${version#v}"
|
||||
version="${version%.*}"
|
||||
fi
|
||||
|
||||
svg="assets/icon-v${version}.svg"
|
||||
if [[ "$version" != "1.0" ]]; then
|
||||
sed "s/v 1\.0/v ${version}/" assets/icon-v1.0.svg > "$svg"
|
||||
grep -q "v ${version}" "$svg" || { echo "il modello assets/icon-v1.0.svg non contiene il testo 'v 1.0'" >&2; exit 1; }
|
||||
fi
|
||||
echo "icona: $svg"
|
||||
|
||||
for candidate in rsvg-convert inkscape magick; do
|
||||
if command -v "$candidate" > /dev/null 2>&1; then tool="$candidate"; break; fi
|
||||
done
|
||||
if [[ -z "$tool" ]]; then
|
||||
echo "nessun rasterizzatore (rsvg-convert, inkscape, magick): genera i PNG su una macchina che ne ha uno (ADR 0016)." >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
for size in 128 256 512; do
|
||||
png="assets/icon-v${version}-${size}.png"
|
||||
case "$tool" in
|
||||
rsvg-convert) rsvg-convert -w "$size" -h "$size" -o "$png" "$svg" ;;
|
||||
inkscape) inkscape "$svg" --export-type=png --export-filename="$png" -w "$size" -h "$size" > /dev/null ;;
|
||||
magick) magick -background none -density 384 "$svg" -resize "${size}x${size}" "$png" ;;
|
||||
esac
|
||||
echo "icona: $png ($tool)"
|
||||
done
|
||||
echo "Committa i file generati su main prima del tag che li usa (ADR 0016)."
|
||||
}
|
||||
|
||||
bash scripts/check-packages.sh
|
||||
dotnet build Khaemhat.sln -c "$configuration" -warnaserror
|
||||
|
||||
if [[ -n "$icon" ]]; then
|
||||
generate_icon "$icon"
|
||||
fi
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
# Package allowlist (SPEC §1.2, ADR 0002). Fails when an MSBuild file references a package that is not allowed, or an
|
||||
# allowed package outside its project. The architecture tests check the same rules; this script runs before any build
|
||||
# (Dockerfile, CI) so a forbidden package never gets restored.
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
# package -> where it may be referenced (a project file name, or "tests/" for any test project)
|
||||
allowed_in() {
|
||||
case "$1" in
|
||||
Npgsql) echo "src/Khaemhat.Data.PostgreSql/Khaemhat.Data.PostgreSql.csproj" ;;
|
||||
Microsoft.Data.Sqlite) echo "src/Khaemhat.Data.Sqlite/Khaemhat.Data.Sqlite.csproj" ;;
|
||||
Microsoft.NET.Test.Sdk | MSTest) echo "tests/" ;;
|
||||
*) echo "" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Prints "<file> <package>" for each element of the given kind (PackageReference, PackageVersion).
|
||||
references() {
|
||||
local element="$1" file
|
||||
while IFS= read -r file; do
|
||||
file="${file#./}"
|
||||
grep -oE "<${element}[[:space:]]+(Include|Update)=\"[^\"]+\"" "$file" \
|
||||
| sed -E 's/.*="([^"]+)"/\1/' \
|
||||
| while IFS= read -r package; do printf '%s %s\n' "$file" "$package"; done || true
|
||||
done < <(find . \( -name bin -o -name obj -o -name .git -o -name .claude -o -name out \) -prune -o \
|
||||
-type f \( -name '*.csproj' -o -name '*.props' -o -name '*.targets' \) -print | sort)
|
||||
}
|
||||
|
||||
errors=0
|
||||
checked=0
|
||||
while read -r file package; do
|
||||
checked=$((checked + 1))
|
||||
where="$(allowed_in "$package")"
|
||||
if [[ -z "$where" ]]; then
|
||||
echo "ERRORE: $file: il pacchetto $package non è nell'allowlist (SPEC §1.2)." >&2
|
||||
errors=$((errors + 1))
|
||||
elif [[ "$where" == "tests/" && "$file" != tests/* ]]; then
|
||||
echo "ERRORE: $file: $package è ammesso solo nei progetti di test." >&2
|
||||
errors=$((errors + 1))
|
||||
elif [[ "$where" != "tests/" && "$file" != "$where" ]]; then
|
||||
echo "ERRORE: $file: $package è ammesso solo in $where." >&2
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
done < <(references PackageReference)
|
||||
|
||||
while read -r file package; do
|
||||
if [[ -z "$(allowed_in "$package")" ]]; then
|
||||
echo "ERRORE: $file: versione centrale per $package, che non è nell'allowlist." >&2
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
done < <(references PackageVersion)
|
||||
|
||||
if (( errors > 0 )); then
|
||||
echo "check-packages: $errors violazioni." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "check-packages: OK ($checked riferimenti a pacchetti, tutti ammessi)."
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates docs/DATA-MODEL.md from the entity maps (SPEC §18).
|
||||
# scripts/gen-datamodel.sh
|
||||
# Stub: completed in milestone M1 (SPEC §20). Until then it explains what it will do and exits with an error.
|
||||
set -euo pipefail
|
||||
|
||||
echo "gen-datamodel.sh: non ancora disponibile, arriva con la milestone M1." >&2
|
||||
echo "Uso previsto: scripts/gen-datamodel.sh" >&2
|
||||
exit 1
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Creates a new numbered migration for the system or company schema (SPEC §5.3).
|
||||
# scripts/new-migration.sh <system|company> <descrizione-breve>
|
||||
# Stub: completed in milestone M1 (SPEC §20). Until then it explains what it will do and exits with an error.
|
||||
set -euo pipefail
|
||||
|
||||
echo "new-migration.sh: non ancora disponibile, arriva con la milestone M1." >&2
|
||||
echo "Uso previsto: scripts/new-migration.sh <system|company> <descrizione-breve>" >&2
|
||||
exit 1
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the image on this machine and pushes it to the Gitea package registry (ADR 0009, ADR 0015). The normal path
|
||||
# is release.yml on a vX.Y.Z tag; use this when the runner is not available. It does NOT create git tags: pushing the
|
||||
# tag later makes release.yml find the version in the registry and only create the release.
|
||||
#
|
||||
# scripts/publish-image.sh vX.Y.Z [--arm64] [--force]
|
||||
#
|
||||
# Environment: GITEA_TOKEN (required, scope write:package), GITEA_URL (https://gitea.encke-hake.ts.net),
|
||||
# GITEA_OWNER (BalboSoft), GITEA_USER (login of the token owner; defaults to GITEA_OWNER).
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
tag="${1:-}"
|
||||
[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]] || { echo "uso: publish-image.sh vX.Y.Z [--arm64] [--force]" >&2; exit 2; }
|
||||
shift
|
||||
platforms="linux/amd64"
|
||||
force=false
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--arm64) platforms="linux/amd64,linux/arm64" ;;
|
||||
--force) force=true ;;
|
||||
*) echo "argomento sconosciuto: $arg" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
gitea_url="${GITEA_URL:-https://gitea.encke-hake.ts.net}"
|
||||
gitea_url="${gitea_url%/}"
|
||||
registry="${gitea_url#https://}"
|
||||
registry="${registry#http://}"
|
||||
owner="${GITEA_OWNER:-BalboSoft}"
|
||||
owner_lc="$(printf '%s' "$owner" | tr '[:upper:]' '[:lower:]')"
|
||||
image="$registry/$owner_lc/khaemhat"
|
||||
version="${tag#v}"
|
||||
sha="$(git rev-parse --short HEAD)"
|
||||
token="${GITEA_TOKEN:?imposta GITEA_TOKEN (permesso write:package)}"
|
||||
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
echo "ATTENZIONE: ci sono modifiche non committate; l'immagine riporterà lo SHA $sha." >&2
|
||||
fi
|
||||
|
||||
status="$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $token" \
|
||||
"$gitea_url/api/v1/packages/$owner/container/khaemhat/$version")"
|
||||
if [[ "$status" == "200" && "$force" != true ]]; then
|
||||
echo "La versione $version è già nel registro: niente da fare (usa --force per sovrascriverla)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Versioned icon for Unraid if committed, otherwise the plain one (ADR 0016).
|
||||
major_minor="${version%%-*}"
|
||||
major_minor="${major_minor%.*}"
|
||||
icon_url="$gitea_url/$owner/Khaemhat/raw/branch/main/assets/icon-256.png"
|
||||
if git cat-file -e "origin/main:assets/icon-v${major_minor}-256.png" 2>/dev/null; then
|
||||
icon_url="$gitea_url/$owner/Khaemhat/raw/branch/main/assets/icon-v${major_minor}-256.png"
|
||||
fi
|
||||
|
||||
tags=(-t "$image:$version")
|
||||
[[ "$version" == *-* ]] || tags+=(-t "$image:latest")
|
||||
|
||||
printf '%s' "$token" | docker login "$registry" -u "${GITEA_USER:-$owner}" --password-stdin
|
||||
docker buildx build --platform "$platforms" -f docker/Dockerfile \
|
||||
--build-arg VERSION="$version" \
|
||||
--build-arg GIT_SHA="$sha" \
|
||||
--build-arg CREATED="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
--build-arg SOURCE_URL="$gitea_url/$owner/Khaemhat" \
|
||||
--build-arg ICON_URL="$icon_url" \
|
||||
"${tags[@]}" --push .
|
||||
|
||||
echo "Pubblicata $image:$version ($platforms)."
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Publishes docs/wiki/ to the Gitea wiki (Khaemhat.wiki.git), the same job as .gitea/workflows/wiki.yml.
|
||||
# The wiki becomes an exact copy of docs/wiki/: pages removed here are removed there.
|
||||
#
|
||||
# Environment: GITEA_URL (https://gitea.encke-hake.ts.net), GITEA_OWNER (BalboSoft); GITEA_TOKEN is optional (without
|
||||
# it git uses the credentials already configured on this machine). WIKI_REMOTE overrides the whole URL.
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
gitea_url="${GITEA_URL:-https://gitea.encke-hake.ts.net}"
|
||||
remote="${WIKI_REMOTE:-${gitea_url%/}/${GITEA_OWNER:-BalboSoft}/Khaemhat.wiki.git}"
|
||||
sha="$(git rev-parse --short HEAD)"
|
||||
|
||||
auth=()
|
||||
if [[ -n "${GITEA_TOKEN:-}" ]]; then
|
||||
auth=(-c "http.extraheader=Authorization: basic $(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 -w0)")
|
||||
fi
|
||||
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
git "${auth[@]}" clone -q --depth 1 "$remote" "$work/wiki"
|
||||
find "$work/wiki" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
cp -R docs/wiki/. "$work/wiki/"
|
||||
|
||||
cd "$work/wiki"
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "Wiki già allineata a docs/wiki ($sha)."
|
||||
exit 0
|
||||
fi
|
||||
git -c user.name="${GIT_AUTHOR_NAME:-Khaemhat wiki}" -c user.email="${GIT_AUTHOR_EMAIL:-wiki@khaemhat.invalid}" \
|
||||
commit -q -m "docs(wiki): sync from $sha"
|
||||
git "${auth[@]}" push -q origin HEAD
|
||||
echo "Wiki pubblicata da docs/wiki ($sha): $(git diff --stat HEAD~1 | tail -n 1)"
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restores the system database from a backup with the instance stopped (SPEC §13, ADR 0017). Shipped in the image as /app/scripts/restore-system.sh.
|
||||
# docker compose run --rm --entrypoint /app/scripts/restore-system.sh khaemhat <file-di-backup>
|
||||
# Stub: completed in milestone M12 (SPEC §20). Until then it explains what it will do and exits with an error.
|
||||
set -euo pipefail
|
||||
|
||||
echo "restore-system.sh: non ancora disponibile, arriva con la milestone M12." >&2
|
||||
echo "Uso previsto: docker compose run --rm --entrypoint /app/scripts/restore-system.sh khaemhat <file-di-backup>" >&2
|
||||
exit 1
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Starts Khaemhat locally on http://localhost:5080 with SQLite in .data/dev (ignored by git).
|
||||
# Any KHAEMHAT_* variable already set in the shell wins over the defaults below.
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
data_dir="$root/.data/dev"
|
||||
mkdir -p "$data_dir"
|
||||
|
||||
export ASPNETCORE_ENVIRONMENT="${ASPNETCORE_ENVIRONMENT:-Development}"
|
||||
export KHAEMHAT_DATA_DIR="${KHAEMHAT_DATA_DIR:-$data_dir}"
|
||||
export KHAEMHAT_SYSTEM_DB="${KHAEMHAT_SYSTEM_DB:-sqlite://$data_dir/system.db}"
|
||||
# Development-only key: never use it outside this script.
|
||||
export KHAEMHAT_SECRET_KEY="${KHAEMHAT_SECRET_KEY:-a2hhZW1oYXQtZGV2ZWxvcG1lbnQtb25seS1ub3QtYS1zZWNyZXQ=}"
|
||||
export KHAEMHAT_SUPERUSER="${KHAEMHAT_SUPERUSER:-root}"
|
||||
export KHAEMHAT_SUPERUSER_PASSWORD="${KHAEMHAT_SUPERUSER_PASSWORD:-Khaemhat-dev-1}"
|
||||
export KHAEMHAT_COMPANY_CODE="${KHAEMHAT_COMPANY_CODE:-DEMO}"
|
||||
export KHAEMHAT_COMPANY_NAME="${KHAEMHAT_COMPANY_NAME:-Khaemhat Demo S.r.l.}"
|
||||
export KHAEMHAT_LICENSE_MODE="${KHAEMHAT_LICENSE_MODE:-test}"
|
||||
export KHAEMHAT_SEED_DEMO="${KHAEMHAT_SEED_DEMO:-true}"
|
||||
|
||||
echo "Khaemhat in sviluppo: http://localhost:5080 (dati in $KHAEMHAT_DATA_DIR)"
|
||||
exec dotnet run --project src/Khaemhat.Web -- --urls http://localhost:5080 "$@"
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Loads base tables and demo data into a company database (SPEC §15).
|
||||
# scripts/seed.sh --base | --demo [--scale N] [--company CODE]
|
||||
# Stub: completed in milestone M4 (SPEC §20). Until then it explains what it will do and exits with an error.
|
||||
set -euo pipefail
|
||||
|
||||
echo "seed.sh: non ancora disponibile, arriva con la milestone M4." >&2
|
||||
echo "Uso previsto: scripts/seed.sh --base | --demo [--scale N] [--company CODE]" >&2
|
||||
exit 1
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs every test (SPEC §20). SQLite always; PostgreSQL when KHAEMHAT_TEST_PG is set
|
||||
# (e.g. postgres://khaemhat:secret@localhost:5432/postgres); Redis when KHAEMHAT_TEST_REDIS is set.
|
||||
# Extra arguments go to "dotnet test", e.g. scripts/test.sh --filter FullyQualifiedName~Health
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
export KHAEMHAT_LICENSE_MODE=test
|
||||
echo "PostgreSQL: ${KHAEMHAT_TEST_PG:+attivo}${KHAEMHAT_TEST_PG:-non configurato (KHAEMHAT_TEST_PG), test saltati}"
|
||||
echo "Redis: ${KHAEMHAT_TEST_REDIS:+attivo}${KHAEMHAT_TEST_REDIS:-non configurato (KHAEMHAT_TEST_REDIS), test saltati}"
|
||||
|
||||
bash scripts/check-packages.sh
|
||||
dotnet test Khaemhat.sln -c Release "$@"
|
||||
@@ -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 |
@@ -0,0 +1,11 @@
|
||||
<Project>
|
||||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
|
||||
<!-- Test projects: MSTest only (SPEC §1.2). -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="MSTest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Application.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Application/Khaemhat.Application.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Khaemhat.Application.Tests;
|
||||
|
||||
/// <summary>Keeps the test project runnable until the milestone that fills it (see docs/STATUS.md).</summary>
|
||||
[TestClass]
|
||||
public sealed class ProjectSmokeTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestedAssembly_IsKhaemhat() =>
|
||||
StringAssert.StartsWith(typeof(ProjectSmokeTests).Assembly.GetName().Name, "Khaemhat.");
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Khaemhat.Core.Tests.Architecture;
|
||||
|
||||
/// <summary>
|
||||
/// Project dependency rules of SPEC §3 and the package allowlist of SPEC §1.2 (ADR 0002). They read the project
|
||||
/// files, so a forbidden reference fails here before anyone builds on it.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public sealed class DependencyRulesTests
|
||||
{
|
||||
// What each production project may reference: exactly SPEC §3.
|
||||
private static readonly Dictionary<string, string[]> AllowedReferences = new(StringComparer.Ordinal)
|
||||
{
|
||||
["Khaemhat.Core"] = [],
|
||||
["Khaemhat.Fiscal.Abstractions"] = ["Khaemhat.Core"],
|
||||
["Khaemhat.Fiscal.Italy"] = ["Khaemhat.Core", "Khaemhat.Fiscal.Abstractions", "Khaemhat.Infrastructure"],
|
||||
["Khaemhat.Data"] = ["Khaemhat.Core"],
|
||||
["Khaemhat.Data.Sqlite"] = ["Khaemhat.Data"],
|
||||
["Khaemhat.Data.PostgreSql"] = ["Khaemhat.Data"],
|
||||
["Khaemhat.Infrastructure"] = ["Khaemhat.Core", "Khaemhat.Data"],
|
||||
["Khaemhat.Application"] = ["Khaemhat.Core", "Khaemhat.Data", "Khaemhat.Infrastructure", "Khaemhat.Fiscal.Abstractions"],
|
||||
["Khaemhat.Web"] = ["Khaemhat.Application", "Khaemhat.Data.Sqlite", "Khaemhat.Data.PostgreSql", "Khaemhat.Fiscal.Italy"],
|
||||
["Khaemhat.LicenseTool"] = ["Khaemhat.Core", "Khaemhat.Infrastructure"],
|
||||
};
|
||||
|
||||
// The only packages, and where each may be referenced.
|
||||
private static readonly Dictionary<string, Func<string, bool>> AllowedPackages = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["Npgsql"] = file => Name(file) == "Khaemhat.Data.PostgreSql",
|
||||
["Microsoft.Data.Sqlite"] = file => Name(file) == "Khaemhat.Data.Sqlite",
|
||||
["Microsoft.NET.Test.Sdk"] = IsTestFile,
|
||||
["MSTest"] = IsTestFile,
|
||||
};
|
||||
|
||||
[TestMethod]
|
||||
public void EveryProductionProject_HasDependencyRules()
|
||||
{
|
||||
var unknown = RepositoryLayout.Projects().Keys
|
||||
.Where(name => !name.EndsWith(".Tests", StringComparison.Ordinal) && !AllowedReferences.ContainsKey(name))
|
||||
.ToList();
|
||||
|
||||
Assert.IsEmpty(unknown, "Projects without dependency rules (add them to SPEC §3 and this test): " + string.Join(", ", unknown));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ProductionProjects_ReferenceOnlyWhatSpecSection3Allows()
|
||||
{
|
||||
var violations = new List<string>();
|
||||
foreach (var (name, file) in RepositoryLayout.Projects())
|
||||
{
|
||||
if (!AllowedReferences.TryGetValue(name, out var allowed))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var reference in RepositoryLayout.ProjectReferences(file).Except(allowed, StringComparer.Ordinal))
|
||||
{
|
||||
violations.Add($"{name} -> {reference}");
|
||||
}
|
||||
}
|
||||
|
||||
Assert.IsEmpty(violations, "Forbidden project references: " + string.Join("; ", violations));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestProjects_ReferenceOnlyKhaemhatProjects()
|
||||
{
|
||||
var violations = RepositoryLayout.Projects()
|
||||
.Where(p => p.Key.EndsWith(".Tests", StringComparison.Ordinal))
|
||||
.SelectMany(p => RepositoryLayout.ProjectReferences(p.Value)
|
||||
.Where(r => !r.StartsWith("Khaemhat.", StringComparison.Ordinal))
|
||||
.Select(r => $"{p.Key} -> {r}"))
|
||||
.ToList();
|
||||
|
||||
Assert.IsEmpty(violations, string.Join("; ", violations));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Packages_AreOnTheAllowlistAndInTheirProjects()
|
||||
{
|
||||
var violations = new List<string>();
|
||||
foreach (var file in RepositoryLayout.MsBuildFiles())
|
||||
{
|
||||
foreach (var package in RepositoryLayout.PackageReferences(file))
|
||||
{
|
||||
if (!AllowedPackages.TryGetValue(package, out var allowedIn))
|
||||
{
|
||||
violations.Add($"{RepositoryLayout.Relative(file)}: {package} is not on the allowlist (SPEC §1.2)");
|
||||
}
|
||||
else if (!allowedIn(file))
|
||||
{
|
||||
violations.Add($"{RepositoryLayout.Relative(file)}: {package} is not allowed in this project");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.IsEmpty(violations, string.Join(Environment.NewLine, violations));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CentralPackageVersions_ListOnlyAllowedPackages()
|
||||
{
|
||||
var file = Path.Combine(RepositoryLayout.Root, "Directory.Packages.props");
|
||||
var extra = XDocument.Load(file).Descendants()
|
||||
.Where(e => e.Name.LocalName == "PackageVersion")
|
||||
.Select(e => (string?)e.Attribute("Include") ?? string.Empty)
|
||||
.Where(p => !AllowedPackages.ContainsKey(p))
|
||||
.ToList();
|
||||
|
||||
Assert.IsEmpty(extra, "Directory.Packages.props declares packages outside the allowlist: " + string.Join(", ", extra));
|
||||
}
|
||||
|
||||
private static string Name(string file) => Path.GetFileNameWithoutExtension(file);
|
||||
|
||||
private static bool IsTestFile(string file) => RepositoryLayout.Relative(file).StartsWith("tests/", StringComparison.Ordinal);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Khaemhat.Core.Tests.Architecture;
|
||||
|
||||
/// <summary>Reads the solution's project files from the repository, without loading the projects.</summary>
|
||||
internal static class RepositoryLayout
|
||||
{
|
||||
private static readonly Lazy<string> RootPath = new(FindRoot);
|
||||
|
||||
/// <summary>The repository root (the folder holding <c>Khaemhat.sln</c>).</summary>
|
||||
public static string Root => RootPath.Value;
|
||||
|
||||
/// <summary>Every project file under <c>src/</c>, <c>tests/</c> and <c>tools/</c>, by project name.</summary>
|
||||
public static IReadOnlyDictionary<string, string> Projects()
|
||||
{
|
||||
var result = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
foreach (var folder in new[] { "src", "tests", "tools" })
|
||||
{
|
||||
var path = Path.Combine(Root, folder);
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var file in Directory.EnumerateFiles(path, "*.csproj", SearchOption.AllDirectories))
|
||||
{
|
||||
if (!IsBuildOutput(file))
|
||||
{
|
||||
result[Path.GetFileNameWithoutExtension(file)] = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>Names of the projects referenced by a project file.</summary>
|
||||
public static IReadOnlySet<string> ProjectReferences(string projectFile) =>
|
||||
Includes(projectFile, "ProjectReference")
|
||||
.Select(include => Path.GetFileNameWithoutExtension(include.Replace('\\', '/')))
|
||||
.ToHashSet(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>Package ids referenced by a project or props file.</summary>
|
||||
public static IReadOnlySet<string> PackageReferences(string file) =>
|
||||
Includes(file, "PackageReference").ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>Every MSBuild file (projects, props, targets) of the repository that could declare packages.</summary>
|
||||
public static IEnumerable<string> MsBuildFiles() =>
|
||||
Directory.EnumerateFiles(Root, "*.*", SearchOption.AllDirectories)
|
||||
.Where(f => f.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase)
|
||||
|| f.EndsWith(".props", StringComparison.OrdinalIgnoreCase)
|
||||
|| f.EndsWith(".targets", StringComparison.OrdinalIgnoreCase))
|
||||
.Where(f => !IsBuildOutput(f) && !IsUnderIgnoredFolder(f));
|
||||
|
||||
/// <summary>The path of a file relative to the repository root, with forward slashes.</summary>
|
||||
public static string Relative(string file) => Path.GetRelativePath(Root, file).Replace('\\', '/');
|
||||
|
||||
private static IEnumerable<string> Includes(string file, string element) =>
|
||||
XDocument.Load(file).Descendants()
|
||||
.Where(e => e.Name.LocalName == element)
|
||||
.Select(e => (string?)e.Attribute("Include") ?? (string?)e.Attribute("Update") ?? string.Empty)
|
||||
.Where(s => s.Length > 0);
|
||||
|
||||
private static bool IsBuildOutput(string path)
|
||||
{
|
||||
var p = path.Replace('\\', '/');
|
||||
return p.Contains("/bin/", StringComparison.Ordinal) || p.Contains("/obj/", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static bool IsUnderIgnoredFolder(string path)
|
||||
{
|
||||
var relative = Relative(path);
|
||||
return relative.StartsWith(".git/", StringComparison.Ordinal)
|
||||
|| relative.StartsWith(".claude/", StringComparison.Ordinal)
|
||||
|| relative.StartsWith("out/", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string FindRoot()
|
||||
{
|
||||
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "Khaemhat.sln")))
|
||||
{
|
||||
dir = dir.Parent;
|
||||
}
|
||||
|
||||
return dir?.FullName ?? throw new InvalidOperationException("Repository root (Khaemhat.sln) not found.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Khaemhat.Core.Common;
|
||||
|
||||
namespace Khaemhat.Core.Tests.Common;
|
||||
|
||||
[TestClass]
|
||||
public sealed class ProductVersionTests
|
||||
{
|
||||
[TestMethod]
|
||||
[DataRow("1.2.3+abcdef1234567890", "1.2.3", "abcdef1", "1.2", "1.2.3+abcdef1")]
|
||||
[DataRow("0.1.0-dev+abc1234", "0.1.0-dev", "abc1234", "0.1", "0.1.0-dev+abc1234")]
|
||||
[DataRow("2.0.0", "2.0.0", "", "2.0", "2.0.0")]
|
||||
[DataRow("", "0.0.0-dev", "", "0.0", "0.0.0-dev")]
|
||||
[DataRow(null, "0.0.0-dev", "", "0.0", "0.0.0-dev")]
|
||||
public void Parse_ReadsVersionRevisionAndShortForms(string? input, string version, string revision, string majorMinor, string full)
|
||||
{
|
||||
var parsed = ProductVersion.Parse(input);
|
||||
|
||||
Assert.AreEqual(version, parsed.Version);
|
||||
Assert.AreEqual(revision, parsed.Revision);
|
||||
Assert.AreEqual(majorMinor, parsed.MajorMinor);
|
||||
Assert.AreEqual(full, parsed.Full);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FromAssembly_ReadsTheInformationalVersion()
|
||||
{
|
||||
var version = ProductVersion.FromAssembly(typeof(ProductVersion).Assembly);
|
||||
|
||||
Assert.IsFalse(string.IsNullOrEmpty(version.Version));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Core.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Core/Khaemhat.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Data.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Data/Khaemhat.Data.csproj" />
|
||||
<ProjectReference Include="../../src/Khaemhat.Data.Sqlite/Khaemhat.Data.Sqlite.csproj" />
|
||||
<ProjectReference Include="../../src/Khaemhat.Data.PostgreSql/Khaemhat.Data.PostgreSql.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Khaemhat.Data.Tests;
|
||||
|
||||
/// <summary>Keeps the test project runnable until the milestone that fills it (see docs/STATUS.md).</summary>
|
||||
[TestClass]
|
||||
public sealed class ProjectSmokeTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestedAssembly_IsKhaemhat() =>
|
||||
StringAssert.StartsWith(typeof(ProjectSmokeTests).Assembly.GetName().Name, "Khaemhat.");
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Fiscal.Italy.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Fiscal.Italy/Khaemhat.Fiscal.Italy.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Khaemhat.Fiscal.Italy.Tests;
|
||||
|
||||
/// <summary>Keeps the test project runnable until the milestone that fills it (see docs/STATUS.md).</summary>
|
||||
[TestClass]
|
||||
public sealed class ProjectSmokeTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestedAssembly_IsKhaemhat() =>
|
||||
StringAssert.StartsWith(typeof(ProjectSmokeTests).Assembly.GetName().Name, "Khaemhat.");
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Infrastructure.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Infrastructure/Khaemhat.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Khaemhat.Infrastructure.Tests;
|
||||
|
||||
/// <summary>Keeps the test project runnable until the milestone that fills it (see docs/STATUS.md).</summary>
|
||||
[TestClass]
|
||||
public sealed class ProjectSmokeTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestedAssembly_IsKhaemhat() =>
|
||||
StringAssert.StartsWith(typeof(ProjectSmokeTests).Assembly.GetName().Name, "Khaemhat.");
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using Khaemhat.Web.Hosting;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
||||
namespace Khaemhat.Web.Tests.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Starts the real host on a free loopback port (no test-host package: SPEC §1.2) and calls it over HTTP.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public sealed class HostTests
|
||||
{
|
||||
private static WebApplication? _app;
|
||||
private static HttpClient? _client;
|
||||
|
||||
[ClassInitialize]
|
||||
public static async Task StartAsync(TestContext context)
|
||||
{
|
||||
_app = KhaemhatApp.Build(["--urls", "http://127.0.0.1:0", "--environment", "Production"]);
|
||||
await _app.StartAsync(context.CancellationToken);
|
||||
_client = new HttpClient { BaseAddress = new Uri(_app.Urls.First()) };
|
||||
}
|
||||
|
||||
[ClassCleanup]
|
||||
public static async Task StopAsync()
|
||||
{
|
||||
_client?.Dispose();
|
||||
if (_app is not null)
|
||||
{
|
||||
await _app.StopAsync();
|
||||
await _app.DisposeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow("/health/live", "live")]
|
||||
[DataRow("/health/ready", "ready")]
|
||||
public async Task HealthProbes_AnswerOk(string path, string body)
|
||||
{
|
||||
using var response = await Client.GetAsync(new Uri(path, UriKind.Relative));
|
||||
|
||||
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.AreEqual(body, await response.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task Health_ReportsStatusAndVersion()
|
||||
{
|
||||
var report = await Client.GetFromJsonAsync<HealthEndpoints.HealthReport>(new Uri("/health", UriKind.Relative));
|
||||
|
||||
Assert.IsNotNull(report);
|
||||
Assert.AreEqual("ok", report.Status);
|
||||
Assert.IsTrue(report.Live);
|
||||
Assert.IsTrue(report.Ready);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(report.Version));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task HomePage_ShowsTheUnderConstructionPage()
|
||||
{
|
||||
var html = await Client.GetStringAsync(new Uri("/", UriKind.Relative));
|
||||
|
||||
StringAssert.Contains(html, "Khaemhat");
|
||||
StringAssert.Contains(html, "in costruzione");
|
||||
StringAssert.Contains(html, "lang=\"it\"");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task UnknownPage_AnswersNotFound()
|
||||
{
|
||||
using var response = await Client.GetAsync(new Uri("/does-not-exist", UriKind.Relative));
|
||||
|
||||
Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
|
||||
}
|
||||
|
||||
private static HttpClient Client => _client ?? throw new InvalidOperationException("Host not started.");
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Khaemhat.Web.Tests.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// The icons served by the app are copies of the official ones in <c>assets/</c> (SPEC §16.6): they must not drift.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public sealed class IconTests
|
||||
{
|
||||
[TestMethod]
|
||||
[DataRow("favicon.ico")]
|
||||
[DataRow("icon.svg")]
|
||||
[DataRow("icon-256.png")]
|
||||
[DataRow("icon-512.png")]
|
||||
public void ServedIcon_MatchesTheOfficialAsset(string file)
|
||||
{
|
||||
var root = FindRoot();
|
||||
var official = File.ReadAllBytes(Path.Combine(root, "assets", file));
|
||||
var served = File.ReadAllBytes(Path.Combine(root, "src", "Khaemhat.Web", "wwwroot", file));
|
||||
|
||||
CollectionAssert.AreEqual(official, served, $"wwwroot/{file} differs from assets/{file}: copy it again.");
|
||||
}
|
||||
|
||||
private static string FindRoot()
|
||||
{
|
||||
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "Khaemhat.sln")))
|
||||
{
|
||||
dir = dir.Parent;
|
||||
}
|
||||
|
||||
return dir?.FullName ?? throw new InvalidOperationException("Repository root (Khaemhat.sln) not found.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Khaemhat.Web.Hosting;
|
||||
|
||||
namespace Khaemhat.Web.Tests.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// KHAEMHAT_* variables read by the host (SPEC §6). Command-line keys feed the same configuration as environment
|
||||
/// variables, so the tests pass them as arguments instead of touching the process environment.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public sealed class InstanceVariablesTests
|
||||
{
|
||||
[TestMethod]
|
||||
public async Task LogLevel_SetsTheDefaultLevel()
|
||||
{
|
||||
await using var app = KhaemhatApp.Build(["--urls", "http://127.0.0.1:0", "--KHAEMHAT_LOG_LEVEL=warning"]);
|
||||
|
||||
Assert.AreEqual("Warning", app.Configuration["Logging:LogLevel:Default"]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LogLevel_RejectsAnUnknownValue()
|
||||
{
|
||||
var error = Assert.ThrowsExactly<InvalidOperationException>(
|
||||
() => KhaemhatApp.Build(["--urls", "http://127.0.0.1:0", "--KHAEMHAT_LOG_LEVEL=loud"]));
|
||||
|
||||
StringAssert.Contains(error.Message, "KHAEMHAT_LOG_LEVEL");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task Urls_AreTakenFromTheVariable()
|
||||
{
|
||||
await using var app = KhaemhatApp.Build(["--KHAEMHAT_URLS=http://127.0.0.1:0"]);
|
||||
|
||||
Assert.AreEqual("http://127.0.0.1:0", app.Configuration["urls"]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Khaemhat.Web.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Web/Khaemhat.Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Khaemhat.LicenseTool</RootNamespace>
|
||||
<!-- Developer tool, never shipped (ADR 0010). -->
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../src/Khaemhat.Infrastructure/Khaemhat.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user