{"id":19150943,"url":"https://github.com/hequan2017/raptor","last_synced_at":"2025-05-07T05:24:15.698Z","repository":{"id":52083143,"uuid":"470548855","full_name":"hequan2017/raptor","owner":"hequan2017","description":"猛禽 运维平台 项目完结，后续不再更新。","archived":false,"fork":false,"pushed_at":"2022-08-30T08:06:36.000Z","size":111813,"stargazers_count":22,"open_issues_count":1,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-19T19:04:51.122Z","etag":null,"topics":["cmdb","devops","gin","go","golang","jenkins","rbac","sre","vue"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hequan2017.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}},"created_at":"2022-03-16T11:13:02.000Z","updated_at":"2025-02-18T08:06:11.000Z","dependencies_parsed_at":"2022-08-30T10:01:50.409Z","dependency_job_id":null,"html_url":"https://github.com/hequan2017/raptor","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/hequan2017%2Fraptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fraptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fraptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fraptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hequan2017","download_url":"https://codeload.github.com/hequan2017/raptor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252819492,"owners_count":21809033,"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":["cmdb","devops","gin","go","golang","jenkins","rbac","sre","vue"],"created_at":"2024-11-09T08:13:24.973Z","updated_at":"2025-05-07T05:24:15.677Z","avatar_url":"https://github.com/hequan2017.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raptor 猛禽运维平台\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"https://img.shields.io/badge/raptor-0.1-blue\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/golang-1.16-blue\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/gin-1.7.0-lightBlue\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/vue-3.2.25-brightgreen\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/element--plus-2.0.1-green\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/gorm-1.22.5-red\"/\u003e\n\u003c/div\u003e\n\n## 介绍\n### 0.1  项目介绍\n\n```\n\n项目架构就是vue+go。具体实现的功能会在下面罗列。 \n\n```\n\n### 0.2 已完成功能\n\n* 钉钉用户系统对接\n    *  钉钉登录 (前端需要修改 appid地址和redirect_uri地址,后端需要更新AppKey)\n    *  钉钉部门用户信息 定时更新 (task/ding.go   需要更新config ding的AppKey信息)\n* 资产管理\n    *  云平台密钥管理 (阿里云)\n    *  产品线管理 (前端 后端 )\n    *  主机管理(根据密钥，定时更新 阿里云主机信息)\n* 服务管理\n  *  项目管理 (例如: raptor-web)\n  *  构建管理 (正在开发中,计划可以在平台打包构建)\n\n### 0.3 demo (不确保是最新版,实现功能根据上面所列)\n\u003e \n\n### 0.4 交流群\n\n\u003e qq: 620176501\n\n### 0.5 快速部署\n\n```shell \ngit clone https://github.com/hequan2017/raptor\ncd raptor\n\n修改server/config.yaml 里面得配置信息  数据库信息 redis连接信息\ndocker mysql 是 177.7.0.13 \ndocker redis 是 177.7.0.14 \n\ndocker-compose up -d\n\n连接容器mysql  把raptor.sql 导入。 \n\ndocker-compose   restart \n\n登录平台账号admin，密码123456\n```\n\n## 1 开发说明\n### 1.1 版本\n```\n- node版本 \u003e v12.18.3\n- golang版本 \u003e= v1.16  \u003c 1.18\n- IDE推荐：Goland\n-替换掉项目中的七牛云公钥，私钥，仓名和默认url地址，以免发生测试文件数据错乱\n```\n\n### 1.2 server项目\n\n使用 `Goland` 等编辑工具，打开server目录\n\n```bash\n\n# 克隆项目\n# 进入server文件夹\ncd server\n# 使用 go mod 并安装go依赖包\ngo generate\n# 编译 \ngo build -o server main.go (windows编译命令为go build -o server.exe main.go )\n# 运行二进制\n./server (windows运行命令为 server.exe)\n```\n\n### 1.3 web项目\n\n```bash\n# 进入web文件夹\ncd web\n\n# 安装依赖\ncnpm install || npm install\n\n# 启动web项目\nnpm run serve\n```\n\n```\n导入数据库  raptor.sql， 库名字叫raptor，数据库连接文件在  server/config.yaml里面 修改连接信息。\n\n测试是用 config.yaml 的 mysql 线上用MysqlProd,根据主机名判断。 有需求可以搜索修改相关设置\n\nif name, _ := os.Hostname(); name == \"raptor\" {\n    fmt.Println(\"线上环境\")\n    m = global.GVA_CONFIG.MysqlProd\n} else {\n    fmt.Println(\"测试环境\")\n}\n\n```\n\n---\n\n## 2 swagger自动化API文档\n\n#### 2.1 安装 swagger\n\n##### （1）可以访问外国网站\n\n````\ngo get -u github.com/swaggo/swag/cmd/swag\n````\n\n##### （2）无法访问外国网站\n\n由于国内没法安装 go.org/x 包下面的东西，推荐使用 [goproxy.cn](https://goproxy.cn) 或者 [goproxy.io](https://goproxy.io/zh/)\n\n```bash\n# 如果您使用的 Go 版本是 1.13 - 1.15 需要手动设置GO111MODULE=on, 开启方式如下命令, 如果你的 Go 版本 是 1.16 ~ 最新版 可以忽略以下步骤一\n# 步骤一、启用 Go Modules 功能\ngo env -w GO111MODULE=on \n# 步骤二、配置 GOPROXY 环境变量\ngo env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct\n\n# 如果嫌弃麻烦,可以使用go generate 编译前自动执行代码, 不过这个不能使用 `Goland` 或者 `Vscode` 的 命令行终端\ncd server\ngo generate -run \"go env -w .*?\"\n\n# 使用如下命令下载swag\ngo get -u github.com/swaggo/swag/cmd/swag\n```\n\n#### 2.2 生成API文档\n\n```` shell\ncd server\nswag init\n````\n\n\u003e 执行上面的命令后，server目录下会出现docs文件夹里的 `docs.go`, `swagger.json`, `swagger.yaml` 三个文件更新，启动go服务之后, 在浏览器输入 [http://localhost:8888/swagger/index.html](http://localhost:8888/swagger/index.html) 即可查看swagger文档\n\n\n## 3 技术选型\n\n- 前端：用基于 [Vue](https://vuejs.org) 的 [Element](https://github.com/ElemeFE/element) 构建基础页面。\n- 后端：用 [Gin](https://gin-gonic.com/) 快速搭建基础restful风格API，[Gin](https://gin-gonic.com/) 是一个go语言编写的Web框架。\n- 数据库：采用`MySql`(5.6.44)版本，使用 [gorm](http://gorm.cn) 实现对数据库的基本操作。\n- 缓存：使用`Redis`实现记录当前活跃用户的`jwt`令牌并实现多点登录限制。\n- API文档：使用`Swagger`构建自动化文档。\n- 配置文件：使用 [fsnotify](https://github.com/fsnotify/fsnotify) 和 [viper](https://github.com/spf13/viper) 实现`yaml`格式的配置文件。\n- 日志：使用 [zap](https://github.com/uber-go/zap) 实现日志记录。\n\n## 4. 项目架构\n\n### 4.1 系统架构图\n\n![系统架构图](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)\n\n### 4.2 前端详细设计图 （提供者:\u003ca href=\"https://github.com/baobeisuper\"\u003ebaobeisuper\u003c/a\u003e）\n\n![前端详细设计图](http://qmplusimg.henrongyi.top/naotu.png)\n\n### 4.3 目录结构\n\n```\n    ├── server\n        ├── api             (api层)\n        │   └── v1          (v1版本接口)\n        ├── config          (配置包)\n        ├── core            (核心文件)\n        ├── docs            (swagger文档目录)\n        ├── global          (全局对象)                    \n        ├── initialize      (初始化)                        \n        │   └── internal    (初始化内部函数)                            \n        ├── middleware      (中间件层)                        \n        ├── model           (模型层)                    \n        │   ├── request     (入参结构体)                        \n        │   └── response    (出参结构体)                            \n        ├── packfile        (静态文件打包)                        \n        ├── resource        (静态资源文件夹)                        \n        │   ├── excel       (excel导入导出默认路径)                        \n        │   ├── page        (表单生成器)                        \n        │   └── template    (模板)                            \n        ├── router          (路由层)                    \n        ├── service         (service层)                    \n        ├── source          (source层)                    \n        └── utils           (工具包)                    \n            ├── timer       (定时器接口封装)                        \n            └── upload      (oss接口封装)                        \n    \n    └─web            （前端文件）\n        ├─public        （发布模板）\n        └─src           （源码包）\n            ├─api       （向后台发送ajax的封装层）\n            ├─assets\t（静态文件）\n            ├─components（组件）\n            ├─router\t（前端路由）\n            ├─store     （vuex 状态管理仓）\n            ├─style     （通用样式文件）\n            ├─utils     （前端工具库）\n            └─view      （前端页面）\n\n```\n\n## 5. 主要功能\n\n- 权限管理：基于`jwt`和`casbin`实现的权限管理。\n- 文件上传下载：实现基于`七牛云`, `阿里云`, `腾讯云` 的文件上传操作(请开发自己去各个平台的申请对应 `token` 或者对应`key`)。\n- 分页封装：前端使用 `mixins` 封装分页，分页方法调用 `mixins` 即可。\n- 用户管理：系统管理员分配用户角色和角色权限。\n- 角色管理：创建权限控制的主要对象，可以给角色分配不同api权限和菜单权限。\n- 菜单管理：实现用户动态菜单配置，实现不同角色不同菜单。\n- api管理：不同用户可调用的api接口的权限不同。\n- 配置管理：配置文件可前台修改(在线体验站点不开放此功能)。\n- 条件搜索：增加条件搜索示例。\n- restful示例：可以参考用户管理模块中的示例API。\n\t- 前端文件参考: [web/src/view/superAdmin/api/api.vue](https://github.com/flipped-aurora/gin-vue-admin/blob/master/web/src/view/superAdmin/api/api.vue)\n    - 后台文件参考: [server/router/sys_api.go](https://github.com/flipped-aurora/gin-vue-admin/blob/master/server/router/sys_api.go)\n- 多点登录限制：需要在`config.yaml`中把`system`中的`use-multipoint`修改为true(需要自行配置Redis和Config中的Redis参数，测试阶段，有bug请及时反馈)。\n- 分片长传：提供文件分片上传和大文件分片上传功能示例。\n- 表单生成器：表单生成器借助 [@form-generator](https://github.com/JakHuang/form-generator) 。\n- 代码生成器：后台基础逻辑以及简单curd的代码生成器。\n\n\n## 作者\n\n\u003e 何全\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhequan2017%2Fraptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhequan2017%2Fraptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhequan2017%2Fraptor/lists"}