Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Justus-e committed Jul 27, 2022
1 parent 2de93a8 commit 075ffa6
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 16 deletions.
Binary file added LOGO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 45 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[![Test](https://github.com/Justus-e/DevOpsMetrics/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Justus-e/DevOpsMetrics/actions/workflows/test.yml)
# DevOpsMetrics

![](LOGO.png)

A tool to measure software delivery performance by calculating the four DORA Metrics

## Install on kubernetes
Expand All @@ -11,27 +13,25 @@ A tool to measure software delivery performance by calculating the four DORA Met

chart includes influxDB instance + grafana dashboard

## Start Container
### configuration

Build: `docker build . -t justusernst/devopsmetrics`
In default Configuration the API will be exposed: `<host>:30303/api`

Run: `docker run --name devopsmetrics --env-file <your_env_file> -p <PORT>:8080 -d justus-e/devopsmetrics`
Swagger Documentation: `<host>:30303/swagger`

Grafana instance: `<host>:30304`

## Environment Variables
#### import grafana dashboard

| var | description | example |
|:------------------|:------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------|
| **PORT** | _optional_ - Port on which the API should be listening (default: 8080) | 8080 |
| **API_KEY** | _required_ - Authorization Key for this Api required to access all Endpoints | 'SoMeRand0MS3curE5trinG' |
| **INFLUX_URL** | _required_ - URL of the InfluxDB instance that should be used | 'http://localhost:8086' |
| **INFLUX_TOKEN** | _required_ - Token to access InfluxDB (can be generated in the InfluxDB UI) | 'AmfWLq5PbC_89NkpO\[...]' |
| **INFLUX_ORG** | _required_ - Organization name of the InfluxDB instance | 'DevOpsMetrics' |
| **INFLUX_BUCKET** | _required_ - Name of the InfluxDB bucket where the events should be stored | 'events' |
| **GITHUB_URL** | _optional_ - GitHub URL of GitHub Server where the tracked Repo is stored (default: 'https://api.github.com') | 'https://api.github.com' |
| **GITHUB_USER** | _optional_ - Needed if Repository is private or on an Enterprise Server | 'justus-e' |
| **GITHUB_OAUTH** | _optional_ - Needed if Repository is private or on an Enterprise Server (can be generated in the GitHub UI) | 'ghp_bitz8n81coxxnYvZ\[...]' |
| **TEST_MODE** | _optional_ - If set to `true`, the app will start in Test mode, operating on a separate randomly generated Dataset (default: false) | true |
1. Open Grafana UI `<host>:30304`
2. Login with `admin` as username and password
3. change credentials if needed
4. select Create (+) > import
5. put id `16645` in the "import from grafana.com" field OR import via JSON
6. click load
7. as datasource select "InfluxDB"

You should now see the Dashboard without data.

## Setup on GitHub
### Create Personal access token
Expand All @@ -52,8 +52,37 @@ _optional if the Repository is public and on the regular GitHub server_
6. Select `Let me select individual events`
7. Check `Deployment statuses`, `Issues` and `Pushes`


## Start Container

Build: `docker build . -t justusernst/devopsmetrics`

Run: `docker run --name devopsmetrics --env-file <your_env_file> -p <PORT>:8080 -d justus-e/devopsmetrics`


## Environment Variables

| var | description | example |
|:------------------|:------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------|
| **PORT** | _optional_ - Port on which the API should be listening (default: 8080) | 8080 |
| **API_KEY** | _required_ - Authorization Key for this Api required to access all Endpoints | 'SoMeRand0MS3curE5trinG' |
| **INFLUX_URL** | _required_ - URL of the InfluxDB instance that should be used | 'http://localhost:8086' |
| **INFLUX_TOKEN** | _required_ - Token to access InfluxDB (can be generated in the InfluxDB UI) | 'AmfWLq5PbC_89NkpO\[...]' |
| **INFLUX_ORG** | _required_ - Organization name of the InfluxDB instance | 'DevOpsMetrics' |
| **INFLUX_BUCKET** | _required_ - Name of the InfluxDB bucket where the events should be stored | 'events' |
| **GITHUB_URL** | _optional_ - GitHub URL of GitHub Server where the tracked Repo is stored (default: 'https://api.github.com') | 'https://api.github.com' |
| **GITHUB_USER** | _optional_ - Needed if Repository is private or on an Enterprise Server | 'justus-e' |
| **GITHUB_OAUTH** | _optional_ - Needed if Repository is private or on an Enterprise Server (can be generated in the GitHub UI) | 'ghp_bitz8n81coxxnYvZ\[...]' |
| **TEST_MODE** | _optional_ - If set to `true`, the app will start in Test mode, operating on a separate randomly generated Dataset (default: false) | true |

## Local Dev

Run locally: `npm run dev`

Api Docs: `http://<your_host>/swagger`

## Links

Docker Image: [https://hub.docker.com/r/justusernst/devopsmetrics]()

Grafana Dashboard: [https://grafana.com/grafana/dashboards/16645]()
3 changes: 3 additions & 0 deletions deployment/devopsmetrics/templates/webapp-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ metadata:
type: Opaque
data:
api-key: {{ .Values.webapp.apiKey | b64enc }}
gh-user: {{ .Values.webapp.gitHubUser | b64enc }}
gh-oauth: {{ .Values.webapp.gitHubOauth | b64enc }}
gh-url: {{ .Values.webapp.gitHubUrl | b64enc }}
15 changes: 15 additions & 0 deletions deployment/devopsmetrics/templates/webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ spec:
secretKeyRef:
name: webapp-secret
key: api-key
- name: GITHUB_USER
valueFrom:
secretKeyRef:
name: webapp-secret
key: gh-user
- name: GITHUB_URL
valueFrom:
secretKeyRef:
name: webapp-secret
key: gh-url
- name: GITHUB_OAUTH
valueFrom:
secretKeyRef:
name: webapp-secret
key: gh-oauth
- name: INFLUX_ORG
valueFrom:
secretKeyRef:
Expand Down
3 changes: 3 additions & 0 deletions deployment/devopsmetrics/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ webapp:
nodePort: 30303
apiKey: #
testMode: #
gitHubUser: #
gitHubUrl: #
gitHubOauth: #

influxdb:
image: influxdb
Expand Down
2 changes: 2 additions & 0 deletions src/endpoints/githubHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ router.post("/github-hook", async (req, res) => {

const evaluateEvent = async (eventType, payload) => {
switch (eventType) {
case "ping":
return Promise.resolve();
case "push":
return evaluatePushEvent(payload);
case "deployment_status":
Expand Down

0 comments on commit 075ffa6

Please sign in to comment.