GreenWebhook is a proxy or gateway between two systems that helps reduce your carbon footprint by dynamically routing or delaying traffic so that your workloads run when and where they will cause the lowest amount of carbon emissions.

Overview

๐Ÿ’š Welcome to Green Webhook! ๐Ÿ’š

Green Webhook is a proxy or gateway between two systems that intelligently chooses which endpoint to send a webhook event to in order to location shift or time shift (coming soon) compute workloads to the endpoint with the lowest carbon intensity. It uses the Carbon Aware SDK to check the impact of an increased demand on the electricity grid for the relevant locations.

By deploying your workload to multiple regions and configuring each endpoint along with its location within a Green Webhook you can reduce the carbon emissions caused by your workload.

Currently Green Webhook supports only Azure regions but as the Carbon Aware SDK adds more support for other locations Green Webhook will be able to support them too.

Green Webhook is built on RedwoodJS and uses:

React TypeScript GraphQL Prisma Postgres TailwindCSS

Create a webhook that runs code on your laptop via ngrok

  1. Create a NextJS app by running npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/api-routes-starter"
  2. Create pages/api/user.js with:
export default function handler(req, res) {
  res.status(200).json({ name: "John Doe" });
}
  1. In a terminal run npm run dev
  2. Install Ngrok
  3. In a terminal run ngrok http 3000
  4. Copy the URL output by Ngrok and add /api/user to the end
  5. Log in to https://greenwebhook.netlify.app and create a new webhook
  6. Paste the URL from step 6 into the destination
  7. Click Save
  8. Click on the Invocation URI link to trigger the webhook
  9. Confirm that the response is 200 and contains JSON { name: "John Doe" }

Currently the Carbon Aware SDK only supports a limited list of locations but when more locations are supported then we will be able to allow you to put in the location where your computer or laptop is running in order to determine if it is the location with the lowest carbon intensity.

Getting started developing locally

Prerequisites

Start by installing dependencies:

yarn install

Whilst that is running, create a file in the root folder called .env and copy the following into it:

# Used to encrypt/decrypt session cookies. Change this value and re-deploy to log out all users of your app at once.
# Run yarn redwood generate secret and copy the value below
SESSION_SECRET=YOUR_SESSION_SECRET
# SendInBlue secret for reset password emails to work (optional)
# Requires setting up a free account at https://www.sendinblue.com/
SEND_IN_BLUE_KEY=YOUR_SENDINBLUE_SECRET
# Create a free database via https://railway.app and replace YOUR_RAILWAY_DB_URL bellow with the connection URL
DATABASE_URL="YOUR_RAILWAY_DB_URL"
CARBON_AWARE_API_BASE_URI="https://carbon-aware-api.azurewebsites.net"

Replace YOUR_SESSION_SECRET with the secret generated by running yarn rw generate secret.

Create a free database via https://railway.app and copy the connection URL and replace YOUR_RAILWAY_DB_URL with it image

If you want to be able to send emails to reset passwords then you will need to create a SendInBlue account and create an API key and replace SEND_IN_BLUE_KEY with the API key.

Now when yarn install is finished you're ready to create the database tables in your Railway database.

yarn redwood prisma migrate dev

Once this finishes you should see tables appear in the database in Railway

image

Now you can run the app locally:

yarn rw dev

Your browser should automatically open to http://localhost:8910 where you'll see the Home page.

Frontend first with Storybook

Don't know what your data models look like? That's more than ok โ€” Redwood integrates Storybook so that you can work on design without worrying about data. Mockup, build, and verify your React components, even in complete isolation from the backend:

yarn rw storybook
Comments
  • Fix  create new webhook button

    Fix create new webhook button

    Clicking on the create new green webhook button doesn't do anything.

    Image

    Image

    Possibly there is something wrong in web/src/Routes.tsx but I haven't been able to work out what it is.

    bug 
    opened by jonparker 7
  • Endpoint decision algorithm

    Endpoint decision algorithm

    Algorithm for deciding which endpoint to call based on

    1. best avg carbon intensity for expected duration of processing
    2. scheduled in the bounds of provided max delay
    opened by mr-loop-1 2
  • Add time shifting support

    Add time shifting support

    In order to support time shifting ( delaying calling the webhook endpoint ) we need to setup scheduled functions in RedwoodJS / Netlify https://docs.netlify.com/functions/scheduled-functions/

    Supabase has support ( https://supabase.com/blog/postgres-as-a-cron-server ) but we're currently hosting the database on Railway which has support but requires a few more steps ( https://blog.railway.app/p/cron-jobs )

    opened by jonparker 2
  • add estimate logic

    add estimate logic

    Handles : Estimation should only be done if user has NOT entered an estimatedTime. By default, starting estimate is 5 minutes or 300 sec

    also handles: our estimation should not be reflected on webhookForm and user should see a blank field if he didn't provided it

    opened by mr-loop-1 1
  • changed schema to optional

    changed schema to optional

    Made the webhook id field in scheduled invocations as optional, so if a webhook is deleted, instead of giving out errors on connected scheduledInvocations it will simply blank the webhookId field.

    opened by mr-loop-1 1
  • Fixed 'Create New Webhook' button

    Fixed 'Create New Webhook' button

    Since Routes.tsx only passes button props in case of ScaffoldLayout only, the DefaultLayout.tsx has been modified to accomodate for the home and about page too.

    Fixes #29 and #27

    opened by mr-loop-1 1
  • Implement external auth

    Implement external auth

    Rather than use username and password auth stored in the DB an external provider should be used. Alternatively a magic link in an email could be used for all sessions.

    opened by jonparker 0
  • Create a scheduled invocations page for each webhook

    Create a scheduled invocations page for each webhook

    In the /webhooks route, where all webhooks are listed, create a show "schedules" button.

    On the new page, list all the schedules available for that webhook and seaprate them into two switchable menus of "scheduled" and "completed" based on the isCompleted boolean present in each element of array

    So,

    query FindWebhookById($id: String!) {
        webhook: webhook(id: $id) {
          id
          include: {
            scheduledInvocations: true
          }
        }
      }
    

    could do the trick

    opened by mr-loop-1 0
  • Success confirmation feature

    Success confirmation feature

    Add a feature that allows for the endpoint to call back to the webhook on some URL to notify that the job or workload has completed. This would enable more analytics of how much carbon emissions were saved by the Green Webhook moving the workload.

    Note that this wouldn't give an actual Kg of CO2 measurement as it would take much more work to know how many Killowatts of power the workload consumed.

    opened by jonparker 0
zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

Marto.eth 10 Aug 25, 2022
๐Ÿช The IPFS gateway for NFT.Storage is not "another gateway", but a caching layer for NFTs that sits on top of existing IPFS public gateways.

nftstorage.link The IPFS gateway for nft.storage is not "another gateway", but a caching layer for NFTโ€™s that sits on top of existing IPFS public gate

NFT.Storage 37 Dec 19, 2022
Deploy a multi-account cloud foundation to support highly-regulated workloads and complex compliance requirements.

Landing Zone Accelerator on AWS The Landing Zone Accelerator on AWS solution helps you quickly deploy a secure, resilient, scalable, and fully automat

Amazon Web Services - Labs 130 Dec 29, 2022
Polyfill `error.cause`

Polyfill error.cause. error.cause is a recent JavaScript feature to wrap errors. try { doSomething() } catch (cause) { throw new Error('message',

ehmicky 4 Dec 15, 2022
Zero Two Bot,A fully Modular Whatsapp Bot to do everything possible in WhatsApp by Team Zero Two

?? ???????? ?????? ???? ?? A Moduler WhatsApp Bot designed for both PM and Groups - To take your boring WhatsApp usage into a whole different level. T

Sam Pandey 69 Dec 25, 2022
The Happy Devs Leaderboard allows users to submit their scores. The app then ranks them from highest scores to the lowest.

HAPPY DEVS LEADERBOARD The HAPPY DEVS LEADERBOARD app allows users to submit their scores to be ranked on the Leaderboard. Live Demo Live Demo Link Bu

Benjamin Semah 3 Feb 10, 2022
to choose the best one of Gcoreโ€˜IPs for connection with lowest latency.

GcoreCDNIPSelector to choose the best IP from Gcore-CDN to reach the lowest latency and stable connections. Background Gcore's CDN provide a smooth ex

Bruce 6 Nov 5, 2022
Multithread emulator. The wrun allows you to dynamically run a function inside a Web Worker on the client side, without the needing of a dedicated file

wrun This lib allows you to dynamically run a function inside a Web Worker on the client side, without the needing of a dedicated file. This means tha

Felippe Regazio 9 Nov 5, 2022
Bitloops is Low-Code Workflow Orchestration platform that helps you build backend systems and APIs 10x faster.

Bitloops Bitloops is a scalable open source Firebase substitute that can support any database and workflow orchestration. Weโ€™re building Bitloops usin

Bitloops 21 Aug 9, 2022
A plugin that can find the paths between two notes. Not sure who will want to use it...

Obsidian Path Finder Plugin Install BRAT Install Obsidian42-BRAT plugin. Click Add new beta plugin and fill in jerrywcy/obsidian-path-finder. Activate

jerrywcy 29 Dec 31, 2022
Heliaia - a proxy that sits between your wallet and a node๐Ÿง‘โ€โš–๏ธ

Heliaia Heliaia is a proxy that sits between your wallet and a node, with the sole purpose to intercept transactions before they are broadcasted. Tran

Gregory Markou 45 Oct 26, 2022
A superfast and easy to use knowledge base to help your customers get the info they need, when they need it most.

A superfast and easy to use knowledge base to help your customers get the info they need, when they need it most. helpkb is an open-source Next.js (A

Mark Moffat 11 Dec 5, 2022
mirrord lets you easily mirror traffic from your production environment to your development environment.

mirrord lets you easily mirror traffic from your Kubernetes cluster to your development environment. It comes as both Visual Studio Code extension and a CLI tool.

MetalBear 2.1k Dec 24, 2022
Tenzi is a dice game. The player needs to roll dice until they are all the same. Clicking on a dice, freezes it at its current value between rolls. Best scores are saved to local storage.

Roll until all dice are the same Try me! Technologies Used Description Tenzi is a dice game used to demonstrate the use of React Hooks (useState, useE

Michael Kolesidis 7 Nov 23, 2022
proxy ๐Ÿฆ„ yxorp is your Web Proxy as a Service (SAAS) Multi-tenant, Multi-Threaded, with Cache & Article Spinner

proxy ?? yxorp is your Web Proxy as a Service (SAAS) Multi-tenant, Multi-Threaded, with Cache & Article Spinner. Batteries are included, Content Spinning and Caching Engine, all housed within a stunning web GUI. A unique high-performance, plug-and-play, multi-threaded website mirror and article spinner

4D/าต.com Dashboards 13 Dec 30, 2022
An example web extension, using MockRTC to intercept & debug your own WebRTC traffic

MockRTC WebExtension Example Part of HTTP Toolkit: powerful tools for building, testing & debugging HTTP(S), WebRTC, and more This is an example web e

HTTP Toolkit 3 Oct 14, 2022
Proxy but misspelled -- closed proxy for the internet

pyrox Proxy that runs on Cloudflare Workers. Setup Install wrangler2. npm install wrangler. Generate a public Ed25519 key, exported under SPKI mode wi

bots.gg 10 Sep 9, 2022