feat: implement database backup and restore functionality with authentication; add deployment script and service configuration

This commit is contained in:
ethan.chen
2025-05-19 17:55:39 +08:00
parent ca22da355d
commit 5721d26fae
4 changed files with 151 additions and 4 deletions

33
deploy.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# 更新系统
sudo apt update
sudo apt upgrade -y
# 安装 Python 和依赖
sudo apt install -y python3 python3-pip python3-venv
# 创建项目目录
mkdir -p /home/ubuntu/my-score/backend
# 创建并激活虚拟环境
python3 -m venv /home/ubuntu/my-score/backend/venv
source /home/ubuntu/my-score/backend/venv/bin/activate
# 安装项目依赖
pip install -r requirements.txt
# 复制服务文件
sudo cp my-score.service /etc/systemd/system/
# 重新加载 systemd
sudo systemctl daemon-reload
# 启动服务
sudo systemctl start my-score
# 设置开机自启
sudo systemctl enable my-score
# 检查服务状态
sudo systemctl status my-score