Initial QMAX production app

This commit is contained in:
sevenhill
2026-07-03 22:39:48 +03:00
commit 9fcc659438
119 changed files with 17959 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
param(
[string]$HostName = "195.216.241.165",
[int]$Port = 2222,
[string]$User = "sevenhill",
[string]$RemoteDir = "/home/sevenhill/qmax"
)
$ErrorActionPreference = "Stop"
Write-Host "This script prepares QMAX files for Raspberry Pi deployment."
Write-Host "It intentionally does not contain or echo SSH passwords."
Write-Host "Prerequisites on the Pi: Docker Engine, Docker Compose plugin, DNS A record for qmax.kusoft.xyz."
$archive = Join-Path $env:TEMP "qmax-deploy.tar.gz"
if (Test-Path $archive) {
Remove-Item -LiteralPath $archive -Force
}
$root = Resolve-Path "$PSScriptRoot\.."
$staging = Join-Path $env:TEMP "qmax-deploy-staging"
if (Test-Path $staging) {
Remove-Item -LiteralPath $staging -Recurse -Force
}
New-Item -ItemType Directory -Force -Path $staging | Out-Null
foreach ($item in @("server", "worker", "deploy", "Dockerfile.server", "QMax.slnx")) {
Copy-Item -LiteralPath (Join-Path $root $item) -Destination $staging -Recurse -Force
}
foreach ($path in @(
"server/QMax.Api/bin",
"server/QMax.Api/obj",
"worker/node_modules"
)) {
$target = Join-Path $staging $path
if (Test-Path $target) {
Remove-Item -LiteralPath $target -Recurse -Force
}
}
Push-Location $staging
try {
tar -czf $archive server worker deploy Dockerfile.server QMax.slnx
}
finally {
Pop-Location
}
Write-Host "Archive created: $archive"
Write-Host "Upload:"
Write-Host " scp -P $Port $archive ${User}@${HostName}:/tmp/qmax-deploy.tar.gz"
Write-Host "Remote install:"
Write-Host " ssh -p $Port ${User}@${HostName}"
Write-Host " rm -rf $RemoteDir && mkdir -p $RemoteDir && tar -xzf /tmp/qmax-deploy.tar.gz -C $RemoteDir"
Write-Host " cd $RemoteDir/deploy && cp .env.example .env && nano .env"
Write-Host " docker compose up -d --build"
+50
View File
@@ -0,0 +1,50 @@
param(
[string]$Version = "0.1.0",
[int]$VersionCode = 1,
[string]$Channel = "stable"
)
$ErrorActionPreference = "Stop"
$root = Resolve-Path "$PSScriptRoot\.."
$apk = Join-Path $root "android\app\build\outputs\apk\release\app-release.apk"
$releaseDir = Join-Path $root "deploy\releases\android"
Push-Location (Join-Path $root "android")
try {
.\gradlew.bat :app:assembleRelease --console=plain --no-daemon
}
finally {
Pop-Location
}
if (!(Test-Path $apk)) {
throw "Release APK was not produced: $apk"
}
New-Item -ItemType Directory -Force -Path $releaseDir | Out-Null
$targetName = "qmax-$Version-$Channel.apk"
$target = Join-Path $releaseDir $targetName
Copy-Item -LiteralPath $apk -Destination $target -Force
$hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $target).Hash.ToLowerInvariant()
$size = (Get-Item -LiteralPath $target).Length
$manifest = [ordered]@{
slug = "qmax"
name = "QMAX"
version = $Version
androidVersionCode = $VersionCode
channel = $Channel
platform = "android"
packageKind = "apk"
downloadPath = "/api/app-updates/android/download/$targetName"
packageSizeBytes = $size
sha256 = $hash
notes = "QMAX $Version"
publishedAt = (Get-Date).ToUniversalTime().ToString("O")
}
$manifestJson = $manifest | ConvertTo-Json -Depth 4
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText((Join-Path $releaseDir "latest.json"), $manifestJson, $utf8NoBom)
Write-Host "Packaged $targetName"
Write-Host "SHA-256 $hash"
+17
View File
@@ -0,0 +1,17 @@
param(
[string]$ServerUrl = "http://localhost:8080",
[string]$PairingCode = "qmax-local-dev"
)
$ErrorActionPreference = "Stop"
dotnet test "$PSScriptRoot\..\QMax.slnx"
Push-Location "$PSScriptRoot\..\android"
try {
.\gradlew.bat :app:assembleDebug :app:assembleRelease --console=plain --no-daemon
}
finally {
Pop-Location
}
Write-Host "Smoke build checks completed."