fix: 修复本地图片上传与发布进程切换

This commit is contained in:
que01 committed 2026-10-13 16:00:42 +08:00
1 parent 7f67f4d685
commit dcf1d76944
7 files changed
+121 -25

No files matched your search

+5 -2
View File
@@ -10,6 +10,9 @@ if (process.argv.includes("--status")) {
process.exit(result.status ?? 1);
}
const target = process.env.DEPLOY_TARGET ?? "oracle_arm";
const sshOptions = process.env.DEPLOY_SSH_OPTIONS
? process.env.DEPLOY_SSH_OPTIONS.split(" ").filter(Boolean)
: [];
const remoteRoot = process.env.DEPLOY_ROOT ?? "/home/ubuntu/persional-brand";
const publicBaseUrl = process.env.PUBLIC_BASE_URL ?? "https://wechat.app.que01.top";
const timestamp = new Date().toISOString().replace(/\D/g, "").slice(0, 14);
@@ -43,7 +46,7 @@ if (packageResult.status !== 0) process.exit(packageResult.status ?? 1);
await access(archive);
await access(archive + ".sha256");
run("scp", [archive, archive + ".sha256", target + ":/tmp/"]);
run("scp", [...sshOptions, archive, archive + ".sha256", target + ":/tmp/"]);
const remoteScript = [
"set -eu",
@@ -67,7 +70,7 @@ const remoteScript = [
"node deploy/install-release.mjs .",
].join("; ");
run("ssh", [target, "bash -s"], { input: remoteScript + "\n" });
run("ssh", [...sshOptions, target, "bash -s"], { input: remoteScript + "\n" });
const checks = ["/admin/", "/template-preview/", "/api/health", "/media/seed/food-package-02.jpg"];
for (const route of checks) {
+6
View File
@@ -20,13 +20,19 @@ run("ssh", [
"bash",
"-lc",
[
"set -euo pipefail",
'source "$HOME/.nvm/nvm.sh"',
"export DEPLOY_ROOT=/home/ubuntu/persional-brand",
'printf "current=%s\\n" "$(readlink /home/ubuntu/persional-brand/current)"',
'printf "api="; test "$(pm2 pid personal-brand-api)" != "0"; echo online',
'printf "pm2-autostart="; systemctl --user is-enabled personal-brand-pm2.service',
'printf "admin="; systemctl --user is-active personal-brand-admin-static.service',
'printf "database="; docker inspect -f "{{.State.Status}}" personal-brand-postgres-1',
'printf "backups="; find /home/ubuntu/persional-brand/shared/backups -maxdepth 1 -name "*.dump" | wc -l',
'printf "latest-backup="; newest=$(find /home/ubuntu/persional-brand/shared/backups -maxdepth 1 -type f -name "*.dump" -printf "%T@ %p\\n" | sort -nr | head -1 | cut -d" " -f2-); test -n "$newest"; stat -c "%y %s bytes" "$newest"; docker exec -i personal-brand-postgres-1 pg_restore -l < "$newest" >/dev/null; echo readable',
'printf "backup-temp-files="; find /home/ubuntu/persional-brand/shared/backups -maxdepth 1 -type f -name "*.tmp" | wc -l',
'printf "disk="; df -h / | awk "NR==2 {print \\$5 \" used, \" \\$4 \" free\"}"',
'printf "release-count="; find /home/ubuntu/persional-brand/releases -mindepth 1 -maxdepth 1 -type d | wc -l',
].join("; "),
]);