栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Cloud-Platform 开源项目环境搭建及运行

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Cloud-Platform 开源项目环境搭建及运行

一 项目位置

Cloud-Platform: 国内首个Spring Cloud微服务化RBAC的管理平台,核心采用Spring Boot 2.4、Spring Cloud 2020.0.0 & Alibaba,前端采用d2-admin中台框架。   记得上边点个star 关注更新https://gitee.com/geek_qi/cloud-platform

版本:v2.7

二 项目资料

dev-doc.md · 江离/Cloud-Platform - Gitee.comhttps://gitee.com/geek_qi/cloud-platform/blob/master/dev-doc.md

三 前后端的对应关系

源码位置

https://gitee.com/geek_qihttps://gitee.com/geek_qi/cloud-platform

因为涉及第一代和第二代项目,很容易把版本关系弄错,在此梳理一下版本对应关系。

版本说明

前端

后端

稳定性

第一代

项目:Cloud-Platform-UI

分支:master

项目:Cloud-Platform

分支:v2.7

第一代版本的终结版本

第二代

项目:Cloud-Platform-UI-v2

分支:dev

项目:Cloud-Platform

分支:master

开发中的最新版本

本篇介绍的是第一代。

四 项目介绍 1 项目简介

Cloud-Platform 是国内首个基于 Spring Cloud 微服务化开发平台,具有统一授权、认证后台管理系统,其中包含具备用户管理、资源权限管理、网关 API 管理等多个模块,支持多业务系统并行开发,可以作为后端服务的开发脚手架。

代码简洁,架构清晰,适合学习和直接项目中使用。 

核心技术采用 Spring Boot 2.1.2 以及 Spring Cloud (Greenwich.RELEASE) 相关核心组件,采用 Nacos 注册和配置中心,集成流量卫兵 Sentinel,前端采用 vue-element-admin 组件,Elastic Search 自行集成。

2 技术选型

前端:vue-element-admin后端:springcloud(gateway、admin、sidecar、Hystrix、feign、ribbon、zipkin)、tk+mybatis、lucene、jwt、rest、Nacos 3 项目结构

ace-security

  ace-modules--------------公共服务模块(基础系统、搜索、OSS、业务模块)

  ace-auth-----------------服务鉴权中心

  ace-gate-----------------网关负载中心

  ace-common---------------通用脚手架(各种工具类)

  ace-control--------------运维中心(监控、链路、注册中心)

  ace-sidebar--------------调用第三方语言服务  

4 前端 4.1 下载位置

Cloud-Platform-UI: Cloud-Platform是国内首个基于Spring Cloud微服务化开发平台,具有统一授权、认证后台管理系统,其中包含具备用户管理、资源权限管理、网关API管理等多个模块,支持多业务系统并行开发,可以作为后端服务的开发脚手架。代码简洁,架构清晰,适合学习和直接项目中使用。核心技术采用Eureka、Fegin、Ribbon、Zuul、Hystrix、JWT Token、Mybatis等主要框架和中间件,前端采用vue-element-admin组件。https://gitee.com/geek_qi/cloud-platform-ui

4.2 启动和运行

# 1 安装淘宝镜像依赖

npm install -g cnpm --registry=https://registry.npm.taobao.org

# 2 安装项目依赖

cnpm install

# 3 启动服务

npm run dev

启动成功后会自动打开链接:http://localhost:9527/

五 开发环境搭建及运行 1 用 Idea 打开项目

一级模块和二级模块的关系如下

2 导入数据到数据库

导入3个数据库

3 依次启动 nacos 和 redis 4 AuthBootstrap 的启动 4.1 配置 AuthBootstrap 的配置文件

先从简单开始,以后再配置更复杂的功能

spring:
    application:
        name: ace-auth
    jackson:
        date-format: yyyy-MM-dd HH:mm:ss
        time-zone: GMT+8
        default-property-inclusion: non_null
    redis:
        database: 2
        host: ${REDIS_HOST:localhost}
        port: ${REDIS_PORT:6379}
        pool:
        max-active: 20
    datasource:
      name: test
      url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/ag_auth_v1?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=UTC
      username: root
      password: Mima123456
      # 使用druid数据源
      type: com.alibaba.druid.pool.DruidDataSource
      driver-class-name: com.mysql.jdbc.Driver
      filters: stat
      maxActive: 20
      initialSize: 1
      maxWait: 60000
      minIdle: 1
      timeBetweenEvictionRunsMillis: 60000
      minEvictableIdleTimeMillis: 300000
      validationQuery: select 'x'
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      maxOpenPreparedStatements: 20
    cloud:
      nacos:
        discovery:
            server-addr: 127.0.0.1:8848
mybatis:
    basepackage: com.github.wxiaoqi.security.auth.mapper
    xmlLocation: classpath:mapper*.xml
    mapper-locations: "classpath*:mapper*.xml
    mapper-locations: "classpath*:mapper/*.xml"

server:
    port: 8762

# 必须配置
feign:
  httpclient:
    enabled: false
  okhttp:
    enabled: true

ribbon:
  eureka:
    enabled: true
  ReadTimeout: 100000
  ConnectTimeout: 100000
  MaxAutoRetries: 0
  MaxAutoRetriesNextServer: 1
  OkToRetryOnAllOperations: false

hystrix:
  threadpool:
    default:
      coreSize: 1000 ##并发执行的最大线程数,默认10
      maxQueueSize: 1000 ##BlockingQueue的最大队列数
      queueSizeRejectionThreshold: 500 ##即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 110000

# 配置swagger
swagger:
    enabled: true
    base-package: com.github.wxiaoqi.security.admin
    title: ace-admin
    version: 1.0.0.SNAPSHOT
    description: 管理后端服务
    contact:
        name: admin

auth:
  serviceId: ace-auth
  user:
    token-header: Authorization
  client:
    id: ace-admin
    secret: 123456
    token-header: x-client-token

# redis-cache 相关
redis:
    pool:
         maxActive: 300
         maxIdle: 100
         maxWait: 1000
    host: ${REDIS_HOST:localhost}
    port:  ${REDIS_PORT:6379}
    password:
    timeout: 2000
    # 服务或应用名
    sysName: ace-admin
    enable: true
    database: 0

management:
  endpoints:
    web:
      exposure:
        include: '*'
  security:
    enabled: false
5.2 nacos 观察服务状态

6 GatewayServerBootstrap 的启动 6.1 修改配置文件

先从简单开始,以后再配置更复杂的功能

server:
  port: 8765

# 请求和响应 GZIP 压缩支持
feign:
  httpclient:
    enabled: false
  okhttp:
    enabled: true
  compression:
    request:
      enabled: true
      mime-types: text/xml,application/xml,application/json
      min-request-size: 2048
    response:
      enabled: true

spring:
  application:
      name: ace-gateway
  redis:
      database: 2
      host: 127.0.0.1
      jedis:
        pool:
            max-active: 20
  rabbitmq:
      host: ${RABBIT_MQ_HOST:localhost}
      port:  ${RABBIT_MQ_PORT:5672}
      username: guest
      password: guest
  sleuth:
    enabled: true
    http:
      legacy:
        enabled: true
  cloud:
     gateway:
       discovery:
         locator:
           lowerCaseServiceId: true
           enabled: true
       routes:
        # =====================================
        - id: ace-auth
          uri: lb://ace-auth
          order: 8000
          predicates:
          - Path=/api/auth/**
          filters:
          - StripPrefix=2
        - id: ace-admin
          uri: lb://ace-admin
          order: 8001
          predicates:
          - Path=/api/admin/**
          filters:
          - StripPrefix=2
     nacos:
        discovery:
          server-addr: 127.0.0.1:8848
  sentinel:
    transport:
      dashboard: localhost:8080
logging:
  level:
    com.github.wxiaoqi.security.gate.v2: info

management:
  endpoints:
    web:
      exposure:
        include: '*'
  security:
    enabled: false

gate:
  ignore:
    startWith: /auth/jwt

auth:
  serviceId: ace-auth
  user:
    token-header: Authorization
  client:
    token-header: x-client-token
    id: ace-gate  #不填则默认读取spring.application.name
    secret: 123456

ribbon:
  eureka:
    enabled: true
  ReadTimeout: 60000
  ConnectTimeout: 60000
  MaxAutoRetries: 0
  MaxAutoRetriesNextServer: 1
  OkToRetryOnAllOperations: false

hystrix:
  threadpool:
    default:
      coreSize: 1000 ##并发执行的最大线程数,默认10
      maxQueueSize: 1000 ##BlockingQueue的最大队列数
      queueSizeRejectionThreshold: 500 ##即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 10000
6.2 nacos 观察服务状态

六 前端登录

后端服务启动后,就可以开始调试前端了。

1 浏览器输入 http://localhost:9527/ 2 用户名和密码都是 admin

3 登录后的样子

七 问题记录以及解决方案 1 启动 AuthBootstrap 报 Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0

记录一个错误Failure to find org.eclipse.m2e:lifecycle-mapping:pom:1.0.0的解决过程_有远大抱负的人不可忽略眼前的工作-CSDN博客https://blog.csdn.net/weixin_46544994/article/details/106940070

2 启动 AuthBootstrap 报 java.sql.SQLException: is unrecognized or represents more than one time zone. You must configure

java.sql.SQLException: is unrecognized or represents more than one time zone. You must configure_dream21st的博客-CSDN博客https://blog.csdn.net/qq_36305027/article/details/101678037

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/735437.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号