Add dev/prod environments with TrueNAS Docker production deploy.
Split PostgreSQL into gallery_dev and gallery_prod, add Docker/Gitea deploy tooling, SMB image sync, pgAdmin split script, dev:web on Keenetic :5173, and operator docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
02d238b043
commit
2edf577faf
@@ -0,0 +1,64 @@
|
||||
# Push Docker image to Gitea over LAN (avoids KeenDNS hairpin slow upload).
|
||||
param(
|
||||
[string]$Tag = "latest",
|
||||
[switch]$SkipHosts
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Registry = "gitea.mysuperlab.netcraze.pro"
|
||||
$LanIp = "192.168.10.122"
|
||||
$Image = "$Registry/danilka/gallery-web"
|
||||
$HostsPath = "$env:SystemRoot\System32\drivers\etc\hosts"
|
||||
$HostsMarker = "# gallery-gitea-lan-push"
|
||||
|
||||
function Test-Admin {
|
||||
$current = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
return $current.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
}
|
||||
|
||||
function Get-GiteaDnsAddress {
|
||||
try {
|
||||
return [System.Net.Dns]::GetHostAddresses($Registry) |
|
||||
Where-Object { $_.AddressFamily -eq 'InterNetwork' } |
|
||||
Select-Object -First 1 -ExpandProperty IPAddressToString
|
||||
} catch {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "=== Gitea LAN push ===" -ForegroundColor Cyan
|
||||
$resolved = Get-GiteaDnsAddress
|
||||
Write-Host "DNS resolves $Registry -> $resolved"
|
||||
if ($resolved -and $resolved -ne $LanIp) {
|
||||
Write-Host "Public/hairpin path detected (slow push). LAN override recommended." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
if (-not $SkipHosts) {
|
||||
$hostsContent = Get-Content $HostsPath -Raw -ErrorAction SilentlyContinue
|
||||
$hasEntry = $hostsContent -match "gitea\.mysuperlab\.netcraze\.pro"
|
||||
if (-not $hasEntry) {
|
||||
if (-not (Test-Admin)) {
|
||||
Write-Host ""
|
||||
Write-Host "Re-run as Administrator to add hosts entry, or add manually:" -ForegroundColor Yellow
|
||||
Write-Host " $LanIp $Registry"
|
||||
Write-Host " Then: ipconfig /flushdns"
|
||||
exit 1
|
||||
}
|
||||
Add-Content -Path $HostsPath -Value "`n$HostsMarker`n$LanIp $Registry" -Encoding ASCII
|
||||
ipconfig /flushdns | Out-Null
|
||||
Write-Host "Added hosts: $LanIp -> $Registry" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Hosts entry for gitea already present." -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
$after = Get-GiteaDnsAddress
|
||||
Write-Host "After override, resolves to: $after"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Pushing ${Image}:${Tag} ..."
|
||||
docker push "${Image}:${Tag}"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Done. Remove hosts entry ($HostsMarker) when finished if you no longer need LAN override." -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user