From 03e83603ef4f7857498167d72cf799c810f96ac5 Mon Sep 17 00:00:00 2001 From: whm <973418690@qq.com> Date: Tue, 17 Mar 2026 01:26:21 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++++ deploy.sh | 4 ++-- pull-and-restart.sh | 5 +++-- restart.sh | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e4848a2..cb0a9b8 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,11 @@ npm run dev - 管理后台: http://localhost:3000 - 前台: http://localhost:3001 - API: http://localhost:8080 + +## 线上部署(项目根目录:~/project/yh_web) + +线上路径为 `yxd@server1:~/project/yh_web`(即 `/home/yxd/project/yh_web`)。 + +- **拉取代码并重启**:`cd ~/project/yh_web && ./pull-and-restart.sh` +- **仅重启服务**:`cd ~/project/yh_web && ./restart.sh` +- 对外域名:https://yuheng.yuxindazhineng.com diff --git a/deploy.sh b/deploy.sh index 4ebdbe7..91d2590 100644 --- a/deploy.sh +++ b/deploy.sh @@ -48,9 +48,9 @@ if [ -n "$DEPLOY_HOST" ]; then --exclude 'web/dist' \ --exclude 'admin/dist' \ --exclude 'logs' \ - "$ROOT/" "$DEPLOY_HOST:${DEPLOY_PATH:-yh_web}/" + "$ROOT/" "$DEPLOY_HOST:${DEPLOY_PATH:-project/yh_web}/" echo "在远程执行部署..." - ssh "$DEPLOY_HOST" "cd ${DEPLOY_PATH:-yh_web} && chmod +x deploy.sh && ./deploy.sh" + ssh "$DEPLOY_HOST" "cd ${DEPLOY_PATH:-project/yh_web} && chmod +x deploy.sh && ./deploy.sh" else run_deploy "$ROOT" fi diff --git a/pull-and-restart.sh b/pull-and-restart.sh index 11738d6..763dda4 100644 --- a/pull-and-restart.sh +++ b/pull-and-restart.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -# 拉取代码并重启项目(线上建议放在 /home/yxd/project,执行 ./pull-and-restart.sh) -# 也可指定目录:PROJECT_ROOT=/home/yxd/project ./pull-and-restart.sh +# 拉取代码并重启项目(线上项目根目录:/home/yxd/project/yh_web) +# 用法:cd /home/yxd/project/yh_web && ./pull-and-restart.sh +# 或指定目录:PROJECT_ROOT=/home/yxd/project/yh_web ./pull-and-restart.sh set -e ROOT="${PROJECT_ROOT:-$(cd "$(dirname "$0")" && pwd)}" cd "$ROOT" diff --git a/restart.sh b/restart.sh index 8860312..fed21d7 100644 --- a/restart.sh +++ b/restart.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash # 仅重启项目(不拉代码),适用于配置/环境变更后重启 -# 用法:./restart.sh 或 PROJECT_ROOT=/home/yxd/project ./restart.sh +# 用法:cd /home/yxd/project/yh_web && ./restart.sh +# 或:PROJECT_ROOT=/home/yxd/project/yh_web ./restart.sh set -e ROOT="${PROJECT_ROOT:-$(cd "$(dirname "$0")" && pwd)}" cd "$ROOT"