feat: enhance Spug deployment scripts with better error handling and auto-fix

This commit is contained in:
2026-02-28 16:01:59 +08:00
parent 13badac2dc
commit 5b45bf86a2
4 changed files with 511 additions and 13 deletions

68
spug/.env.example Normal file
View File

@@ -0,0 +1,68 @@
# Spug 环境变量配置示例
# 在 Spug 应用的"环境变量"中配置以下参数
# ==================== 必需配置 ====================
# 部署目录(目标服务器上的路径)
SPUG_DEPLOY_DIR=/var/www/hospital-performance
# Git 仓库地址Spug 会自动设置,也可手动指定)
# SPUG_GIT_URL=https://gitea.gentronhealth.com/chenqi/hospital_performance.git
# Git 分支
SPUG_GIT_BRANCH=main
# ==================== 可选配置 ====================
# 应用名称
SPUG_APP_NAME=hospital-performance
# Python 版本
PYTHON_VERSION=python3.10
# Node.js 版本
NODE_VERSION=18
# 后端服务名称
BACKEND_SERVICE=hospital-backend
# 后端端口
BACKEND_PORT=8000
# 前端服务名称
FRONTEND_SERVICE=nginx
# 日志文件路径
LOG_FILE=/var/log/spug/deploy.log
# ==================== 数据库配置 ====================
# PostgreSQL 连接(生产环境请使用更安全的密钥管理)
DATABASE_HOST=192.168.110.252
DATABASE_PORT=15432
DATABASE_USER=postgresql
DATABASE_PASSWORD=Jchl1528
DATABASE_NAME=hospital_performance
# ==================== JWT 配置 ====================
# JWT 密钥(生产环境必须修改!)
SECRET_KEY=your-super-secret-key-change-in-production-min-32-chars
# 调试模式(生产环境设为 False
DEBUG=False
# ==================== 通知配置(可选) ====================
# 钉钉机器人 Webhook
# DINGTALK_WEBHOOK=https://oapi.dingtalk.com/robot/send?access_token=xxx
# 企业微信机器人 Webhook
# WECHAT_WORK_WEBHOOK=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx
# 邮件通知
# NOTIFY_EMAIL=admin@example.com