Named after the Norse God of Light, this server generates daily reports that increase visibility of automation obstacles. The server can be accessed at https://baldr.perfecto.io/?cloud=FQDN&date=DATE-ISO-8601&securityToken=YOUR-SECURITY-TOKEN with the appropriate substitutions for the parameters listed. This article explains how to request a security token.
- Homebrew (
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
) - Git (
brew install git
) - Node.js 10.14.1 and npm 6.4.1 (
brew install node@10
) - PostgreSQL 11.1.0 (
brew install postgresql
) - pgAdmin4 3.6 (download and install it)
- Perfecto security token from a US-hosted tenant such as demo.perfectomobile.com. See this KnowledgeBase article.
-
Launch Terminal on your Mac.
-
Make sure prerequisites are installed. If Homebrew was already installed, be sure to run
brew doctor
and address any issues before installing other brew packages. -
Type
brew services start postgresql
to start PostgreSQL (if not already running) -
From your main development directory (I use ~/dev), type
git clone https://github.com/nstuyvesant/baldr.git
to clone the project -
Type
cd baldr && npm install
to connect to the directory and install NodeJS dependencies -
Type
psql -d postgres -f db_create.sql
to create the baldr database and populate it with sample data for a cloud called demo.perfectomobile.com with a snapshot for 2018-06-20 -
Type
npm start
-
To retrieve a customer-facing report, go to http://localhost:3000/?cloud=demo.perfectomobile.com&date=2018-06-19&securityToken=YOUR-SECURITY-TOKEN replacing YOUR-SECURITY-TOKEN with the value you got from the Prerequisite step
-
To view JSON returned by the API, go to http://localhost:3000/api/?cloud=demo.perfectomobile.com&date=2018-06-19&securityToken=YOUR-SECURITY-TOKEN replacing YOUR-SECURITY-TOKEN with the value you got from the Prerequisite step
-
To edit previously submitted JSON directly in the editor, go to http://localhost:3000/editor.html?cloud=demo.perfectomobile.com&date=2018-06-19&securityToken=YOUR-SECURITY-TOKEN replacing YOUR-SECURITY-TOKEN with the value you got from the Prerequisite step
-
To submit JSON via the API, go to http://localhost:3000/editor.html?cloud=demo.perfectomobile.com&securityToken=YOUR-SECURITY-TOKEN replacing YOUR-SECURITY-TOKEN with the value you got from the Prerequisite step
-
To run in production on Ubuntu 18.04, login to your server then type
sudo useradd baldr
to create a low-privileged user. -
Type
cd /home && sudo git clone https://github.com/nstuyvesant/baldr.git
-
Type
sudo chown -R baldr:baldr /home/baldr
-
Type
sudo chmod 755 /home/baldr && sudo chmod 744 -R /home/baldr/*
-
Type
cd /home/baldr
-
Type
su - postgres
-
Type
psql -d postgres -f db_create.sql
to create the database thenexit
-
Type
su - baldr
to open a shell as the baldr user -
Type
npm install
to install project dependencies thenexit
-
Type
sudo cp baldr.service /etc/systemd/system/
to copy the SystemD configuration file to the required directory -
Type
sudo systemctl daemon-reload
to reload the list of daemons -
Type
sudo systemctl start baldr
to start the Baldr Report Server on TCP port 3000 -
Type
sudo systemctl enable baldr
to enable it to run on startup -
Setup a reverse proxy for http://fqdn:3000 with an SSL certificate
-
Test by typing
curl https://fqdn/editor.html
-
Create a cron job for the report analyzer jar by adding this line to your crontab
0 0 * * * cd /home/baldr/uploader/; java -jar ReportAnalyzer-3.0.jar
-
Create a cron job that populates the quality score
0 2 * * * python /home/baldr/python/score_quality.py
-
db_create.sql - Creates the PostgreSQL database, functions to generate JSON and populates with sample data
-
app.js - Web server using ExpressJS with pg-native to serve report's UI and API for required JSON
-
editor.html - JSON editor page. Submissions from this page are stored in the underlying PostgreSQL database, vr, replacing any contents for the snapshot date.
-
sample-input.json - JSON sample loaded by default in the editor. It represents the valid format for JSON snapshot upserts.
-
sample-output.json - JSON sample returned by the HTTP GET handler in index.js. The difference from the input are the two properties: last7d and last14d. These are not part of the input as they are calculated from previous daily snapshots.