From 2852436a82529d04db39f78733de5a1b2020de7c Mon Sep 17 00:00:00 2001 From: xucheng Date: Thu, 30 Oct 2025 08:12:58 +0000 Subject: [PATCH] chore: sync local changes after pulling remote updates --- pm2.config.js | 20 ++++++++++++++++++++ scripts/run.sh | 5 +++++ scripts/stop.sh | 10 ++++++++++ 3 files changed, 35 insertions(+) create mode 100644 pm2.config.js create mode 100755 scripts/stop.sh diff --git a/pm2.config.js b/pm2.config.js new file mode 100644 index 0000000..1890825 --- /dev/null +++ b/pm2.config.js @@ -0,0 +1,20 @@ +module.exports = { + apps : [{ + name: "frontend", + cwd: "./frontend", + script: "npm", + args: "start", + env: { + "PORT": 3000 + } + }, { + name: "backend", + cwd: "./backend", + script: "./.venv/bin/uvicorn", + args: "app.main:app --host 0.0.0.0 --port 8000", + interpreter: "none", + env: { + "PYTHONPATH": "." + } + }] +}; diff --git a/scripts/run.sh b/scripts/run.sh index 67783f6..4471658 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -62,6 +62,11 @@ cd frontend echo "--> Changed directory to $(pwd)" npm install echo "Frontend setup complete." + +# --- Frontend Production Build --- +echo "Building frontend for production..." +npm run build +echo "Frontend build complete." cd .. echo "--> Changed directory to $(pwd)" diff --git a/scripts/stop.sh b/scripts/stop.sh new file mode 100755 index 0000000..fb5c639 --- /dev/null +++ b/scripts/stop.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# 停止所有用 pm2 启动的服务,并清理进程 + +echo "Stopping all pm2 applications..." +pm2 stop all +echo "All pm2 applications stopped." + +echo "Deleting all pm2 processes..." +pm2 delete all +echo "All pm2 processes deleted."