|
2 | 2 | title: "Quick Start"
|
3 | 3 | description: "One page summary of how to measure a sample application."
|
4 | 4 | lead: "One page summary of how to measure a sample application."
|
5 |
| -date: 2022-06-18T08:00:00+00:00 |
6 |
| -draft: true |
| 5 | +date: 2025-04-28T08:00:00+00:00 |
| 6 | +draft: false |
7 | 7 | images: []
|
8 | 8 | menu:
|
9 | 9 | docs:
|
10 | 10 | parent: "prologue"
|
11 |
| -weight: 130 |
| 11 | +weight: 2000 |
12 | 12 | toc: true
|
13 | 13 | ---
|
14 | 14 |
|
15 |
| -## Running a measurement with a GitHub Repository |
| 15 | +## Running GMT out of GitHub codespace |
16 | 16 |
|
17 |
| -The easiest way to run a measurement is to use our [Green Metrics Frontend](https://metrics.green-coding.io/request.html). |
| 17 | +If you do not want to install the Green Metrics Tool but just want to try out a quick running version use our [GitHub Codespace](https://github.com/green-coding-solutions/green-metrics-tool/). |
18 | 18 |
|
19 |
| -Here you can supply the link of our [easiest example application](https://github.com/green-coding-berlin/simple-example-application) and wait |
20 |
| -for an email to arrive to view a report. |
| 19 | +Just click on *Code* and then on *Create codespace on main* to start the Codespace. An interactive interface with instructions will guide you through first steps with the Green Metrics Tool. |
21 | 20 |
|
22 |
| -This example highlights that in order to measure an application you only need a repository which includes a |
23 |
| - [usage_scenario.json →]({{< relref "usage-scenario" >}}) file. |
24 |
| - |
25 |
| - |
26 |
| -## Running a measurement with a sample usage scenario |
27 |
| - |
28 |
| - |
29 |
| -### Prerequsites |
30 |
| - |
31 |
| -For the most basic setup you require: |
32 |
| -- a computer with a **Linux** operating system |
33 |
| -- `sudo` rights |
34 |
| -- `git` |
35 |
| -- `python3` including `pandas` and `pyyaml` |
36 |
| -- `docker` installed and preferably running in rootless-mode |
37 |
| - |
38 |
| -If you currently do not have these packages already available please refer to [Installation on Linux →]({{< relref "installation-linux" >}}), [Installation on macOS →]({{< relref "installation-macos" >}}) or [Installation on Windows (WSL) →]({{< relref "installation-windows" >}}) |
39 |
| - |
40 |
| -If you already have that and want to skip the installation, please only add one entry to your `/etc/hosts`: |
41 |
| - |
42 |
| -`127.0.0.1 metrics.green-coding.internal api.green-coding.internal` |
43 |
| - |
44 |
| -### Setting up a sample measurement run |
45 |
| - |
46 |
| -We will make the most basic example our tool can handle: |
47 |
| -- Base of **Ubuntu** base container. |
48 |
| -- Add the package `stress` from `aptitude` |
49 |
| -- Just run a 5 seconds stress run with default metrics providers |
50 |
| - |
51 |
| -So let's start: |
52 |
| -```bash |
53 |
| -git pull https://www.github.com/green-coding-berlin/green-metrics-tool /tmp/green-metrics-tool && \ |
54 |
| -cd /tmp/green-metrics-tool/Docker && \ |
55 |
| -cp compose.yml.example compose.yml |
56 |
| -``` |
57 |
| -Please now change the default password for your database. In our example we will use `superstar` |
58 |
| -```bash |
59 |
| -docker compose up -d && \ |
60 |
| -cd /tmp && \ |
61 |
| -mkdir easiest-application && \ |
62 |
| -cd easiest-application && \ |
63 |
| -touch usage_scenario.json |
64 |
| -``` |
65 |
| -Now please copy the following code inside the usage_scenario.json. |
66 |
| -```json |
67 |
| -{ |
68 |
| - "name": "Stress Container One Core 5 Seconds", |
69 |
| - "author": "Arne Tarara", |
70 |
| - "architecture": "linux", |
71 |
| - "setup": [ |
72 |
| - { |
73 |
| - "name": "ubuntu-base-container", |
74 |
| - "type": "container", |
75 |
| - "identifier": "ubuntu", |
76 |
| - "setup-commands": [ |
77 |
| - "apt update", |
78 |
| - "apt install stress -y" |
79 |
| - ] |
80 |
| - } |
81 |
| - ], |
82 |
| - "flow": [ |
83 |
| - { |
84 |
| - "name": "Stress", |
85 |
| - "container": "ubuntu-base-container", |
86 |
| - "commands": [ |
87 |
| - |
88 |
| - { |
89 |
| - "type": "console", |
90 |
| - "command": "stress -c 1 -t 5", |
91 |
| - "note": "Starting Stress" |
92 |
| - } |
93 |
| - ] |
94 |
| - } |
95 |
| - ] |
96 |
| -} |
97 |
| - |
98 |
| -``` |
99 |
| -In the code you see the *identifier* which references the **Ubuntu** base image. |
100 |
| - |
101 |
| -Under *flow* you see that we are just calling `stress -c 1 -t 5`, which will stress our CPU for 5 seconds on one core. |
102 |
| -```bash |
103 |
| -cd /tmp/green-metrics-tool/tools && \ |
104 |
| -python3 runner.py manual --folder /tmp/easiest-application --name testing-my-demo |
105 |
| -```` |
106 |
| - |
107 |
| -You should see an example output like so: |
108 |
| - |
109 |
| -```bash |
110 |
| -Having usage scenario .... |
111 |
| -.... |
112 |
| -Please access your report with the ID: XXXX-XXXX ... |
113 |
| -``` |
114 |
| - |
115 |
| -Now you can view the report as the first item in your metrics dashboard at `http://metrics.green-coding.internal:9142` |
| 21 | +<center><img style="width: 300px;" src="/img/codespace.webp" alt="GitHub Codespace how to start"></center> |
0 commit comments