Update API media endpoints and deploy scripts

This commit is contained in:
Noro Studio
2026-06-30 21:02:21 +03:30
parent b0361594b1
commit dc2b202797
4 changed files with 101 additions and 4 deletions
+41
View File
@@ -0,0 +1,41 @@
# Sync production CMS data to local admin (and optional api folder)
# Usage: .\deploy\sync-from-server.ps1
param(
[string]$Server = "root@45.94.215.38",
[string]$RemoteApiPath = "/var/www/studionoro/api",
[string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
)
$ErrorActionPreference = "Stop"
$targets = @(
@{
Name = "admin"
DataDir = Join-Path $ProjectRoot "admin\data"
UploadsDir = Join-Path $ProjectRoot "admin\uploads"
},
@{
Name = "api"
DataDir = Join-Path $ProjectRoot "api\data"
UploadsDir = Join-Path $ProjectRoot "api\uploads"
}
)
Write-Host "==> Sync from $Server`:$RemoteApiPath" -ForegroundColor Cyan
Write-Host ""
foreach ($target in $targets) {
New-Item -ItemType Directory -Force -Path $target.DataDir | Out-Null
New-Item -ItemType Directory -Force -Path $target.UploadsDir | Out-Null
Write-Host "-> $($target.Name)/data/content.json" -ForegroundColor Yellow
scp "${Server}:${RemoteApiPath}/data/content.json" (Join-Path $target.DataDir "content.json")
Write-Host "-> $($target.Name)/uploads/" -ForegroundColor Yellow
scp -r "${Server}:${RemoteApiPath}/uploads/*" "$($target.UploadsDir)/"
}
Write-Host ""
Write-Host "Done. Restart local admin dev server if it is running:" -ForegroundColor Green
Write-Host " cd admin && npm run dev"