gohook
===
> Python 使用 Tornado 框架实现 WebHook 自动部署 Git 项目
为了方便开发测试或项目部署至服务器不那么繁琐,搞一个自动部署的小轮子也是必要的。
小轮子需要涉及到 Coding 项目托管平台(也可以用 Github 平台),Linux服务器的Nginx、Python( Tornado框架 )。
同时配置项目托管平台的个人私钥或项目公钥,保证 `git pull` 能直接拉取。
## 安装
1.下载或克隆此项目
```shell
git clone git@github.com:HavenShen/gohook.git
```
2.部署代码的服务器必须安装 Python 的 Tornado框架
```shell
pip install tornado
#或
easy_instal tornado
```
## 修改配置
1.修改 `main.py` 中 `file_path` 变量路径
```python
#希望自动部署项目路径
file_path = '/home/wwwroot/xxx'
```
2.配置 `Nginx` 的conf文件
```shell
# http 节点下增加
upstream frontends{
server 127.0.0.1:8765;
}
#增加 server 配置
server {
listen 80;
server_name xxx.xxx.com; #你的域名
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://frontends;
}
}
```
在此可以重启下 Nginx
## 启动
1.运行tornado框架开启后台进程运行
```shell
#下面路径修改成你自己gohook存放目录文件夹用户组必须跟nginx一致
setsid python /home/wwwroot/gohook/main.py &
```
## 配置 Coding 项目 WebHook
1.`url` 填你的域名 `http://xxx.xxx.com/gohook`
2.`token` 填 `gohook`
## 测试
1.本地于服务器自动部署的git项目中使用 git 提交更新一下代码
```shell
touch test.md
git add .
git commit -m "test gohook"
git push -u origin master
```
2.查看服务器上自动部署的git项目中是否存在 `test.md`
done.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
软件开发设计:应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![py](https://img-home.csdnimg.cn/images/20250102104920.png)
![doc](https://img-home.csdnimg.cn/images/20241231044833.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 4 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/1dad28de79404daea521342527545fa8_m0_63168877.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
妄北y
- 粉丝: 2w+
- 资源: 1万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 自媒体studio one 的插件dll 文件,不会安装的,自己看博客
- 强化学习-Birds-Code
- VW80332-2021中文版
- GPS 标准定位服务 (SPS) 性能标准
- 强化学习 -迷宫Code
- CBAM注意力机制详解
- 清华大学DeepSeek如何赋能职场应用?从提示词技巧到多场景应用
- PCAA模块加持YOLOv11-目标检测16个点暴力涨点攻略.pdf
- Mamba-YOLOv11骨干替换-阿里云最新架构优化方案解析.pdf
- LSKA大核注意力机制-YOLOv11检测头优化全流程详解.pdf
- YOLOv11+5G网络-港口集装箱自动识别与物流调度系统搭建.pdf
- YOLOv11+3D点云-物流仓储场景下的包裹体积测量与分拣系统.pdf
- YOLOv11+BEVformer-三维目标检测在自动驾驶中的融合实践.pdf
- YOLOv11+FPGA硬件加速-高速公路卡口车牌识别延迟优化指南.pdf
- YOLOv11+ROS机器人-实时动态场景下的目标抓取与避障算法详解.pdf
- YOLOv11+BEVformer实现自动驾驶多视角目标融合检测.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)