npm install -g npm
npm install -g yo
npm install -g generator-jhipster
windows下:
如下demo选择微服务应用。实际中根据本身需求生产项目。 1: Which *type* of application would you like to create? (Use arrow keys) Monolithic application (recommended for simple projects) //简单项目 Microservice application // 微服务应用 Microservice gateway // 微服务网关 JHipster UAA server (for microservice OAuth2 authentication) // 微服务认证 2 :What is the base name of your application? (huhuawei) 输入服务名称 3: As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port conflicts. (8081) 设置服务的端口号 4:What is your default Java package name? (com.mycompany.myapp) 设置包名 5:Which service discovery server do you want to use? (Use arrow keys) JHipster Registry (uses Eureka) Consul No service discovery 选择注册中心。通常选择Registry比较多 6:Which *type* of authentication would you like to use? (Use arrow keys) JWT authentication (stateless, with a token) // jwt OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)//Oauth2 OIDC 认证服务 Authentication with JHipster UAA server (the server must be generated separately) // Oauth2+jwt Uaa认证服务 选择受权中心 7: Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL) MongoDB Couchbase No database Cassandra 选择数据库支持Nosql跟常见RDMB数据库 8:? Which *production* database would you like to use? (Use arrow keys) MySQL MariaDB PostgreSQL Oracle Microsoft SQL Server 选择数据库,这边会出现两次第一次是production 第二次是devlopment 9:Do you want to use the Spring cache abstraction? 根据需求选择缓存 10:Do you want to use Hibernate 2nd level cache? (Y/n) 是否支持二级缓存 11: Would you like to use Maven or Gradle for building the backend? (Use arrow keys) Maven Gradle 12:Which other technologies would you like to use? 安装一些其余的组件。如ES,KAFKA之类的 13:Would you like to enable internationalization support? (Y/n) 支持国际化? 14: Please choose the native language of the application (Use arrow keys) English Estonian Farsi French Galician ........ 选择本地支持的语言包含中文 15:Please choose additional languages to install 能够额外安装其余语言 16:Besides JUnit and Jest, which testing frameworks would you like to use? Gatling Cucumber 选择测试框架,针对微服务http接口测试,生成测试报告 17:Would you like to install other generators from the JHipster Marketplace? 从jhipster市场中选择组件安装
选择linux服务器,安装docker; yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum list docker-ce --showduplicates | sort -r sudo yum install -y docker-ce sudo systemctl start docker sudo systemctl enable docker 拉取jhipster官方镜像 docker pull jhipster/jhipster:master 启动jhipster镜像,选择一个空文件/jhipster夹挂载到容器中 docker container run --name jhipster -v /jhipster:/home/jhipster/app -v ~/.m2:/home/jhipster/.m2 -p 8080:8080 -p 9000:9000 -p 3001:3001 -d -t jhipster/jhipster 进入容器中 docker container exec -it --user root jhipster bash 而后就能够生成项目了。与windows上操做无差异
Gateway: springcloud Zuul Proxy 进行动态路由微服务。html
Registry:主要封装了Eureka以及配置中心Config Server。java
Jhipster Console:封装了Elk监控 以及 sleuth zipkin 等分布式链路监控组件。node
Jhipster Uaa: 采用UAA用户登陆认证 OAUTH2集中式认证,默认不使用的话则是JWT无状态认证linux
上述仅仅是大致的架构,Jhipster内部使用了不少插件来进行敏捷开发,包括实体类JDL快速生成从数据库到Controller代码,开发效率很是之高。适合中小型企业采用,并且Jhipster支持DockerFile与Compose 文件生成,能够帮助咱们快速容器化服务部署。web