ForkScalewayScalewaypublished Jan 24, 2024seen 5d

scaleway/cloud-assess

forked from kleis-technology/cloud-assess

Open original ↗

Captured source

source ↗
published Jan 24, 2024seen 5dcaptured 17hhttp 200method plain

scaleway/cloud-assess

Description: A nice piece of backend to report the enviromental footprint of your Cloud services to your clients.

Language: Kotlin

Stars: 0

Forks: 0

Open issues: 0

Created: 2024-01-24T20:08:30Z

Pushed: 2024-01-28T17:21:02Z

Default branch: main

Fork: yes

Parent repository: kleis-technology/cloud-assess

Archived: no

README:

Cloud Assess

!Repository Status !Tests

This is the official repository of Cloud Assess.

What is Cloud Assess?

Cloud Assess is an open-source tool to automate the assessment of the environmental impacts of cloud services.

![Cloud Assess](./assets/cloudassess.svg)

Table of Contents

1. [Getting Started](#getting-started) 2. [First Assessment](#first-assessment) 3. [How does it work?](#how-does-it-work)

  • [Trusted Library](#trusted-library)
  • [Adapt the models to your taste](#adapt-the-models-to-your-taste)

4. [License](#license) 5. [About us](#about-us)

Getting Started

First, you need to clone this repository:

git checkout git@github.com:kleis-technology/cloud-assess.git
cd cloud-assess

All the commands in the sections below are to be run from the root of this repository. We assume that you will run these commands in bash. If you are using another shell, please adapt the commands accordingly.

Docker-compose

You can run the server using docker-compose.

docker compose up -d

The API specification is available in the folder openapi. For a more interactive visualisation of the API, the docker-compose also spins up a swagger ui instance. Visit this page to explore the endpoints, DTOs and run example queries.

Local build and run

Requirements

To build the server, you will need

Then, set up the following environment variables.

export GITHUB_ACTOR=
export GITHUB_TOKEN=

Procedure

From the root of the git repository, run

./gradlew build

To run the server locally

SPRING_PROFILES_ACTIVE=localhost ./gradlew bootRun

The server should start listening for requests on localhost:8080.

Note that, if you are on Windows, use the command ./gradlew.bat instead of ./gradlew.

First Assessment

Each functional unit is associated with a specific API endpoint. For instance, say we want to assess the environmental impact of using a virtual machine. The request takes the following form:

{
"virtual_machines": [
{
"id": "c1",
"ram": {
"amount": 32.0,
"unit": "GB_hour"
},
"storage": {
"amount": 1024.0,
"unit": "GB_hour"
},
"meta": {
"region": "sofia",
"env": "production"
}
}
],
"internal_workload": {
"ram": {
"amount": 10.0,
"unit": "GB_hour"
},
"storage": {
"amount": 50.0,
"unit": "GB_hour"
}
}
}

In this request, we specify the usage of our virtual machine in terms of the quantity of RAM and storage used (in GB * hour). The request also includes the so-called "internal workload": that represents the virtual machines that are necessary to operate the service but that are not directly associated with clients.

Running this request yields an impact assessment with the 16 well-known LCA indicators. Of course, in this example, we ran the assessment for a single virtual machine, but nothing stops you from assessing as many virtual machines as you want.

Expand to see what the result looks like.

{
"virtual_machines": [
{
"request": {
"id": "c1",
"quantity": {
"amount": 1.0,
"unit": "hour"
},
"meta": {
"region": "sofia",
"env": "production"
}
},
"impacts": {
"ADPe": {
"total": {
"amount": 1.2442674861138006E-7,
"unit": "kg Sb-Eq"
}
},
"ADPf": {
"total": {
"amount": 0.5856626163896165,
"unit": "MJ, net calorific value"
}
},
"AP": {
"total": {
"amount": 2.4412031648686188E-4,
"unit": "mol H+-Eq"
}
},
"GWP": {
"total": {
"amount": 0.04522166507916957,
"unit": "kg CO2-Eq"
}
},
"LU": {
"total": {
"amount": 0.004520589981659305,
"unit": "u"
}
},
"ODP": {
"total": {
"amount": 0.06362503350653016,
"unit": "kg CFC-11-Eq"
}
},
"PM": {
"total": {
"amount": 6.97494882258087E-9,
"unit": "disease incidence"
}
},
"POCP": {
"total": {
"amount": 1.6048978567682187E-9,
"unit": "kg NMVOC-Eq"
}
},
"WU": {
"total": {
"amount": 1.1112742040640779E-4,
"unit": "m3 world eq. deprived"
}
},
"CTUe": {
"total": {
"amount": 0.789792211082212,
"unit": "CTUe"
}
},
"CTUh_c": {
"total": {
"amount": 9.6110170405875E-12,
"unit": "CTUh"
}
},
"CTUh_nc": {
"total": {
"amount": 3.969223225207655E-10,
"unit": "CTUh"
}
},
"Epf": {
"total": {
"amount": 1.497996507152073E-5,
"unit": "kg P-Eq"
}
},
"Epm": {
"total": {
"amount": 3.918786733484802E-5,
"unit": "kg N-Eq"
}
},
"Ept": {
"total": {
"amount": 3.99503638233262E-4,
"unit": "mol N-Eq"
}
},
"IR": {
"total": {
"amount": 6.123032983267816E-5,
"unit": "kBq U235-Eq"
}
}
}
}
]
}

How does it work?

Trusted Library

The ambition of Cloud Assess is to offer a library of *transparent*, *PCR-compliant* and *executable* LCA models in the sector of digital services. More precisely, this work builds on the existing PCR for data center and cloud services. The PCR defines 11 functional units, covering the hosting infrastructure (physical datacenter) up to more abstract UFs, e.g., Software Services. Cloud Assess aims at covering the UFs at software level, but also UF that are not explicitly covered by the PCR

| PCR No. | Functional Unit | Status | |---------|-----------------------|-------------| | 6 | Virtual machine | ✅ | | 7 | Database | in progress | | 8 | Block storage | in progress | | 9 | Platform as a Service | planned | | 10 | Function as a Service | planned | | 11 | Software as a Service | planned | | n/a | Object storage | in progress | | n/a | Mail server | in progress |

These models are specified under the folder trusted_library.

Adapt the models to your taste

Structure

The models are written in the LCA as CODE language. This is a domain-specific language...

Excerpt shown — open the source for the full document.