Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..13e02b95 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.github +.serverless +baovizta-api-sdk/target +docs +node_modules +target \ No newline at end of file diff --git a/.env b/.env new file mode 100644 index 00000000..3818eb96 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ + # Custom api URL (without the trailing slash like https://api.boavizta.org) + BOAVIZTA_API_URL="https://api.boavizta.org" \ No newline at end of file diff --git a/.env.dev b/.env.dev new file mode 100644 index 00000000..fabb2f15 --- /dev/null +++ b/.env.dev @@ -0,0 +1,2 @@ + # Custom api URL (without the trailing slash like https://api.boavizta.org) + BOAVIZTA_API_URL="https://dev.api.boavizta.org" diff --git a/.env.staging b/.env.staging new file mode 100644 index 00000000..3818eb96 --- /dev/null +++ b/.env.staging @@ -0,0 +1,2 @@ + # Custom api URL (without the trailing slash like https://api.boavizta.org) + BOAVIZTA_API_URL="https://api.boavizta.org" \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..3e72b1a5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +## Bug description + + + +## To Reproduce + + + +## Expected behavior + + + +## JSON OUTPUT + + + + +## Additional context + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..73a211f9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,26 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: +assignees: '' + +--- + +## Problem + + + +## Solution + + + +## Alternatives + + + +## Additional context or elements + + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..2b6e284f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "cargo" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + # Raise pull requests for version updates against dev branch + target-branch: "main" + - package-ecosystem: "npm" + # Look for `package.json` and `lock` files in the `root` directory + directory: "/" + # Check the npm registry for updates every day (weekdays) + schedule: + interval: "daily" + target-branch: "main" diff --git a/.github/workflows/docker-build-and-publish.yml b/.github/workflows/docker-build-and-publish.yml new file mode 100644 index 00000000..1844d82a --- /dev/null +++ b/.github/workflows/docker-build-and-publish.yml @@ -0,0 +1,63 @@ +name: Build and Publish docker image + +on: + push: + branches: + - 'main' + - 'dev' + tags: + - 'v*' + pull_request: + branches: + - 'main' + - 'dev' + +env: + REGISTRY: ghcr.io + +jobs: + build-and-push-docker-image: + name: Build Docker image and push to github docker repository + runs-on: ubuntu-latest + + steps: + - + name: Checkout code + uses: actions/checkout@v4 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/boavizta/cloud-scanner-cli + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - + name: Log in to the Container registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + # - name: Build Docker image + # run: docker build . --file Dockerfile --tag ${{ env.REGISTRY }}/boavizta/cloud-scanner-cli:latest + + # - name : Tag Docker image + # run: docker tag ${{ env.REGISTRY }}/boavizta/cloud-scanner-cli:latest ${{ env.REGISTRY }}/boavizta/cloud-scanner-cli:$(date +%s) + + # - name: Push image + # run: docker push -a ${{ env.REGISTRY }}/boavizta/cloud-scanner-cli diff --git a/.github/workflows/publish-doc.yml b/.github/workflows/publish-doc.yml new file mode 100644 index 00000000..47adc07d --- /dev/null +++ b/.github/workflows/publish-doc.yml @@ -0,0 +1,52 @@ +name: Publish doc to Github pages +on: + push: + branches: + - main +jobs: + publish-doc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: jontze/action-mdbook@v2 + with: + token: ${{secrets.GITHUB_TOKEN}} + # Optional Plugins have to be enabled + use-linkcheck: true + use-mermaid: true + use-toc: true + use-opengh: true + use-admonish: true + use-katex: true + - name: Show mdbook version + run: mdbook --version + - name: Show linkchecker version + run: mdbook-linkcheck --version + - name: Show mermaid version + run: mdbook-mermaid --version + - name: Show toc version + run: mdbook-toc --version + - name: Show open-on-gh version + run: mdbook-open-on-gh --version + - name: Show admonish version + run: mdbook-admonish --version + - name: Show katex version + run: mdbook-katex --version + - name: Deploy GitHub Pages + run: | + # This assumes your book is in the root of your repository. + # Just add a `cd` here if you need to change to another directory. + cd docs + mdbook build + mdbook test + git worktree add gh-pages + git config user.name "Deploy from CI" + git config user.email "" + cd gh-pages + # Delete the ref to avoid keeping history. + git update-ref -d refs/heads/gh-pages + rm -rf * + mv ../book/html/* . + git add . + git commit -m "Deploy $GITHUB_SHA to gh-pages" + git push --force --set-upstream origin gh-pages diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml new file mode 100644 index 00000000..7c759097 --- /dev/null +++ b/.github/workflows/rust-test.yml @@ -0,0 +1,23 @@ +name: test suite +on: [push, pull_request] + +jobs: + clippy: + name: cargo clippy and test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - run: cargo clippy + - run: cargo test --all-features + + + # test: + # name: cargo test + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: dtolnay/rust-toolchain@stable + # - run: cargo test --all-features diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..45eb8a41 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +cloud-scanner-cli/target/ +target/ +node_modules +.serverless +.env +.vscode +.idea/cloud-scanner.iml +.idea/modules.xml +.idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/404.html b/404.html new file mode 100644 index 00000000..5b0ac170 --- /dev/null +++ b/404.html @@ -0,0 +1,202 @@ + + +
+ + +This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +Block storage volumes are approximated either as SSD or HDD depending on cloud provider specific storage type.
+This is a basic estimation. It takes into account the size of the block storage volume.
+⚠ Only the manufacture impacts of the Block storage are returned. The impacts of the use phase are returned as zero (mainly because we lack the related data in current version of Boavizta API).
+AWS EBS volume type | Boavizta storage used for estimation | comments |
---|---|---|
st1 | HDD | |
sc1 | HDD | |
magnetic (standard) | HDD | |
gp2 | SSD | |
gp3 | SSD | |
io1 | SSD | |
io2 | SSD | |
unknown type | SSD | If it cannot identify the type of storage (like when a new type is introduced, cloud scanner uses SSD as an approximation) |
Not yet implemented.
+ +Cloud scanner relies on the Boavizta methodology and data to estimate the impacts of cloud resources.
+It performs an inventory of the resources used in a cloud account. It then returns impacts of the use phase but also impacts related to the manufacture of the identified resources (embodied impacts).
+Impact data is retrieved from BOAVIZTA reference data API v1.2.x.
+Cloud scanner estimates impacts according to the duration of use of cloud resources. It also considers the “intensity” of use (like the type of instance and CPU load for a VM or size of a disk for storage). The region of use is also considered to take into account the electricity mix of the region (carbon intensity).
+++Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24. Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. ⟨hal-04621947v1⟩
+
The general approach is to map cloud vendor specific ressources, either to Boavizta cloud resources (like for VM instances) or to more generic components (Block storage volumes are approximated as Boavizta HDD or SSD).
+But this approach means that a large portion of the cloud provider infrastructure is excluded from the estimation.
+⚠ Cloud scanner underestimates the impacts of a cloud account. Because it only considers the instances and block storage, many additional sources of impacts (network, potential redundancy, cloud control plan, buildings…) are not included in the estimation.
+ +See also other limits.
+The Boavizta methodology is described in Digital & environment : How to evaluate server manufacturing footprint, beyond greenhouse gas emissions? | Boavizta
+The impacts (use and embedded) are attributed according to the principles described in Cloud instances - Boavizta API documentation.
+The results of cloud scanner are similar to what you can visualize in Datavizta, but with automated inventory.
+Workload (or intensity of use) of instances is estimated using CPU load level as a proxy.
+The CPU load of AWS instances is retrieved using AWS Cloudwatch CPU metrics summary.
+Cloud scanner uses a sampling period of 15 minutes, but impacts metrics are returned as impacts equivalent to one hour of use.
+This means that instance impacts metrics data returned can be understood as: impact for one hour of use (considering the CPU workload of 15 last minutes)
.
Why this default sampling period of 15 minutes ?
+detailed monitoring
(extra feature) for 1 minute granularity: List the available CloudWatch metrics for your instances - Amazon Elastic Compute Cloud).Not implemented.
+ +Install Rust and linux-musl dependencies.
+# Install rust (see https://www.rust-lang.org/tools/install), validate when prompted
+curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+source "$HOME/.cargo/env"
+# Add Linux musl target (needed for cross compilation for aws lambda)
+rustup target add x86_64-unknown-linux-musl
+
+sudo apt update && sudo apt install -y musl-tools musl-dev
+
+# Test a build
+cargo build
+
+# build a release
+cargo build --release
+
+Tested method to build Rust on Windows is to use Windows Subsystem For Linux (WSL2)
+