feat: implement database backup and restore functionality with authentication; add deployment script and service configuration
This commit is contained in:
33
deploy.sh
Normal file
33
deploy.sh
Normal 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
|
||||
Reference in New Issue
Block a user