{"id":13575700,"url":"https://github.com/ErikJiang/market_monitor","last_synced_at":"2025-04-04T22:31:54.640Z","repository":{"id":55051849,"uuid":"148156439","full_name":"ErikJiang/market_monitor","owner":"ErikJiang","description":":guardsman: market monitor","archived":false,"fork":false,"pushed_at":"2019-01-30T03:13:27.000Z","size":396,"stargazers_count":267,"open_issues_count":5,"forks_count":62,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-02-14T19:32:54.984Z","etag":null,"topics":["cron","gin","golang","swagger"],"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/ErikJiang.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":"2018-09-10T13:04:27.000Z","updated_at":"2023-12-15T13:24:22.000Z","dependencies_parsed_at":"2022-08-14T10:10:36.271Z","dependency_job_id":null,"html_url":"https://github.com/ErikJiang/market_monitor","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/ErikJiang%2Fmarket_monitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErikJiang%2Fmarket_monitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErikJiang%2Fmarket_monitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErikJiang%2Fmarket_monitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ErikJiang","download_url":"https://codeload.github.com/ErikJiang/market_monitor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246927835,"owners_count":20856198,"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","gin","golang","swagger"],"created_at":"2024-08-01T15:01:03.409Z","updated_at":"2025-04-04T22:31:49.631Z","avatar_url":"https://github.com/ErikJiang.png","language":"Go","funding_links":[],"categories":["Go","Gin project in real world"],"sub_categories":[],"readme":"# :guardsman: market_monitor\n\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Go%20version-1.11-brightgreen.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" /\u003e\n\u003c/p\u003e\n\n![gopher](./app/src/public/gopher.png)\n\n* web framework: [gin](https://github.com/gin-gonic/gin)\n* redis: [redigo](https://github.com/gomodule/redigo)\n* mysql: [gorm](https://github.com/jinzhu/gorm)\n* logger: [zerolog](https://github.com/rs/zerolog)\n* scheduler: [cron](https://github.com/robfig/cron)\n* config: [viper](https://github.com/spf13/viper)\n* json web token: [jwt-go](https://github.com/dgrijalva/jwt-go)\n* swagger docs: [swaggo](https://github.com/swaggo/gin-swagger)\n\n#### 克隆项目\n``` shell\n$ git clone https://github.com/ErikJiang/market_monitor.git\n```\n\n#### 单独运行项目\n\n进入应用服务源码目录：\n``` bash\n$ cd market_monitor/app/src/\n```\n\n目录结构：\n``` bash\napp/src/:\n    ├─config/       # 配置文件目录（运行前需要调整database、redis等参数配置）\n    ├─controller/   # 控制器层目录\n    ├─docs/         # 接口文档 Swagger 生成目录\n    ├─extend/       # 扩展模块目录\n    ├─middleware/   # 中间件目录\n    ├─models/       # 数据模型层\n    ├─public/       # 静态资源目录\n    ├─router/       # 路由目录\n    ├─schedule/     # 定时任务目录\n    ├─service/      # 服务层目录\n    ├─templates/    # 视图模板层目录\n    ├─go.mod        # 包管理文件\n    ├─go.sum        # 依赖包版本哈希文件\n    └─main.go       # 运行入口main文件\n```\n\n自主创建数据库：\n``` sql\nCREATE DATABASE db_monitor DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;\n```\n\n启动服务：\n``` bash\n$ go run main.go\n```\n\n运行过程若出现下载 module 失败，或 build 缓慢，可尝试设置`GOPROXY`环境变量：\n``` shell\n$ export GOPROXY=https://goproxy.io\n```\n\n运行后访问：[`http://localhost:8000/swagger/index.html`](http://localhost:8000/swagger/index.html)，查看接口文档；\n\n#### Docker 运行构建\n进入项目根目录：\n``` bash\n$ cd market_monitor/\n```\n\n主目录结构：\n``` bash\nmarket_monitor/\n    ├─docker-compose.yaml   # compose 镜像服务构建文件\n    ├─app                   # monitor 应用服务\n    │  ├─src/               # 源码目录\n    │  └─dockerfile         # docker 镜像构建文件\n    ├─mysql                 # mysql 数据服务\n    │  ├─conf\n    │  │  ├─conf.d/         # 服务自定义配置（字符编码等）\n    │  │  └─init.d/         # 初始化SQL脚本（建库语句）及用户权限设置\n    │  ├─data/              # 数据文件挂载目录\n    │  └─logs/              # 日志目录\n    └─redis                 # redis 缓存服务\n        ├─conf/             # 缓存服务自定义配置(密码等)\n        └─data/             # 数据文件挂载目录\n```\n\n由于 app/ 下的 dockerfile 指定 golang 编译所需依赖从 app/src/vendor/ 目录中读取，故需要提前准备编译所需依赖：\n``` bash\n$ cd app/src/\n$ go mod vendor\n```\n\n最后再回到项目根目录，使用 `docker compose` 以后台启动方式构建容器服务：\n``` bash\n$ docker-compose up -d\n```\n\n---\n\n\u003e 简明教程请见: [Wiki](https://github.com/ErikJiang/market_monitor/wiki)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FErikJiang%2Fmarket_monitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FErikJiang%2Fmarket_monitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FErikJiang%2Fmarket_monitor/lists"}