-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0c2151
commit 617925f
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Deploy to Production Server | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 或者你希望触发部署的分支名称 | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy to server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
password: ${{ secrets.SSH_PASSWORD }} | ||
port: 22 | ||
script: | | ||
# 更新系统包 | ||
sudo yum update -y | ||
# 安装必要的软件包 | ||
sudo yum install -y epel-release | ||
sudo yum install -y python3-pip supervisor | ||
# 克隆最新的代码 | ||
git clone -b main [email protected]:shisongsong/xhm-server.git ~/apps/xhm-server/deployments/current | ||
cd ~/apps/xhm-server/deployments/current | ||
# 安装依赖 | ||
pip3 install -r requirements.txt | ||
# 启动或重启 Gunicorn | ||
echo "[program:app]" | sudo tee -a /etc/supervisord.d/app.conf | ||
echo "command=gunicorn --workers 3 --bind unix:/tmp/app.sock -m app:app" | sudo tee -a /etc/supervisord.d/app.conf | ||
sudo systemctl enable supervisord | ||
sudo systemctl start supervisord | ||
sudo systemctl restart supervisord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ wtforms | |
Flask-Login | ||
flask-marshmallow | ||
marshmallow-sqlalchemy | ||
flask_cors | ||
flask_cors | ||
gunicorn |