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