Switch production deployment from Docker to PM2 on Ubuntu.

Add Express gateway, ecosystem config, and one-click install with native PostgreSQL, Node, and Python venv on port 23566.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-28 11:52:20 +08:00
parent e329d3398a
commit e797d188ee
20 changed files with 1578 additions and 714 deletions
+11 -28
View File
@@ -1,28 +1,11 @@
#!/usr/bin/env bash
#
# 停止并移除容器(默认保留数据卷与 uploads)
# 版权所有 (c) 马建军
#
set -euo pipefail
INSTALL_DIR="${INSTALL_DIR:-/opt/secondary-school-grade-archive}"
REMOVE_VOLUMES="${REMOVE_VOLUMES:-0}"
cd "${INSTALL_DIR}" || exit 1
echo "将停止 Docker 服务…"
if [[ "${REMOVE_VOLUMES}" == "1" ]]; then
echo "警告: 将删除数据库卷(所有成绩数据会丢失)"
read -r -p "确认删除数据卷? 输入 yes: " ans
if [[ "${ans}" == "yes" ]]; then
docker compose --env-file .env down -v
else
echo "已取消"
exit 1
fi
else
docker compose --env-file .env down
echo "数据卷与 ${INSTALL_DIR}/uploads 已保留"
fi
echo "卸载完成。源码目录 ${INSTALL_DIR} 未自动删除,如需删除请手动 rm -rf"
#!/usr/bin/env bash
set -euo pipefail
INSTALL_DIR="${INSTALL_DIR:-/opt/secondary-school-grade-archive}"
cd "${INSTALL_DIR}" || exit 1
pm2 delete grade-api grade-web 2>/dev/null || true
pm2 save --force
echo "PM2 服务已停止。PostgreSQL 数据与 ${INSTALL_DIR}/uploads 仍保留。"
echo "如需删除源码: rm -rf ${INSTALL_DIR}"