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
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Clone all Studio Noro repos into /var/www/studionoro
set -euo pipefail
APP_ROOT="${APP_ROOT:-/var/www/studionoro}"
GIT_BASE="${GIT_BASE:-https://get.feep.ir/noro}"
mkdir -p "$APP_ROOT"
cd "$APP_ROOT"
if [ ! -d api ]; then
git clone "${GIT_BASE}/server.git" _server-tmp
mv _server-tmp/api api
mv _server-tmp/deploy deploy
rm -rf _server-tmp
fi
if [ ! -d nuxt-tailwind-app ]; then
git clone "${GIT_BASE}/site.git" nuxt-tailwind-app
fi
if [ ! -d admin ]; then
git clone "${GIT_BASE}/admin.git" admin
fi
echo "Repos ready in $APP_ROOT:"
ls -la "$APP_ROOT"
+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"