{"id":15285747,"url":"https://github.com/tmnhs/crony","last_synced_at":"2025-04-16T04:59:46.753Z","repository":{"id":62081258,"uuid":"539896562","full_name":"tmnhs/Crony","owner":"tmnhs","description":"Distributed scheduled task management platform Go语言实现的分布式定时任务管理平台，支持多节点部署，支持节点任务自动分配和故障转移","archived":false,"fork":false,"pushed_at":"2023-06-03T11:23:00.000Z","size":2892,"stargazers_count":90,"open_issues_count":1,"forks_count":24,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T05:01:54.213Z","etag":null,"topics":["cron","crontab","distributed","etcd","failover","gin","goland","gorm","mysql","task-management","vue"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/tmnhs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-22T09:17:38.000Z","updated_at":"2025-03-27T16:56:42.000Z","dependencies_parsed_at":"2024-06-19T10:09:44.806Z","dependency_job_id":null,"html_url":"https://github.com/tmnhs/Crony","commit_stats":{"total_commits":105,"total_committers":2,"mean_commits":52.5,"dds":0.01904761904761909,"last_synced_commit":"b4736565fe674a463353786af665579e5d519a8b"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmnhs%2FCrony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmnhs%2FCrony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmnhs%2FCrony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmnhs%2FCrony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmnhs","download_url":"https://codeload.github.com/tmnhs/Crony/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249199618,"owners_count":21228992,"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":["cron","crontab","distributed","etcd","failover","gin","goland","gorm","mysql","task-management","vue"],"created_at":"2024-09-30T15:07:27.698Z","updated_at":"2025-04-16T04:59:46.729Z","avatar_url":"https://github.com/tmnhs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crony - 分布式定时任务管理平台\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"https://img.shields.io/badge/golang-1.16.5-blue\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/gin-1.8.1-lightBlue\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/vue-2.6.11-brightgreen\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/element--plus-2.13.0-green\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/gorm-1.23.10-red\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/etcd-3.5-red\"/\u003e\n\u003c/div\u003e\n\n\n\n## 1. 基本介绍\n\n### 1.1 项目背景\n项目中存在许多定时任务，很多代码写法都是采取见缝插针式的写法或者直接丢到task服务里面写，存在以下问题 \n\n1. 服务多实例时执行定时任务要考虑抢占锁来争夺定时任务执行权，未抢到锁的任务计算资源被浪费了\n2. 定时任务执行情况和执行时间没有统一管理，需要对应开发者结合代码和日志分析情况，带来很高的维护成本，任务没有按时执行，甚至失败了很久才发现，需要重试或排查\n\n### 1.2 项目介绍\n\n\u003e `crony`是一个基于etcd和mysql开发的分布式定时任务集中调度和管理平台，支持多节点部署，支持节点任务自动分配和故障转移，支持任务执行失败告警，部署简单，使用方便。\n\n[在线预览](http://demo.gin-vue-admin.com): http://www.tmnhs.top/\n\n测试用户名：root\n\n测试密码：123456\n\n### 1.3 系统架构图\n\n![系统架构图](./doc/architecture.png)\n\n详情可见  [设计文档](./doc/design.md)\n## 2.功能特性\n\n- 支持多节点部署，故障转移\n- 支持任务自动分配节点\n- Web界面后台管理定时任务，支持多语言\n- crontab表达式自动生成\n- 任务调度时间粒度支持到`秒`级别\n- 任务执行失败可重试\n- 用户权限控制\n- 支持shell任务和http回调\n- 查看任务执行日志\n- 任务执行失败告警, 支持邮件、WebHook(提供飞书模板告警)\n\n\n## 3.使用说明\n\n### 3.1 环境要求\n\n- 安装 [etcd3](https://github.com/coreos/etcd)和[mysql](https://www.mysql.com/)\n- golang版本 \u003e= v1.16\n- node版本 \u003e= v16.13.0\n- yarn\n\n### 3.2 安装部署\n\n- 直接下载二进制可执行文件:[release](https://github.com/tmnhs/crony/releases/tag/v1.2.0)\n- 或者可以源码编译:\n\n```bash\n#克隆项目\ngit clone https://github.com/tmnhs/crony.git\n\n#进入项目\ncd crony\n\n#编译前需要修改admin(admin/conf/testing/main.json)和node(node/conf/testing.json)的配置文件\n#编译，编译后的可执行文件都在bin/目录下\n#或者 ./build.sh\nmake  \n\n#使用脚本运行\n#脚本语法：./server.sh {start|stop|restart} {admin|node} {testing|production}\n#运行后台，默认使用testing配置文件\n./server.sh start admin \n#运行节点\n./server.sh start node\n\n```\n\n运行后访问地址:http://localhost:8089\n\n## 4. 技术选型\n\n- 前端： [Vue](https://vuejs.org) + [Element](https://github.com/ElemeFE/element)\n- 后端： [Gin](https://gin-gonic.com/) + [Gorm](http://gorm.cn)+ [Viper](https://github.com/spf13/viper)+ [Zap](https://github.com/uber-go/zap)+[Common包](https://github.com/tmnhs/common)\n- 定时任务使用：[robfig/cron](https://github.com/robfig/cron)\n\n## 5. 截图\n\n**首页**\n\n![首页](./doc/dashboard.png)\n\n**任务列表**\n\n![任务管理](./doc/job.png)\n\n**编辑任务**\n\n![新增任务](./doc/edit_job.png)\n\n**cron表达式生成**\n\n![cron表达式生成](./doc/cron.png)\n\n**用户管理**\n\n![用户管理](./doc/user.png)\n\n**日志列表**\n\n![日志管理](./doc/log.png)\n\n**节点管理**\n\n![节点管理](./doc/node.png)\n\n**服务器状态**\n\n![**服务**器状态](./doc/state.png)\n\n**邮件和飞书告警模板**\n\n\u003cdiv style=\"height: 250px\" align=center\u003e\n    \u003cimg src=\"http://qny.tmnhs.top/email2022.jpg\" width=\"40%\" style=\"margin-right: 20px\" /\u003e\n    \u003cimg src=\"http://qny.tmnhs.top/feishu.png\" width=\"50%\" style=\"line-height: 250px\" /\u003e\n\u003c/div\u003e\n\n## 6. TODOLIST\n- 配置负载均衡器，支持加权轮询和平滑加权轮询（nginx方案）分配任务，(原方案是每次分配给任务数量最少的服务器)\n- 定时任务分组\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmnhs%2Fcrony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmnhs%2Fcrony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmnhs%2Fcrony/lists"}