Document server deployment workflow
This commit is contained in:
@@ -480,3 +480,62 @@ npm start
|
||||
```bash
|
||||
curl http://127.0.0.1:3030/api/health
|
||||
```
|
||||
|
||||
## 14. 后续本地开发与服务器发布流程
|
||||
|
||||
本地开发:
|
||||
|
||||
```bash
|
||||
cd /path/to/sumi.work
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
提交并推送:
|
||||
|
||||
```bash
|
||||
git status
|
||||
git add .
|
||||
git commit -m "your change message"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
当前服务器已经配置好干净部署目录和持久化数据目录:
|
||||
|
||||
- 代码目录:`/var/www/sumi.work`
|
||||
- 持久化目录:`/var/lib/sumi-work`
|
||||
- systemd 服务:`sumi-work`
|
||||
- 快捷部署命令:`/usr/local/bin/deploy-sumi-work`
|
||||
|
||||
本地推送后,在服务器执行:
|
||||
|
||||
```bash
|
||||
deploy-sumi-work
|
||||
```
|
||||
|
||||
它会自动执行:
|
||||
|
||||
```bash
|
||||
cd /var/www/sumi.work
|
||||
git fetch origin main
|
||||
git pull --ff-only origin main
|
||||
npm ci
|
||||
node --check server/server.js
|
||||
node --check assets/js/software.js
|
||||
node --check assets/js/software-admin.js
|
||||
systemctl restart sumi-work
|
||||
curl -fsS http://127.0.0.1:3030/api/health
|
||||
```
|
||||
|
||||
通过 SSH 节点技能远程执行:
|
||||
|
||||
```powershell
|
||||
python C:/Users/Administrator/.codex/skills/ssh-remote-node/scripts/ssh_node.py --host 43.136.76.224 --port 22 --user root --key D:\rsa\id_rsa exec --command deploy-sumi-work
|
||||
```
|
||||
|
||||
服务器保留了部署前备份:
|
||||
|
||||
- 完整备份目录:`/root/sumi-work-backups/`
|
||||
- 上一次旧代码目录:`/var/www/sumi.work.previous-*`
|
||||
|
||||
不要再手工覆盖 `/var/www/sumi.work`,后续以“本地提交 -> 推送 Git -> 服务器执行 `deploy-sumi-work`”为准。
|
||||
|
||||
Reference in New Issue
Block a user