{"id":15033114,"url":"https://github.com/neteasegame/git-webhook","last_synced_at":"2025-04-08T11:14:57.683Z","repository":{"id":55467700,"uuid":"69549717","full_name":"NetEaseGame/git-webhook","owner":"NetEaseGame","description":":octocat: 使用 Python Flask + SQLAchemy + Celery + Redis + React 开发的用于迅速搭建并使用  WebHook 进行自动化部署和运维，支持 Github / GitLab / Gogs / GitOsc。","archived":false,"fork":false,"pushed_at":"2020-12-29T05:50:42.000Z","size":2045,"stargazers_count":1523,"open_issues_count":14,"forks_count":415,"subscribers_count":87,"default_branch":"master","last_synced_at":"2025-04-08T11:14:50.947Z","etag":null,"topics":["docker","git-webhook","github","gitlab","gogs","webhook"],"latest_commit_sha":null,"homepage":"https://webhook.hust.cc/","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NetEaseGame.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-29T08:56:12.000Z","updated_at":"2025-03-31T13:23:11.000Z","dependencies_parsed_at":"2022-08-15T01:00:55.192Z","dependency_job_id":null,"html_url":"https://github.com/NetEaseGame/git-webhook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2Fgit-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2Fgit-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2Fgit-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2Fgit-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetEaseGame","download_url":"https://codeload.github.com/NetEaseGame/git-webhook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829512,"owners_count":21002997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","git-webhook","github","gitlab","gogs","webhook"],"created_at":"2024-09-24T20:20:08.426Z","updated_at":"2025-04-08T11:14:57.662Z","avatar_url":"https://github.com/NetEaseGame.png","language":"Python","readme":"# Git WebHook\n\n\u003e 一个使用 Python Flask + SQLAchemy + Celery + Redis + React 开发的用于迅速搭建并使用  WebHook 进行自动化部署和运维系统，支持：**Github / GitLab / Gogs / GitOsc**。\n\n**若觉得 git-webhook 部署依然比较复杂，可以尝试更为简洁的 cli 版本：[webhookit](https://github.com/hustcc/webhookit)。**在线实例可以查看[这里](http://webhookit.hust.cc)。\n\n[![Latest Stable Version](https://img.shields.io/pypi/v/git-webhook.svg)](https://pypi.python.org/pypi/git-webhook) [![Build Status](https://travis-ci.org/NetEaseGame/git-webhook.svg?branch=master)](https://travis-ci.org/NetEaseGame/git-webhook) [![Codecov branch](https://img.shields.io/codecov/c/github/NetEaseGame/git-webhook/master.svg)](https://codecov.io/gh/NetEaseGame/git-webhook) ![GitHub](http://shields.hust.cc/Supported-GitHub-brightgreen.svg) ![GitLab](http://shields.hust.cc/Supported-GitLab-green.svg) ![GitOsc](http://shields.hust.cc/Supported-GitOsc-blue.svg) ![Gogs](http://shields.hust.cc/Supported-Gogs-yellowgreen.svg)\n\n - 技术栈简单，**部署**容易；\n - 代码简洁易懂，**二次开发**毫无压力；\n - 支持 **Github / GitLab / Gogs / GitOsc**；\n - 使用 SSH 方式，支持**多服务**配置；\n\n[Project ChangeLog](CHANGELOG.md) | [Online DEMO Website](http://webhook.hust.cc/)（使用 nginx 部署绑定域名）\n\n\n## 一、如何使用 \u0026 部署 ？\n\n习惯使用 Docker 的老司机直接看[如何使用 Docker 部署 Git-WebHook](deploy-docker.md)。\n\n1. 安装 git-webhook：\n\n\t```sh\n\tpip install git-webhook\n\t```\n\n\t备注：项目中某一个依赖库需要安装 **python-dev**。\n\n2. 创建配置\n\n\t```sh\n\tgitwebhook config\n\t```\n\t命令执行之后，会在对应用户目录生成新的配置文件，然后对应修改配置文件内容。主要需要配置三点：\n\t\n\t - `DATABASE_URI`: 数据库地址，理论上可以使用**任何关系数据库**；推荐使用 sqlite 和 mysql （经过测试）；\n\t - `CELERY REDIS`: Redis URI 配置，主要用于 Celery 后台任务；\n\t - `GITHUB`: GitHub 登陆配置，可以到 [OAuth applications](https://github.com/settings/developers) 自行申请，登陆 Callback 地址为： `your_domain/github/callback`.\n\n3. 初始化数据库结构\n\n\t```sh\n\tgitwebhook createdb\n\t```\n\n4. 运行应用\n\n\t```sh\n\t# 1. run python webserver\n\tgitwebhook runserver\n\t# 2. run celery async task\n\tgitwebhook celery\n\t```\n\t\n\t运行之后，打开 http://127.0.0.1:18340 （一巴扇死你）即可访问。使用 GitHub 账号登陆。\n\n5. 添加WebHook\n\n\t在工具中添加 WebHook 项目，获得 WebHook URL，并填写到 Github / GitLab / OscGit 的 WebHook 配置中。\n\n\n**安装之后如何使用？**直接看你部署的 Web 应用文档吧，或者在[这里](http://webhook.hust.cc/#/doc/webhook)也可以看到。\n\n\n## 三、效果预览\n\n - **首页**\n\n![index.png](app/static/res/img/index.png)\n\n - **WebHook列表**\n\n![webhook.png](app/static/res/img/webhook.png)\n\n - **服务器列表**\n\n![server.png](app/static/res/img/server.png)\n\n - **WebHook 历史记录**\n\n![history.png](app/static/res/img/history.png)\n\n\n## 四、部署\n\n代码使用 Flask 框架开发，`gitwebhook runserver` 运行可以用于线上生产环境，可以额外使用 nginx 做负载均衡和域名绑定。\n\n主要的服务器依赖环境：\n\n - 数据库环境（自行选择，推荐 mysql 和 sqlite）；\n - Redis，利用 Celery 做后台任务；\n\n**备注**：如果使用 gunicorn 部署， worker 数量必须为 1，建议 worker 类型为 eventlet (`gunicorn -k eventlet -w 1`)，并且 nginx 负载均衡的时候，需要使用 ip_hash 算法。\n具体请参考: [gunicorn-web-server](http://flask-socketio.readthedocs.io/en/latest/#gunicorn-web-server)\n\n当然也可以直接[使用 Docker 部署](deploy-docker.md)。\n\n\n## 五、贡献\n\n项目使用 SSH 私钥 / 账户密码的方式，直接登陆 Linux 服务器，执行部署或者运维的 Shell 命令，安全可靠，当然因为涉及到**私钥**，或者**用户密码**，所以为了安全起见，建议在内网搭建使用（这些是我们的使用情景）。\n\n**后端开发**使用：Python Flask + SQLAchemy + Celery + Redis，常规的技术栈；\n\n**前端开发**使用 React + Webpack，并没有使用其他消息通信框架。\n\n所以整体项目代码非常简单，大部分都能够修改和更新代码，并提交 Pull Request，目前系统 TODO 包括，我个人也将注意完善：\n\n - Celery 进程情况显示（当 Celery 进程没有执行的时候，在页面上提示，类似于 Sentry）；\n - 系统状态和统计（任务队列实时情况，WebHook 执行的统计图表等）；\n\n\n## LICENSE\n\nMIT @hustcc\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneteasegame%2Fgit-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneteasegame%2Fgit-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneteasegame%2Fgit-webhook/lists"}