Skip to content

Commit

Permalink
Merge branch 'main' into join-slim
Browse files Browse the repository at this point in the history
  • Loading branch information
riverma committed Mar 19, 2024
2 parents b614193 + 91319ba commit 6c48b0a
Show file tree
Hide file tree
Showing 6 changed files with 365 additions and 169 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
**/node_modules
**/package-lock.json
/build/**
.DS_Store
2 changes: 1 addition & 1 deletion docs/contribute/submit-best-practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ The final step in the contribution process involves the review and potential mer
3. **Final Decision**: Once your pull request meets all the criteria and standards of the SLIM project, the committers will decide to merge your contribution into the main branch. Alternatively, they might request additional changes if needed.
This process ensures that every contribution is in line with the project's goals, standards, and quality expectations, contributing to the overall excellence and reliability of the SLIM project.
This process ensures that every contribution is in line with the project's goals, standards, and quality expectations, contributing to the overall excellence and reliability of the SLIM project.
123 changes: 123 additions & 0 deletions docs/guides/software-lifecycle/metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Metrics

<pre align="center">A Guide for Configuring and Deploying Software Lifecycle Metrics Tracking.</pre>

![slim-dashboard](../../../../static/img/slim-dashboard-devlake.png)
*Example Metrics Dashboard using Apache DevLake*

## Introduction

Metrics collection is important for project management and software quality assurance. We recommend [Apache DevLake](https://devlake.apache.org/) for easy tracking and analysis. This guide simplifies its installation and configuration, especially for developers new to metrics collection.

**Use Cases**:

- Collecting and analyzing [DORA metrics](https://devlake.apache.org/docs/DORA/) along with many others for your project.
- Creating a visual dashboard to view metrics from multiple sources (e.g., GitHub, JIRA) in one place.
- Streamlining the setup and configuration of Apache DevLake through a *single-command* setup step.
- Gain insight into organizational and project performance for software development and the overall software lifecycle.

**Why We Chose Apache DevLake:**

Our decision to select Apache DevLake was informed by thorough trade study documentation, available [here](https://github.com/NASA-AMMOS/slim/issues/117#issuecomment-1802302091).

---

## Prerequisites

- Familiarity with [Docker](https://docs.docker.com/engine/install/) as well as a running instance of it
- A familiarity with validated software metrics is not required for this tool but it is recommended

---

## Quick Start

To quickly deploy DevLake on one of your servers or locally for testing, we've developed a convenient 1-step command. Please ensure Docker is running on your system before executing this command.

The purpose of this script is to automate the installation process DevLake recommends [here](https://devlake.apache.org/docs/GettingStarted/DockerComposeSetup). The script does the following:

- Checks for necessary software: ensures you have Docker and docker-compose installed to run DevLake.
- Downloads required files: automatically retrieves setup files if they're not already present on your system.
- Prepares setup files: adjusts file permissions and sets up the necessary environment variables for DevLake.
- Secures the setup: generates a unique encryption key for data security.
- Starts DevLake: uses Docker to initialize the DevLake application in the background and guides you to visit a web address to start using DevLake for data analysis and viewing dashboards.

**Run This Command in Your Terminal and Then Move on to the Next Step of the [Configuration Guide](#step-by-step-configuration-guide):**

```bash
cd /path/to/your/chosen/deployment/directory
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/NASA-AMMOS/slim/main/docs/guides/software-lifecycle/metrics/metrics-starter-kit/install_devlake.sh)"
```

**To Stop Services:**

1. Navigate to the directory containing your `docker-compose.yml` file (where you ran the above command).
2. Run the following command to gracefully stop all containers defined in the `docker-compose.yml` file:

```bash
docker-compose down
```

**To Restart Services:**

1. Navigate to the directory containing your `docker-compose.yml` file.
2. Run the following command to start containers for services defined in the `docker-compose.yml` file:

```bash
docker-compose up -d
```

The `-d` flag runs containers in detached mode, allowing them to run in the background.

---

## Step-by-Step Configuration Guide

1. Run the **[Quick Start](#quick-start)** steps above.
2. Once you have a working DevLake instance, we recommend going through DevLake's [official start guide](https://devlake.apache.org/docs/Overview/Introduction/#2-configuring-data-source) step-by-step, beginning with the data sources section.
3. If you're interested in sharing your dashboards with your community but are unable to host a server, you can export your dashboards by following the instructions provided [here](https://grafana.com/docs/grafana/latest/dashboards/create-reports/).

There are two additional topics we'd like to emphasize. Our recommendations for data sources and metrics to collect.
### Recommended Data Sources
We recommend, at a minimum, connecting the following data sources (see the DevLake docs on [configuring data sources](https://devlake.apache.org/docs/Overview/Introduction#2-configuring-data-source) for further assistance):
- [GitHub](https://devlake.apache.org/docs/v0.20/Configuration/GitHub)
### Recommended Metrics to Collect
See [this list](https://devlake.apache.org/docs/Metrics) of metrics on the DevLake documentation guide for why certain metrics are important and how to collect them. As a minium, we recommend the following metrics should be collected for your projects:
- [Change Failure Rate](https://devlake.apache.org/docs/Metrics/CFR): *"The percentage of changes that were made to a code that then resulted in incidents, rollbacks, or any type of production failure."*
- [Lead Time for Changes](https://devlake.apache.org/docs/Metrics/LeadTimeForChanges): *"The median amount of time for a code change to be deployed into production."*
---
## Frequently Asked Questions (FAQ)
- **Q:** How do I customize the DevLake Quick Start script for more functionality?
- **A:** If you have already provided DevLake with a data source, you can further configure your dashboard by following [this guide](https://devlake.apache.org/docs/Configuration/Dashboards/GrafanaUserGuide). Use simple queries to gather the information you need.
- **Q:** How do export the Grafana dashboard to a PDF?
- **A:** You can use [this](https://github.com/IzakMarais/reporter) tool.
---
## Credits
**Authorship**:
- Dillon Dalton [ddalton-jpl](https://github.com/ddalton-jpl)
- Rishi Verma [riverma](https://github.com/riverma)
---
## Feedback and Contributions
We value your feedback and welcome contributions to improve this guide. Please see our [contribution guidelines](https://link-to-contribution-guidelines).
---
**Acknowledgements**:
- The [NISAR](https://nisar.jpl.nasa.gov/) and [SWOT](https://swot.jpl.nasa.gov/) missions for their experience deploying and using DevLake.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

###############################################################################
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################

echo "=== Apache DevLake Installation ==="

echo "Step 1: Prerequisites"
echo "Make sure you have Docker v19.03.10+ and docker-compose v2.2.3+ installed."
echo "If you have Docker Desktop installed, docker-compose is already included."

CURR_DEV_LAKE_VERSION="v0.20.0-beta4"
DOCKER_COMPOSE_URL="https://github.com/apache/incubator-devlake/releases/download/${CURR_DEV_LAKE_VERSION}/docker-compose.yml"
ENV_EXAMPLE_URL="https://github.com/apache/incubator-devlake/releases/download/${CURR_DEV_LAKE_VERSION}/env.example"

# Check if docker-compose.yml and env.example already exist
if [ ! -e docker-compose.yml ] && [ ! -e env.example ]; then
echo "Step 2. Downloading docker-compose.yml and env.example"
wget $DOCKER_COMPOSE_URL
wget $ENV_EXAMPLE_URL

chmod 660 docker-compose.yml
chmod 660 env.example

echo "Step 3. Renaming env.example to .env..."
mv env.example .env
else
echo "Existing docker-compose.yml and env.example found. Skipping download."
fi

echo "Step 4. Generating encryption key..."
encryption_key=$(openssl rand -base64 2000 | tr -dc 'A-Z' | fold -w 128 | head -n 1)

# Check if .env file exists
if [ -e .env ]; then
existing_content=$(cat .env)
printf "%s\nENCRYPTION_SECRET=\"%s\"\n" "$existing_content" "$encryption_key" >.env
else
printf "ENCRYPTION_SECRET=\"%s\"\n" "$encryption_key" >.env
chmod 660 .env
fi

# Step 5: Run Docker Compose to launch DevLake
echo "Step 5: Launching DevLake with Docker Compose"
docker-compose down
docker-compose up -d

# Step 6: Collect data and view dashboards
echo "Step 6: Collect data and view dashboards"

echo "Visit http://localhost:4000 in your browser to configure DevLake and collect data."
echo "=== Installation Completed ==="
Loading

0 comments on commit 6c48b0a

Please sign in to comment.