refactor!: rename the project from Monitor to MoShiro

Namespaces, assemblies, projects and directories, the solution, binaries,
images, systemd units, config paths, environment variables, protocol method
names, the media type and the raw chunk magic all move to MoShiro/moshiro.
Existing data and deployments are not compatible and must be recreated.
Also fix the architecture tests after the solution layout change and make
the update tests independent of their order.
This commit is contained in:
justme committed 2026-10-07 01:49:04 +08:00
1 parent 17b35223aa
commit 83e5120377
309 files changed
+1505 -1499

No files matched your search

File renamed without changes.
@@ -3,7 +3,7 @@ using System.IO.Compression;
if (args.Length < 3)
{
Console.Error.WriteLine("usage: Monitor.Tar <source-directory> <archive-path> <executable-relative-path>...");
Console.Error.WriteLine("usage: MoShiro.Tar <source-directory> <archive-path> <executable-relative-path>...");
return 2;
}
+3 -3
View File
@@ -23,7 +23,7 @@ esac
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
registry="${ZOT_REGISTRY:-registry.oeo.one}"
repository="$registry/monitor-dev/monitor-$component"
repository="$registry/moshiro-dev/moshiro-$component"
work="$root/.release/main-amd64-build"
base_home="/home/justme/woodpecker/buildah-home/main-amd64-build-$component"
short_sha="${CI_COMMIT_SHA:0:12}"
@@ -44,12 +44,12 @@ export HOME="$base_home"
export BUILDAH_HOME="$base_home"
export REGISTRY_AUTH_FILE="$work/$component-auth.json"
context="$work/$component"
local_image="localhost/monitor-$component:main-amd64-check"
local_image="localhost/moshiro-$component:main-amd64-check"
python3 "$root/ci/stage-node-image.py" "$component" "$context"
buildah bud --layers --network host --tls-verify=true --arch amd64 \
--build-arg APP_VERSION=main \
--build-arg "MONITOR_TAG=$dev_tag" --build-arg "MONITOR_COMMIT=${CI_COMMIT_SHA:0:10}" --build-arg "MONITOR_BUILT_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--build-arg "MOSHIRO_TAG=$dev_tag" --build-arg "MOSHIRO_COMMIT=${CI_COMMIT_SHA:0:10}" --build-arg "MOSHIRO_BUILT_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-f "$context/Containerfile" \
-t "$local_image" "$context"
+1 -1
View File
@@ -11,7 +11,7 @@ version="${CI_COMMIT_TAG#v}"
registry="${ZOT_REGISTRY:-registry.oeo.one}"
scheme="${ZOT_SCHEME:-https}"
image="monitor/monitor-backend"
image="moshiro/moshiro-backend"
auth_file="$(mktemp)"
chmod 600 "$auth_file"
trap 'rm -f "$auth_file"' EXIT
+10 -10
View File
@@ -15,14 +15,14 @@ if ($version -ne $projectVersion) {
throw "Tag version $version does not match project version $projectVersion."
}
$tarProject = Join-Path $PSScriptRoot 'Monitor.Tar\Monitor.Tar.csproj'
$tarTool = Join-Path $PSScriptRoot 'Monitor.Tar\bin\Release\net10.0\Monitor.Tar.dll'
$tarProject = Join-Path $PSScriptRoot 'MoShiro.Tar\MoShiro.Tar.csproj'
$tarTool = Join-Path $PSScriptRoot 'MoShiro.Tar\bin\Release\net10.0\MoShiro.Tar.dll'
& dotnet build $tarProject -c Release --nologo
if ($LASTEXITCODE -ne 0) {
throw 'Could not build the cross-platform tar helper.'
}
$giteaBase = if ($env:GITEA_BASE) { $env:GITEA_BASE.TrimEnd('/') } else { 'http://localhost:3100' }
$netrc = Join-Path $env:TEMP ("monitor-gitea-$([guid]::NewGuid().ToString('N')).netrc")
$netrc = Join-Path $env:TEMP ("moshiro-gitea-$([guid]::NewGuid().ToString('N')).netrc")
$giteaHost = ([Uri]$giteaBase).Host
Set-Content -LiteralPath $netrc -Value "machine $giteaHost login justme password $($env:GITEA_TOKEN)" -Encoding ascii -NoNewline
@@ -61,11 +61,11 @@ try {
$stage = Join-Path $root ".release\stage\$($target.Rid)\$role"
$null = New-Item -ItemType Directory -Force -Path $stage
$extension = if ($target.Windows) { '.exe' } else { '' }
Copy-Item -LiteralPath (Join-Path (Join-Path $root ".release\publish\$($target.Rid)\$role") "monitor-$role$extension") -Destination $stage
Copy-Item -LiteralPath (Join-Path (Join-Path $root ".release\publish\$($target.Rid)\$role") "moshiro-$role$extension") -Destination $stage
Copy-Item -LiteralPath (Join-Path $root 'LICENSE') -Destination $stage
Copy-Item -LiteralPath (Join-Path $root "backend\$role\README.md") -Destination $stage
$executables = @("monitor-$role$extension")
$executables = @("moshiro-$role$extension")
if ($role -eq 'agent') {
$enrollName = if ($target.Windows) { 'fleet-enroll.exe' } else { 'fleet-enroll' }
Copy-Item -LiteralPath (Join-Path $enrollDirectory $enrollName) -Destination $stage
@@ -76,12 +76,12 @@ try {
$executables += 'install.sh'
$systemd = Join-Path $stage 'systemd'
$null = New-Item -ItemType Directory -Force -Path $systemd
Copy-Item -LiteralPath (Join-Path $root "packaging/systemd/monitor-$role.service") -Destination $systemd
Copy-Item -LiteralPath (Join-Path $root "packaging/systemd/moshiro-$role.service") -Destination $systemd
if ($role -eq 'probe') {
$openwrt = Join-Path $stage 'openwrt'
$null = New-Item -ItemType Directory -Force -Path $openwrt
Copy-Item -LiteralPath (Join-Path $root 'packaging/openwrt/monitor-probe.init') -Destination $openwrt
Copy-Item -LiteralPath (Join-Path $root 'packaging/openwrt/monitor.keep') -Destination $openwrt
Copy-Item -LiteralPath (Join-Path $root 'packaging/openwrt/moshiro-probe.init') -Destination $openwrt
Copy-Item -LiteralPath (Join-Path $root 'packaging/openwrt/moshiro.keep') -Destination $openwrt
}
}
elseif ($target.Os -eq 'macos') {
@@ -94,7 +94,7 @@ consumer install.
'@ | Set-Content -LiteralPath (Join-Path $stage 'MACOS-SECURITY.txt') -Encoding utf8
}
$archiveName = if ($target.Windows) { "monitor-$role-v$version-windows-$($target.Arch).zip" } else { "monitor-$role-v$version-$($target.Os)-$($target.Arch).tar.gz" }
$archiveName = if ($target.Windows) { "moshiro-$role-v$version-windows-$($target.Arch).zip" } else { "moshiro-$role-v$version-$($target.Os)-$($target.Arch).tar.gz" }
$archive = Join-Path $packageRoot $archiveName
if ($target.Windows) {
Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $archive -CompressionLevel Optimal -Force
@@ -115,7 +115,7 @@ consumer install.
param([string]$File, [string]$Base, [string]$PackageVersion, [string]$Netrc)
$ErrorActionPreference = 'Stop'
$name = [IO.Path]::GetFileName($File)
$url = "$Base/api/packages/justme/generic/monitor-node/$PackageVersion/$name"
$url = "$Base/api/packages/justme/generic/moshiro-node/$PackageVersion/$name"
$status = & curl.exe --silent --show-error --retry 3 --netrc-file $Netrc --upload-file $File --output NUL --write-out '%{http_code}' $url
if ($LASTEXITCODE -ne 0) {
throw "Gitea package upload failed for $name (curl exit $LASTEXITCODE)."
+21 -21
View File
@@ -16,7 +16,7 @@ gitea_host="${gitea_base#https://}"
gitea_host="${gitea_host#http://}"
gitea_host="${gitea_host%%/*}"
gitea_host="${gitea_host%%:*}"
api="$gitea_base/api/v1/repos/justme/MyMonitor"
api="$gitea_base/api/v1/repos/justme/MoShiro"
tmp="$(mktemp -d)"
netrc="$tmp/netrc"
release_json="$tmp/release.json"
@@ -26,8 +26,8 @@ printf 'machine %s login justme password %s\n' "$gitea_host" "$GITEA_TOKEN" > "$
chmod 600 "$netrc"
trap 'rm -rf "$tmp"' EXIT
release_body="Agent and Probe builds: Linux glibc and musl (x64, arm64), macOS (x64, arm64), and Windows (x64, arm64). Linux glibc Agent and Probe OCI images: registry.oeo.one/monitor/monitor-agent:$version and registry.oeo.one/monitor/monitor-probe:$version (linux/amd64 and linux/arm64). Backend OCI image: registry.oeo.one/monitor/monitor-backend:$version (linux/amd64 and linux/arm64). macOS binaries are not Developer ID signed or notarized."
payload="$(printf '{"tag_name":"%s","target_commitish":"%s","name":"MyMonitor %s","body":"%s","draft":false,"prerelease":false}' \
release_body="Agent and Probe builds: Linux glibc and musl (x64, arm64), macOS (x64, arm64), and Windows (x64, arm64). Linux glibc Agent and Probe OCI images: registry.oeo.one/moshiro/moshiro-agent:$version and registry.oeo.one/moshiro/moshiro-probe:$version (linux/amd64 and linux/arm64). Backend OCI image: registry.oeo.one/moshiro/moshiro-backend:$version (linux/amd64 and linux/arm64). macOS binaries are not Developer ID signed or notarized."
payload="$(printf '{"tag_name":"%s","target_commitish":"%s","name":"MoShiro %s","body":"%s","draft":false,"prerelease":false}' \
"$tag" "${CI_COMMIT_SHA:-}" "$tag" "$release_body")"
release_status="$(curl --silent --show-error --retry 3 --netrc-file "$netrc" \
--output "$release_json" --write-out '%{http_code}' "$api/releases/tags/$tag")"
@@ -60,28 +60,28 @@ curl --fail-with-body --silent --show-error --retry 3 --netrc-file "$netrc" \
"$api/releases/$release_id/assets" -o "$assets_json"
assets=(
"monitor-agent-v$version-linux-amd64.tar.gz"
"monitor-agent-v$version-linux-arm64.tar.gz"
"monitor-probe-v$version-linux-amd64.tar.gz"
"monitor-probe-v$version-linux-arm64.tar.gz"
"monitor-agent-v$version-linux-musl-amd64.tar.gz"
"monitor-probe-v$version-linux-musl-amd64.tar.gz"
"monitor-agent-v$version-linux-musl-arm64.tar.gz"
"monitor-probe-v$version-linux-musl-arm64.tar.gz"
"monitor-agent-v$version-macos-x64.tar.gz"
"monitor-probe-v$version-macos-x64.tar.gz"
"monitor-agent-v$version-macos-arm64.tar.gz"
"monitor-probe-v$version-macos-arm64.tar.gz"
"monitor-agent-v$version-windows-amd64.zip"
"monitor-agent-v$version-windows-arm64.zip"
"monitor-probe-v$version-windows-amd64.zip"
"monitor-probe-v$version-windows-arm64.zip"
"moshiro-agent-v$version-linux-amd64.tar.gz"
"moshiro-agent-v$version-linux-arm64.tar.gz"
"moshiro-probe-v$version-linux-amd64.tar.gz"
"moshiro-probe-v$version-linux-arm64.tar.gz"
"moshiro-agent-v$version-linux-musl-amd64.tar.gz"
"moshiro-probe-v$version-linux-musl-amd64.tar.gz"
"moshiro-agent-v$version-linux-musl-arm64.tar.gz"
"moshiro-probe-v$version-linux-musl-arm64.tar.gz"
"moshiro-agent-v$version-macos-x64.tar.gz"
"moshiro-probe-v$version-macos-x64.tar.gz"
"moshiro-agent-v$version-macos-arm64.tar.gz"
"moshiro-probe-v$version-macos-arm64.tar.gz"
"moshiro-agent-v$version-windows-amd64.zip"
"moshiro-agent-v$version-windows-arm64.zip"
"moshiro-probe-v$version-windows-amd64.zip"
"moshiro-probe-v$version-windows-arm64.zip"
)
upload_release_asset() {
local name="$1" file="$tmp/$1" upload_response="$tmp/$1.upload.json" status
curl --fail-with-body --silent --show-error --retry 3 --netrc-file "$netrc" \
"$gitea_base/api/packages/justme/generic/monitor-node/$version/$name" -o "$file"
"$gitea_base/api/packages/justme/generic/moshiro-node/$version/$name" -o "$file"
status="$(curl --silent --show-error --retry 3 --netrc-file "$netrc" \
--request POST --header 'Content-Type: application/octet-stream' --data-binary "@$file" \
--output "$upload_response" --write-out '%{http_code}' \
@@ -111,4 +111,4 @@ for pid in "${pids[@]}"; do
wait "$pid"
done
echo "published Gitea Release $tag: https://git.oeo.one/justme/MyMonitor/releases/tag/$tag"
echo "published Gitea Release $tag: https://git.oeo.one/justme/MoShiro/releases/tag/$tag"
+5 -5
View File
@@ -43,8 +43,8 @@ if ($RuntimeIdentifier -in @('win-x64', 'win-arm64')) {
}
$project = switch ($Component) {
'agent' { 'agent/src/Monitor.Agent' }
'probe' { 'probe/src/Monitor.Probe' }
'agent' { 'agent/src/MoShiro.Agent' }
'probe' { 'probe/src/MoShiro.Probe' }
'fleet-enroll' { 'fleet/tools/fleet-enroll' }
}
$output = Join-Path $root ".release\publish\$RuntimeIdentifier\$Component"
@@ -52,9 +52,9 @@ $buildRoot = Join-Path $root ".release\build\$RuntimeIdentifier-$Component"
$null = New-Item -ItemType Directory -Force -Path $output
# 构建信息:程序里显示的 tag、提交、构建时间
$env:MONITOR_TAG = if ($env:CI_COMMIT_TAG) { $env:CI_COMMIT_TAG } else { "main-$($env:CI_COMMIT_SHA.Substring(0, 10))" }
$env:MONITOR_COMMIT = $env:CI_COMMIT_SHA.Substring(0, 10)
$env:MONITOR_BUILT_AT = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
$env:MOSHIRO_TAG = if ($env:CI_COMMIT_TAG) { $env:CI_COMMIT_TAG } else { "main-$($env:CI_COMMIT_SHA.Substring(0, 10))" }
$env:MOSHIRO_COMMIT = $env:CI_COMMIT_SHA.Substring(0, 10)
$env:MOSHIRO_BUILT_AT = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
Push-Location $backend
try {
+9 -9
View File
@@ -40,25 +40,25 @@ if [[ -n "$tag" && "$version" != "$project_version" ]]; then
fi
registry="${ZOT_REGISTRY:-registry.oeo.one}"
image="${ZOT_IMAGE_REPOSITORY:-$registry/monitor/monitor-backend}"
image="${ZOT_IMAGE_REPOSITORY:-$registry/moshiro/moshiro-backend}"
output="$root/.release/linux-$arch/backend"
build_root="$root/.release/build/linux-$arch-backend"
container_context="$root/.release/container/linux-$arch"
mkdir -p "$output" "$build_root" "$container_context/app" "$container_context/data"
# 构建信息:tag 发布用 tag,main 构建用 main-<提交>
export MONITOR_TAG="${MONITOR_TAG:-${tag:-main-${CI_COMMIT_SHA:0:10}}}"
export MONITOR_COMMIT="${MONITOR_COMMIT:-${CI_COMMIT_SHA:0:10}}"
export MONITOR_BUILT_AT="${MONITOR_BUILT_AT:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"
export MOSHIRO_TAG="${MOSHIRO_TAG:-${tag:-main-${CI_COMMIT_SHA:0:10}}}"
export MOSHIRO_COMMIT="${MOSHIRO_COMMIT:-${CI_COMMIT_SHA:0:10}}"
export MOSHIRO_BUILT_AT="${MOSHIRO_BUILT_AT:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"
(cd "$root/backend" && dotnet publish src/Monitor.Backend \
(cd "$root/backend" && dotnet publish src/MoShiro.Backend \
-m:3 -c Release -r "$rid" --self-contained true \
-p:DebugType=none -p:DebugSymbols=false \
-p:PublishAot=true -p:UseAotAnywhere=true -p:SqliteStaticLink=true -p:OpenApiGenerateDocuments=false \
--artifacts-path "$build_root" -o "$output")
[[ -x "$output/monitor-backend" ]] || { echo "NativeAOT Backend executable is missing" >&2; exit 1; }
[[ "$(wc -c < "$output/monitor-backend")" -gt 2000000 ]] || { echo "Backend output is an apphost, not a NativeAOT executable" >&2; exit 1; }
install -m 0755 "$output/monitor-backend" "$container_context/app/monitor-backend"
[[ -x "$output/moshiro-backend" ]] || { echo "NativeAOT Backend executable is missing" >&2; exit 1; }
[[ "$(wc -c < "$output/moshiro-backend")" -gt 2000000 ]] || { echo "Backend output is an apphost, not a NativeAOT executable" >&2; exit 1; }
install -m 0755 "$output/moshiro-backend" "$container_context/app/moshiro-backend"
: > "$container_context/data/.keep"
# Woodpecker's local backend isolates HOME per workflow. Keep Buildah's image
@@ -68,7 +68,7 @@ buildah_home="${BUILDAH_HOME:-/home/justme/woodpecker/buildah-home/$arch}"
mkdir -p "$buildah_home"
export HOME="$buildah_home"
local_image="localhost/monitor-backend:$version-$arch"
local_image="localhost/moshiro-backend:$version-$arch"
buildah bud --tls-verify=true --arch "$arch" \
--build-arg "APP_VERSION=$version" \
-f "$root/packaging/container/Backend.Containerfile" \
+10 -10
View File
@@ -28,7 +28,7 @@ gitea_host="${gitea_host#http://}"
gitea_host="${gitea_host%%/*}"
gitea_host="${gitea_host%%:*}"
registry="${ZOT_REGISTRY:-registry.oeo.one}"
image_root="$registry/monitor"
image_root="$registry/moshiro"
work="$root/.release/node-images"
netrc="$work/netrc"
buildah_home="/home/justme/woodpecker/buildah-home/node-images"
@@ -56,23 +56,23 @@ done
build_arch_image() {
local component="$1" arch="$2" suffix="$3"
local filename="monitor-$component-v$version-linux-$suffix.tar.gz"
local filename="moshiro-$component-v$version-linux-$suffix.tar.gz"
local context="$work/$component-$arch"
local archive="$work/$filename"
local containerfile="$root/packaging/container/${component^}.Containerfile"
local image="$image_root/monitor-$component"
local local_image="localhost/monitor-$component:$version-$arch"
local image="$image_root/moshiro-$component"
local local_image="localhost/moshiro-$component:$version-$arch"
curl --fail-with-body --silent --show-error --retry 3 --netrc-file "$netrc" \
"$gitea_base/api/packages/justme/generic/monitor-node/$version/$filename" -o "$archive"
"$gitea_base/api/packages/justme/generic/moshiro-node/$version/$filename" -o "$archive"
mkdir -p "$context/app" "$context/config"
if [[ "$component" == agent ]]; then
tar -xzf "$archive" -C "$work" monitor-agent fleet-enroll
tar -xzf "$archive" -C "$work" moshiro-agent fleet-enroll
install -m 0755 "$work/fleet-enroll" "$context/app/fleet-enroll"
else
tar -xzf "$archive" -C "$work" "monitor-$component"
tar -xzf "$archive" -C "$work" "moshiro-$component"
fi
install -m 0755 "$work/monitor-$component" "$context/app/monitor-$component"
install -m 0755 "$work/moshiro-$component" "$context/app/moshiro-$component"
: > "$context/config/.keep"
buildah bud --tls-verify=true --arch "$arch" \
@@ -95,8 +95,8 @@ build_arch_image() {
}
publish_index() {
local component="$1" image="$image_root/monitor-$component"
local manifest="localhost/monitor-$component:$version-multiarch"
local component="$1" image="$image_root/moshiro-$component"
local manifest="localhost/moshiro-$component:$version-multiarch"
buildah manifest rm "$manifest" >/dev/null 2>&1 || true
buildah manifest create "$manifest" >/dev/null
buildah manifest add "$manifest" "docker://$image:$version-amd64" >/dev/null