forked from xhgit/webup-cloud
Initial import of WebUp Cloud
This commit is contained in:
commit
db82325ed7
216 files changed
+33718
No files matched your search
@@ -0,0 +1,13 @@
|
||||
param([string]$OutputDirectory = './data/backups')
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-Location -LiteralPath (Split-Path -Parent $PSScriptRoot)
|
||||
New-Item -ItemType Directory -Force -Path $OutputDirectory | Out-Null
|
||||
$fileName = 'platform-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.dump'
|
||||
$backupTarget = Join-Path (Resolve-Path -LiteralPath $OutputDirectory).Path $fileName
|
||||
# Docker cp preserves binary format on Windows PowerShell 5.1.
|
||||
docker compose exec -T postgres sh -c 'pg_dump -U "$POSTGRES_USER" -Fc -f /tmp/platform-backup.dump platform'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'pg_dump failed; backup not completed.' }
|
||||
$containerId = docker compose ps -q postgres
|
||||
docker cp "${containerId}:/tmp/platform-backup.dump" $backupTarget
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Backup copy failed.' }
|
||||
Write-Host "Backup created: $backupTarget. This covers platform PostgreSQL only; storage requires a separate S3 backup."
|
||||
Reference in new issue
Block a user