Coder Social home page Coder Social logo

dystudio / springcloud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhoutaoo/springcloud

0.0 2.0 0.0 6.16 MB

基于SpringCloud2.0的微服务开发脚手架,整合了spring-security-oauth2、springboot-admin、feign、hystrix、spring-cloud-gateway、turbine等,让项目开发快速进入业务开发,而不需过多时间花费在架构搭建上。持续更新中

License: Apache License 2.0

Java 99.35% Dockerfile 0.65%

springcloud's Introduction

Build Status License codecov

快速开始

先决条件

开发环境

  1. 克隆代码库: git clone https://gitee.com/toopoo/SpringCloud.git

  2. 生成ide配置: mvn idea:idea 并导入对应的ide进行开发,IDE安装lombok插件

编译 & 启动

  • 1.启动基础服务:docker-compose -f docker-compose.yml 或单个启动docker-compose up 服务名
服务 服务名 端口 备注
数据库 postgres 5432 目前各应用共用1个实例,各应用可建不同的database
KV缓存 redis 6379 目前共用,原则上各应用单独实例
消息中间件 rabbitmq 5672 共用
日志收集中间件 zipkin-server 9411 共用
搜索引擎中间件 elasticsearch 9200 共用
日志分析工具 kibana 5601 共用
数据可视化工具 grafana 3000 共用
  • 2.创建数据库及表

子项目脚本

路径一般为:子项目/db

如:auth/db 下的脚本

应用脚本

路径一般为:子项目/服务名/src/main/db

如:services/producer/src/main/db 下的脚本

  • 3.启动应用: mvn springboot:run
服务分类 服务名 简介 应用地址 文档
center eureka-server 注册中心 http://localhost:8761
center bus-server 消息中心 http://localhost:8071
center config-server 配置中心 http://localhost:8888 配置中心文档
auth authorization-server 授权服务 http://localhost:8000 权限服务文档授权Server文档
auth authentication-server 签权服务 http://localhost:8001 认证Server文档
auth authentication-client 签权客户端 jar包引入
gateway gateway 网关 http://localhost:8443
gateway gateway-admin 网关管理 http://localhost:8445
monitor admin 总体监控 http://localhost:8022
monitor hystrix-dashboard 性能指标展示 http://localhost:8021
monitor turbine 性能指标收集 http://localhost:8031

测试

运行 mvn test 启动测试.

开发指南

项目目录结构

├── auth                           --授权认证子项目
│   ├── authentication-server        --认证组件服务端 
│   ├── authentication-client        --认证组件客户端 
│   ├── authorization-server         --授权组件服务端
│   ├── db                           --子项目公共数据库脚本
│   └── pom.xml                      --子项目maven配置文件
├── center               --中心子项目
│   ├── bus                --消息中心
│   ├── config             --配置中心
│   ├── eureka             --注册中心 
│   └── pom.xml
├── common               --通用子项目
│   ├── core               --核心类库
│   ├── test               --测试工具类库
│   ├── web                --WEB核心类库
│   └── pom.xml          
├── data                 --server及服务数据存储目录
│   ├── elasticsearch      --elasticsearch配置数据存储位置
│   ├── postgres           --postgres数据库文件存储目录 
│   ├── rabbitmq           --rabbitmq数据文件存储目录
│   └── redis              --redis数据文件存储目录
├── gateway              --网关子项目  
│   ├── gateway-web        --基于springcloud gateway的网关
│   ├── gateway-admin      --springcloud gateway的网关管理模块
│   └── pom.xml
├── monitor              --监控、日志及服务管理子项目
│   ├── admin              --springcloud admin管理
│   ├── hystrix-dashboard  --hystrix监控
│   ├── turbine            --turbine监控聚集 
│   └── pom.xml
├── demos                --demos子项目
│   ├── consumer-feign     --消费者服务 feign demo
│   ├── consumer-ribbon    --消费者服务 ribbon demo 
│   ├── producer           --服务提供者,产品服务
│   ├── producer-jpa       --服务提供者,产品服务,jpa和hateoas
│   └── pom.xml
├── readme.md            --readme文档入口
├── docker-compose.yml            --docker compose配置文件,基础组件如数据库、运维组件 
├── docker-compose.override.yml   --docker compose配置文件,注册中心、网关、授权认证服务等 
├── docker-compose.apps.yml       --docker compose配置文件,应用demo 
├── docker-compose.config.yml     --docker compose配置文件,apollo配置中心 
└── pom.xml              --业务服务子项目

module目录结构

├── logs                     --日志目录
│   ├── spring.log
│   └── spring.log.2018-04-15.0.gz
├── pom.xml                  --module maven配置文件
├── src                      --源码目录
│   ├── main                   --源文件
│   │   ├── db                 --服务db脚本目录
│   │   │   ├── ddl              --建表语句等ddl
│   │   │   └── dml              --基础数据dml
│   │   ├── docker             --docker相关配置文件
│   │   │   └── Dockerfile       --dockerfile
│   │   ├── docs               --接口文档目录,一般由swagger生成
│   │   ├── java               --java源码目录
│   │   │   ├── dao              --数据操作层
│   │   │   ├── service          --业务逻辑层
│   │   │   ├── provider         --调用第三方服务的提供类
│   │   │   ├── rest             --接口controller
│   │   │   ├── entity           --实体类
│   │   │   │   ├── form           --rest表单校验
│   │   │   │   ├── param          --dao参数,可以由form转化来
│   │   │   │   ├── po             --实体类
│   │   │   │   └── vo             --视图对象
│   │   │   ├── events           --事件或消息处理类
│   │   │   ├── config           --配置类
│   │   │   ├── exception        --异常处理相关类
│   │   │   ├── interceptor      --拦截器相关类
│   │   │   └── task             --定时任务
│   │   └── resources          --配置文件目录 
│   │       ├── application.yml  --springboot的应用配置文件
│   │       └── bootstrap.yml    --springboot的配置文件
│   └── test                   --测试目录
│       ├── java                 --java测试案例目录
│       └── resources          --配置文件目录 
│          └── application.yml   --springboot test的配置文件
└── target                     --编译目标目录

开发规范

规范文档

功能特性

基础模块

服务 使用技术 进度 备注
注册中心 Eureka
配置中心 Appollo
消息总线 SpringCloud Bus+Rabbitmq
灰度分流 OpenResty + lua 🏗
动态网关 SpringCloud Gateway 🏗 多种维度的流量控制(服务、IP、用户等),后端可配置化🏗
授权认证 Spring Security OAuth2 Jwt模式
服务容错 SpringCloud Hystrix
服务调用 SpringCloud OpenFeign
对象存储 FastDFS 🏗
任务调度 Elastic-Job 🏗
分库分表 Mycat 🏗
数据权限 🏗 使用mybatis对原查询做增强,业务代码不用控制,即可实现。

开发管理

服务 使用技术 进度 备注
代码生成 🏗 前后端代码的生成,支持Vue
测试管理 🏗
文档管理 Swagger2

运维监控

服务 使用技术 进度 备注
服务监控 Spring Boot Admin
链路追踪 Pinpoint、SkyWalking 🏗
操作审计 🏗 系统关键操作日志记录和查询
日志管理 ES + Kibana、Zipkin
监控告警 Grafana

平台功能

服务 使用技术 进度 备注
用户管理 自开发 🏗 用户是系统操作者,该功能主要完成系统用户配置。
角色管理 自开发 🏗 角色菜单权限分配、设置角色按机构进行数据范围权限划分。
菜单管理 自开发 🏗 配置系统菜单,操作权限,按钮权限标识等。
机构管理 自开发 🏗 配置系统组织机构,树结构展现,可随意调整上下级。
通知平台 自开发 🏗 短信、邮件、微信模板发送

联系交流

EMail:[email protected]

wechat

springcloud's People

Contributors

w304807481 avatar zhoutaoo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.