Hygieia 安装与配置

Hygieia是CapitalOne在2015年推出的DevOps又一开源利器,它是一个可配置的易于使用的Dashboard,用于实现DevOps的整个流水线的可视化。

本文主要提供简单的指引为方便开始使用Hygieia

Hygieia 安装与配置_第1张图片

下载编译Hygieia

从Github上克隆代码

git clone https://github.com/capitalone/Hygieia.git

编译jar包

1.      cd Hygieia 

2.      mvn clean install package

编译成功后,可以看到相应目录下生成对应组件的jar包


Hygieia 安装与配置_第2张图片

配置与部署

组件的部署需要顺序进行,配置前要预先安装MongoDB 否则API组件无法正常运行。

Windows 环境 MongoDB 安装

1、 在安装目录创建文件夹 ,在data文件夹下创建db,log文件夹,在log文件夹下创建空白文件MongoDB.log。


2、以管理员权限运行dos命令:

进入mongodb的bin目录下,运行下图命令:


Hygieia 安装与配置_第3张图片

 成功后另开一个控制台,在bin目录下运行mongo命令,选择dashboard,创建用户:


Hygieia 安装与配置_第4张图片

创建用户命令如下:

db.createUser( {

user: "db",         

pwd: "dbpass",         

roles: [  {role: "readWrite", db: "dashboard"} ]         

})

3、 为避免每次都要开两个控制台启动mongodb,我们可以将mongodb安装为windows服务:

成功后,运行

NET START MongoDB 开启服务。

Hygieia 组件配置

API 组件

每个组件是基于Spring Boot,需要配置api.properties文件用于初始化配置。

启动方式:java -jar api.jar --spring.config.location=/path/to/api.properties

spring.config.location 是api.properties 保存的位置

aip.properites 参数配置如下例子:    

#Database Name - default is test 

dbname= test 

#Database HostName - default is localhost 

dbhost=mongodb 

#Database Port - default is 27017 

dbport=27017 

#Database Username - default is blank 

dbusername= dashboard

#Database Password - default is blank 

dbpassword=dbpassword 

logRequest=false 

logSplunkRequest=false 

corsEnabled=false 

corsWhitelist=http://domain1.com:port,http://domain2.com:port 

feature.dynamicPipeline=enabled 

#Authentication Settings 

# JWT expiration time in milliseconds 

auth.expirationTime=3600000 

# Secret Key used to validate the JWT tokens 

auth.secret=secret 

auth.authenticationProviders= 

server.contextPath=/api

server.port=8080


UI组件安装

需预先安装nodejs。

执行命令:

npm install -g bower

npm install -g gulp

进入UI目录,执行(时间稍长,耐心等待)

npm install

bower install

成功后,执行

gulp serve 启动服务

collectors组件配置

1. Feature 监控

先配置好properties文件,在命令窗口执行:

Java -jar jira-feature-collector.jar --spring.config.location=\Hygieia\collectors\feature\jira\src\main\resources\application.properties

#Collector schedule (required)

feature.cron=0 */15 * * * *

#Page size for data calls (Jira maxes at 1000)

feature.pageSize=100

#In-built folder housing prepared REST queries (required)

feature.queryFolder=jiraapi-queries

#Jira API Query file names (String template requires the files to have .st extension) (required)

feature.storyQuery=story

feature.epicQuery=epic

feature.projectQuery=projectinfo

feature.memberQuery=memberinfo

feature.sprintQuery=sprintinfo

feature.teamQuery=teaminfo

feature.trendingQuery=trendinginfo

#Jira Connection Details

feature.jiraProxyUrl=

feature.jiraProxyPort=

# Trending Query: Number of days in a sprint (not-required)

feature.sprintDays=60

# Trending Query: Length of sprint week (not-required)

feature.sprintEndPrior=7

#Scheduled Job prior minutes to recover data created during execution time (usually, 2 minutes is enough)

feature.scheduledPriorMin=2

#Delta change date that modulates the collector item task - should be about as far back as possible, in ISO format (required)

feature.deltaCollectorItemStartDate=2018-01-01T00:00:00.000000

#Jira Connection Details

feature.jiraBaseUrl=http://localhost:8088

feature.jiraQueryEndpoint=rest/api/2/

#64-bit encoded credentials with the pattern username:password

#on a mac you con create them with : echo "username:password" | base64

#reference: https://www.base64decode.org/

feature.jiraCredentials=YWRtaW46ZGV2b==

#Start dates from which to begin collector data, if no other data is present - usually, a month back is appropriate (required) feature.deltaStartDate=2018-01-01T00:00:00.000000

feature.masterStartDate=2018-01-01T00:00:00.000000

# In Jira, general IssueType IDs are associated to various "issue"

# attributes. However, there is one attribute which this collector's

# queries rely on that change between different instantiations of Jira.

# Please provide a String Name reference to your instance's IssueType for

# the lowest level of Issues (e.g., "user story") specific to your Jira

# instance. Note: You can retrieve your instance's IssueType Name

# listings via the following URI: https://[your-jira-domain-name]/rest/api/2/issuetype/

# Multiple comma-separated values can be specified.

feature.jiraIssueTypeNames=Story,Task,Sub-task

# In Jira, your instance will have its own custom field created for "sprint" or "timebox" details,

# which includes a list of information. This field allows you to specify that data field for your

# instance of Jira. Note: You can retrieve your instance's sprint data field name

# via the following URI, and look for a package name com.atlassian.greenhopper.service.sprint.Sprint;

# your custom field name describes the values in this field:

# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]

feature.jiraSprintDataFieldName=customfield_10104

# In Jira, your instance will have its own custom field created for "super story" or "epic" back-end ID,

# which includes a list of information. This field allows you to specify that data field for your instance

# of Jira. Note: You can retrieve your instance's epic ID field name via the following URI where your

# queried user story issue has a super issue (e.g., epic) tied to it; your custom field name describes the

# epic value you expect to see, and is the only field that does this for a given issue:

# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]

feature.jiraEpicIdFieldName=customfield_10400

# In Jira, your instance will have its own custom field created for "story points"

# This field allows you to specify that data field for your instance

# of Jira. Note: You can retrieve your instance's storypoints ID field name via the following URI where your

# queried user story issue has story points set on it; your custom field name describes the

# story points value you expect to see:

# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]

feature.jiraStoryPointsFieldName=customfield_10002

# In Jira, your instance will have its own custom field created for "team"

# This field allows you to specify that data field for your instance

# of Jira. Note: You can retrieve your instance's team ID field name via the following URI where your

# queried user story issue has team set on it; your custom field name describes the

# team value you expect to see:

# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]

feature.jiraTeamFieldName=

# Set this to true if you use boards as team

feature.jiraBoardAsTeam=false



2. Code Repo配置

先配置好properties文件,在命令窗口执行:

java -jargithub-scm-collector-2.0.5-SNAPSHOT.jar --spring.config.location=\Hygieia\collectors\scm\github\src\main\resources\application.properties

#Database Name

dbname=dashboard

#Database HostName - default is localhost

dbhost=localhost

 #Database Port - default is 27017

dbport=27017

#Database Username - default is blank

dbusername=db

#Database Password - default is blank

dbpassword=dbpwd

#Collector schedule (required)

github.cron=0 */15 * * * *

github.host=github.com

#Maximum number of days to go back in time when fetching commits

github.commitThresholdDays=60

#Optional: Error threshold count after which collector stops collecting for a collector item. Default is 2.

github.errorThreshold=3

#This is the key generated using the Encryption class in core

github.key=

#personal access token generated from github and used for making authentiated calls

github.personalAccessToken=6dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


3. Quality 配置

先配置好properties文件,在命令窗口执行:

java -jar sonar-codequality-collector-2.0.5-SNAPSHOT.jar --spring.config.location=\Hygieia\collectors\build\sonar\src\main\resources\application.properties

#Database Name

dbname=dashboard

#Database HostName - default is localhost

dbhost=localhost

#Database Port - default is 27017

dbport=27017

#Database Username - default is blank

dbusername=db

#Database Password - default is blank

dbpassword=dbpwd

#Collector schedule (required)

sonar.cron=0 */5 * * * *

sonar.servers[0]=http://localhost:9000

#Sonar Authentication Username - default is blank

sonar.username=username

#Sonar Authentication Password - default is blank

sonar.password=pwd

#Sonar Metrics

sonar.metrics[0]=ncloc,line_coverage,violations,critical_violations,major_violations,blocker_violations,sqale_index,test_success_density,test_failures,test_errors,tests

#Sonar Version - see above for semantics between version/metrics

sonar.versions[0]=6.6


4. Build 配置

先配置好properties文件,在命令窗口执行:

java -jar jenkins-build-collector-2.0.5-SNAPSHOT.jar --spring.config.location=\Hygieia\collectors\build\jenkins\src\main\resources\application.properties

#Database Name

dbname=dashboard

# Database HostName - default is localhost

dbhost=localhost

# Database Port - default is 27017

dbport=27017

#Database Username - default is blank

dbusername=db

#Database Password - default is blank

dbpassword=dbpwd

#Collector schedule (required)

jenkins.cron=0 */5 * * * *

#The page size

jenkins.pageSize=1000

# The folder depth - default is 10

jenkins.folderDepth=10

#Jenkins server (required) - Can provide multiple

#jenkins.servers[0]=http://jenkins.company.com

#jenkins.niceNames[0]=[YourJenkins]

#jenkins.environments[0]=[DEV,QA,INT,PERF,PROD]

#Another option: If using same username/password Jenkins auth - set username/apiKey to use HTTP Basic Auth (blank=no auth)

jenkins.servers[0]=http://localhost:8080/jenkins

jenkins.usernames[0]=username

jenkins.apiKeys[0]=pwd

jenkins.niceNames[0]=

#Determines if build console log is collected - defaults to false

jenkins.saveLog=true



你可能感兴趣的:(Hygieia 安装与配置)