Hygieia is an open source dashboard tool developed by CapitalOne that provides visibility to developers and product owners. It integrates with code repositories, allows a view of the complete delivery pipeline in near real-time, and provides analysis of quality and performance. In this post, we will install the Hygieia dashboard on MacOS, configure the code repository with Bitbucket, and include a URL monitor. I will also provide a high-level review of installing and getting started with Hygieia.
Installing MongoDB
The prerequisites to installing Hygieia are Java, npm, Bower, Glup, Maven, and MongoDB.
First, we’ll install MongoDB.
We’ll install wget and download MongoDB via the website. Because we’re using MacOS, we can install wget with Homebrew:
$ brew install wget
Then, download the latest version of MongoDB:
$ wget https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-4.0.3.tgz
Extract it:
$ tar -xvf mongodb-osx-ssl-x86_64-4.0.3.tgz Go inside the MongoDB directory: $ cd mongodb-osx-x86_64-4.0.3 Create the directory to store the data: $ sudo mkdir -p /data/db/ Change the permissions of this folder: $ sudo chmod 700 /data/db Start the MongoDB service: $ sudo bin/mongod
In another terminal section, access the interactive shell of MongoDB:
$ bin/mongo
Define the database:
> use dashboarddb
Create a user with permission to write in the dashboarddb database:
> db.createUser( { user: "dashboarduser", pwd: "dbpassword", roles: [{ role: "readWrite", db: "dashboarddb" }] })
To finish, get out of the MongoDB shell.
> exit
Installing Hygieia
Next, install Maven with Homebrew:
$ brew install maven
Download Hygieia from GitHub using Git:
$ git clone https://github.com/Hygieia/Hygieia.git
Go to the Hygieia directory:
$ cd Hygieia-master
Run the Maven build. (This could take a while):
$ mvn clean install package
Create a file called api.properties to set up the configuration of Hygieia:
$ touch api/api.properties
Open the file and include the properties below:
# api/api.properties server.contextPath=/api server.port=8080 dbname=dashboarddb dbhost=localhost dbport=27017 dbusername=dashboarduser dbpassword=dbpassword
We can now start the Hygieia API with the JAR created with Maven, informing the properties file as a parameter:
$ java -jar api/target/api.jar --spring.config.location=api/api.properties -Djasypt.encryptor.password=hygieiasecret
Now, test if Hygieia is running, accessing the API URL:
http://localhost:8080/api/ping
(The expected result is only the exhibition of the word true.)
Installing the Hygieia UI
To access the Hygieia UI, we need to start a frontend project. Access the UI directory:
$ cd UI/
This project next needs Glup (a JavaScript tool that lets you automate mundane or time-consuming development tasks) to execute the command that will start the server. We can install Glup with npm:
$ npm install -g gulp
Now, install the frontend project’s dependencies:
$ npm install $ bower install Now, start the server: $ gulp serve
A new tab or browser window should open with the URL to access the project. If not, access the following URL:
Adding the Bitbucket feature
Inside the Hygieia directory, access the folder of the Bitbucket module:
$ cd collectors/scm/bitbucket/
Run Maven to install it:
$ mvn install
Create a property file to set up the configuration:
$ touch application.properties
Open the file and include the same configuration of MongoDB that was set up in api.properties. Additionally, you’ll need to set the configuration of your Bitbucket account. In bitbucket.key, you’ll need to access the public key associated with your Bitbucket account.
# collectors/scm/bitbucket/application.properties dbname=dashboarddb dbhost=localhost dbport=27017 dbusername=dashboarduser dbpassword=dbpassword logging.file=./logs/bitbucket.log git.cron=0 0/5 * * * * git.host=mybitbucketrepo.com/ git.api=/rest/api/1.0/ git.commitThresholdDays=15 git.product=server bitbucket.key=XXX
Now, start the module informing the configuration file as parameter:
$ java -jar target/bitbucket-scm-collector-3.0.0.jar --spring.config.name=git --spring.config.location=application.properties
Creating a dashboard
Accessing the UI project in the browser, we can create a new account to manage the dashboard. Open the http://localhost:3000 URL and click on “Don’t have an account?” to create a new account.
Just fill in the username, password, and the password confirmation to create a new account. Then, go back to the login page and sign in.
Click on “Create a new dashboard” to start the configuration of the developer dashboard.
As shown in the image of the form below, select Team Dashboard, and Select Widgets. This will allow you to select the features that will be available in your dashboard. Next, define the title, the application name, and click on “Create.”
On the next screen, select Repo, Monitor, and then click on “Create” to finish. The Repo widget will provide the configuration with Bitbucket to show the statistics of the repository. The monitor provides the URL status check with ping.
Configure Bitbucket
With the dashboard created, click on the name of the dashboard to access it. On the dashboard page, click on “Configure widget” below the Repo feature.
The Repo type is a list of all modules installed to access the code repositories. The installation of the modules is similar to our installation of Bitbucket.
Under Repo Type, choose Bitbucket. Paste the URL of the project inside the Repo URL field and define the branch that this widget will be associated with. Next, set the username and password if the repository is private. Then, click on “Save” to connect with Bitbucket.
Now we can see the statistics of the commits, pull requests, and issues of this branch.
Adding the URL monitor
Another feature that we will set up is the monitoring of URLs. This is a standard feature provided by Hygieia, and no installation is necessary. On the dashboard page, click on the engine icon on the right side of the Monitor feature.
Click on “Add service” and fill in the URL and a name for the application that you want to monitor. Then, click on “Save,” and wait for the icon to change to a green check according to the status received by the ping.
Our configured dashboard will look like the screen below with the widgets configured.
Conclusion
The Hygieia dashboard is a complete tool that lets you follow the flow of development of an application. There are several other features and widgets not discussed here that deserve a look (such as the configuration of Jenkins and Jira). With Hygieia, we can create dashboards that show the status of the project to the project manager, developers and the DevOps team. You can also create your own collector and associate it with other services you use, and you can add new widgets to customize the visualization of your data.