rollthecloudinc / hedge

Award winning climate aware database trimming cloud carbon and costs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

17

Initiatives

hedge_earth_identity_small

HEDGE reimagines the way websites are built using the best sustainable technology solutions the industry has to offer.

HEDGING (Software Development): Limiting software exposure to carbon by using cleanest energy globally available.

  • Store: Repairing data storage for good.
    • Data storage that moves around the world using the cleanest energy.
  • Proxy: Rewriting the web for good.
    • Reverse proxy bouncing traffic to data centers using cleanest energy.
  • Track: Record and reduce for good.
    • Record emissions providing actionable intelligance for reduction and offseting.

Store

  • Problem: Traditional data storage has limited access to clean energy.
  • Solution: Provide data store that moves around the world using the cleanest energy.

Resolution:

Repair data storage for good providing REST APIs that move around world between cleanest energy grids to store data. Data is stored on Github using repositories rather than individual databases. Transactions are wrapped in electricity and carbon emissions scope 1,2,3 tracking/monitoring providing complete picture of emissions. Our REST API is distributed across all the regions below delegating cpu processing to the one with the lowest grid intensity.

Dev Enviornment: https://proxy.climateaware-dev.eco

AWS

Location Domain Mapping
Montreal https://ca-central-1.climateaware.eco canadacentral
Ashburn VA https://us-east-1.climateaware.eco eastus
San Fransisco https://us-west-1.climateaware.eco westus
Dublin https://eu-west-1.climateaware.eco ukwest
London https://eu-west-2.climateaware.eco uknorth
Frankfurt https://eu-central-1.climateaware.eco germanywestcentral
Stockholm https://eu-north-1.climateaware.eco northeurope/swedencentral

Azure

Location Domain Mapping
Norway East https://norway.climateaware.eco norwayeast

JSON API

Store JSON using the cleanest energy resources.

Method Proxy.CimateAware
GET https://proxy.climateaware.eco/db/owner/repo/shapeshifter/path/id
PUT https://proxy.climateaware.eco/db/owner/repo/shapeshifter/path/id
POST https://proxy.climateaware.eco/db/owner/repo/shapeshifter/path/id

The octostore API is the first carbon aware API being bounced to low intensity data centers using HEDGE.earth. You can follow in our footsteps by submitting a pull requests for your service to our HEDGE objects dev repo. Once you have tested, verified HEDGE.earth works with your API submit a pull request to HEDGE objects prod repo. See our emissionless.json service schema for reference and _schema.json for json schema defination of a HEDGE service. Valid regions can be found in the regions json file.

The POST body can be any valid JSON with an id property. The id property is used to distinguish unique json documents within the same provided path. The id of the parameter should match the id inside the json document body.

{
  "id": "6f39a72a-6af3-4348-9158-7f111a6d0352"
  "title": "My first document"
}

JSON Documents comitted via the shapshifter API will have the user id added automatically of the authenticated user that made the change.

Example Response:

{
  "id": "6f39a72a-6af3-4348-9158-7f111a6d0352"
  "title": "My first document",
  "userId": "cc149bd7-83ef-47c5-a397-eb0eb0068e0d"
}

View use cases for more specific examples.

Future Features:

  • Validation
    • Repository owners will be able to provide JSON schema files that are used to validate entities before commiting. Entities that fail validation will not be comitted producing error messaging instead.
  • Search
    • JSON documents become searchable using Open Search API and dashboards. Climate Warrior App installers will have access to both Open Search API and their own dashboards.
    • Index schemas will also be customizable including defining the schema documents will use for indexing.
  • Interactive Docs
    • Interactive swagger docs for each orgs database.
  • Notifications
    • Clients will be able to subscribe to various push notifications during the flow of saving data.
  • Webhooks
    • Developers will be able to alter incoming and outgoing data using their own custom webhooks. Including implementing their own validation strategy when JSON Schema doesn't fit the bill.

File API

Store Media and other files under 100MB using cleanest energy resources.

Big File API

Store Media and other files over 100MB using cleanest energy resources.

Proxy

  • Problem: API requests contribute to 83% of web carbon emissions
  • Solution: Maximize amount of clean energy used to fulfill API requests

Resolution:

To this end our contribution to reducing web carbon begins with generating a periodical renewables report of regional grid intensity levels across the globe from the Green Software Foundation carbon aware api for the next 5 minutes. The generated renewable report is used to redirect API requests to data centers within regions that are using the lowest carbon intense power sources. The API requests are redirected based on reported intensity levels inside the renewable report. Rewriting the definition of a reverse proxy to include the advantage of maximizing clean energy use.

Reverse proxy:

An application that sits in front of back-end applications and forwards client requests to those applications. Reverse proxies help increase scalability, performance, resilience, security and clean energy use. The HEDGE reverse proxy url is below for both the prod and dev environments. Request to register services will be promoted to prod once tested on dev via pull requests.

Method Endpoint Environment
ANY https://edge.hedge.earth/{service}/{proxy+} Production
ANY https://hedgeedgex.druidcloud.dev/{service}/{proxy+} Development

Javascript Package:

For CORs compatible APIs and Websockets the HEDGE proxy can be bypassed opting to use the HEDGE JavaScript package instead.The HEDGE JavaScript package carries out the same operations as the API but without wasting a network trip. Custom services can also be used without registering them as part of pull requests.

Import HEDGE

import { hedge } from '@rollthecloudinc/hedge';

Climate friendly POST request for service.

const method = 'POST';
const body = { id: "b83f9717-ab11-4e0f-a058-872af9bbe3ed", title: "Test Add", price: 50 };
const h = await hedge({ service: 'emissionless' });
const res = await h.bounce('/rollthecloudinc/classifieds/shapeshifter/ads/b83f9717-ab11-4e0f-a058-872af9bbe3ed', { method, body })

Hedge.bounce() has the same interface as fetch except the protocol (https://) and domain name are omitted.

The region that was used to make the request and comparisions between other regions carbon intensity levels can also be made.

const { region } = await h.region();
const { regionDocument } = await region.document();
console.log('region used', regionDocument.region);
const { difference } = await region.compare({ region: 'useast' })
console.log('difference in carbon intensity between region useast and the region used to carry out request.', difference)

The complete HEDGE Javascript API has been documented in our demo repository. The HEDGE javaScript API source code can be found under /lib/hedge.

Impact

HEDGE has HUGE potential reach and potential CO2 reduction impact, with over 90% of Developers using APIs and emitting 16 million tonnes of CO2 generated each year. HEDGE could be very simply incorporated by hundreds of thousands of APIs to reduce their emissions, aggregating into a large global reduction.

Future Features

  • Advertise & Promote Amount of carbon being saved
    • Electricity usage and carbon emission tracking and monitoring.
    • Website to submit servcies, track and monitor emissions globally, per org, per servce, region, etc.
  • Postman plugin (50 million APIs)
  • Serverless Framework plugin to incorporate into AWS API Gateway provisioning
  • Nginx and HaProxy extension
  • Other configuration as code platforms

Track

  • Problem: No real time monitoring for SCI that adjusts based on grid intensity of serverless AWS lambdas exists.
  • Solution: Build real time monitoring for SCI backed by powerful search and intelligance engine.

Resolution:

Lambda created as AWS log subscriber that runs after each execution of lambdas within an account. The lambda collects key info and metrics of each lambda run including electricity usage and carbon production. Carbon production is calculated based on the Cloud Jewels algorithm but adjusted for real time grid intensity which region the Lambda is being executed. The info is stored inside AWS Open Search where we than apply analysys using machine learning and AI to lower the overall carbon output.

Support

Roll the Cloud INC. is a registered 501(c)3 nonprofit US charity with the mission to exhile carbon from the web.

Contact Us

Follow Us

Contribute

About

Award winning climate aware database trimming cloud carbon and costs.


Languages

Language:Go 72.5%Language:Starlark 23.8%Language:JavaScript 3.7%