Green-Software-Foundation / hack

Carbon Hack 24 - The annual hackathon from the Green Software Foundation
https://grnsft.org/hack/github
14 stars 1 forks source link

Measure and report on the carbon impact of a website #97

Open heaversm opened 2 months ago

heaversm commented 2 months ago

Overview

User Story

As a web developer I want to know how to get started with the Impact Framework with the ultimate goal of measuring my website's carbon footprint.

Rationale

There are numerous components that go into measuring a website's carbon footprint, which vary greatly based on the specific website being measured These can be calculated using existing models in the IF repositories. However, calculating the impact of a real website requires carefully configuring the manifest file and choosing the right models as well as finding accurate input data.

When each of us started using the Impact Framework, we found we needed more support in configuring the manifest file etc and the content we've created aims to offer that support to other technologists.

Impact

If this idea is successfully implemented, the GSF will have a great number of resources to support people onboarding into the impact framework, including easily understandable tutorials, sample code, a plugin specifically for website measurement, and suggestions for improvements to the framework and surrounding infrastructure to enhance consistency and legibility of the framework overall.

Scope Of Work

List some of the tasks that will be required to implement this idea

Examples and resources

Originally posted by @jmcook1186 in https://github.com/Green-Software-Foundation/hack/discussions/35

Questions to be answered

Project team

@heaversm, @rachaelcodes, @rachanakabi, @iretep, @bro-mar

Terms of Participation

jawache commented 2 months ago

Hi @heaversm so excited to see this proposal, I've been thinking about this for a while we even tried to explore this middle of last year in an early version of IF (note much of the content in the ticket is out of date but it gives some insights perhaps that might be useful) https://github.com/Green-Software-Foundation/if/issues/58

There are two approaches here.

1 - Write a case study, so craft a manifest file to measure the impact of a website and document process, learnings, that all by itself would be a great learning experience as it will clearly identify gaps which need to be filled wit plugins and the best approach. It could form the guidelines for measuring websites using IF.

2 - Take a type of website and build tooling to make that type of website easy to measure in IF. That will require the creation of some plugins but would help with adoption and provide some end to end carbon metrics which is what's missing right now in the website carbon measurement ecosystem.

If you're intention is the second approach simply sucking in the data from various sources would be a great start, we call those importer models. So an importer to bring in data from google analytics about page views could be combined with the co2js plugin in a pipeline to automatically calculate your websites emissions.

Our GSF website is a static site so we were thinking of building an importer for github actions to tell us how many times it's been built, we'd combine that with some offline analysis to estimate energy per build and then create a plugin to multiply the num-builds with carbon-per-build to get the backend carbon cost.

Other thoughts we've had are about narrowing down the scope to say wordpress websites since a solution to measure wordpress end to end (backend and front end) would open the door to 25% of the internet (i'm not sure if wordpress exposes metrics which we can suck in as observations?)

iretep commented 2 months ago

happy to join!

heaversm commented 2 months ago

Hi @heaversm so excited to see this proposal, I've been thinking about this for a while we even tried to explore this middle of last year in an early version of IF (note much of the content in the ticket is out of date but it gives some insights perhaps that might be useful) Green-Software-Foundation/if#58

This is really helpful @jawache - thank you for the context. This will really help us get started.

heaversm commented 2 months ago

happy to join!

Thanks @iretep - can you provide some context into how you might like to contribute? (e.g. What would you like your role to be, what is your area of expertise, etc.?)

iretep commented 2 months ago

happy to join!

Thanks @iretep - can you provide some context into how you might like to contribute? (e.g. What would you like your role to be, what is your area of expertise, etc.?)

@heaversm - not sure exactly, my background is in software development. Do we have a call or something to kickoff the work or just connect here?

rachaelcodes commented 2 months ago

Hi heaversm I'm interested in this project - have you got a website in mind that you want to measure? Or is this project more about making a tool to generate an easy-to-read report based anyone using the IF on their website?

If you're still looking for contributors, I'm a software developer (mostly Python/JS) who also has a bit of an interest in technical writing and user experience if that's useful. Earlier this year, I experimented a bit with using the IF to measure the carbon impact of an AWS-hosted service, but know I could have gone into more depth with it.

heaversm commented 2 months ago

@rachaelcodes / @iretep - great! I would love to select a widely used website and / or platform - Wordpress has been suggested which I think is good, but there are no Wordpress websites I have access to at Mozilla. One potential site is mozilla.ai (created with Webflow, but there might be logistical issues toward getting access). Another is future.mozilla.org - but this is a bit of an obscure and custom build system.

Definitely open to any website / platform suggestions. Feel free to register for the team, and let me know if you do - I'll spend a few more days recruiting and then we can schedule a kickoff for next week to start planning.

Feel free, based on the info here, to start experimenting!

I'm keeping a running document here.

alexzurbonsen commented 2 months ago

Hi there, I missed this issue until now. Just followed the separate discussion issue on this repo so far. Already did some work on this issue in the last weeks for other reasons.

In case you are interested, I published the current status in a draft PR. Created a puppeteer and a lighthouse plugin. The latter is quiet young and I want to put more work into it, ideally. But the puppeteer plugin is more mature. Would be interested in what you think about this - if you like to take a look at it.

But I can imagine it is not really attractive to look at somebody elses code for something that you already made plans to build yourself. May be we can find some way to collaborate on this anyways...

rachaelcodes commented 2 months ago

Great thanks @heaversm , have signed up

heaversm commented 2 months ago

@alexzurbonsen - awesome - will take a look at this this weekend and follow up with you regarding your work. Love the idea of collaborating somehow. @rachaelcodes - thank you for signing up! Will be in touch shortly.

rachanakabi commented 2 months ago

I am Rachana, interested in the job. Can help in Coding, Testing & Article Preparation. email id: rachanakabi@yahoo.com

iretep commented 2 months ago

Hi Mike, I heard your part just now on the Hackathon section. I have access to 2 websites that I can tweak if we want:

  1. https://www.madeinpeace.world/ (on Wix)
  2. https://www.taste-dont-waste.com/ (on AWS)
heaversm commented 2 months ago

@iretep / @rachanakabi / @alexzurbonsen / @rachaelcodes (i see you already signed up) - Thank you all for your interest in this! Feel free to join this project if you haven't signed up separately, and regardless, if you would like to be involved in the discussion around this project, send me the best email to contact you at so we can coordinate a project kickoff time and discuss our preferred approach / roles / responsibilities / general intros etc. If you don't want to add it here, you can enter your info on this spreadsheet. Then we can get rolling.

If you haven't used the impact framework yet, see if you can get up and running on it.

Team Name: Web Sprouts 🪴

tofols commented 2 months ago

Hello @heaversm,

My name is Rachael and I am interested in joining this project. I have a background in Copywriting/Content and I am currently self-training as a UX Writer.

alexzurbonsen commented 1 month ago

Hi @heaversm, sorry for not responding sooner. I added my email to the google sheet you provided. I am not sure how much time I will have on the next days to contribute though.

Did you already kick off the project?

heaversm commented 1 month ago

@alexzurbonsen - sent you an email - we'd love to have you. Comment here if you don't see the email from me.

alexzurbonsen commented 1 month ago

@heaversm manifest file for the issue:

name: measure-webpage-demo
description: example manifest for estimating carbon emissions of a webpage
tags:
initialize:
  outputs:
    - yaml
  plugins:
    "timer-start":
      method: TimerStart
      path: '@wr24-greenit/if-webpage-plugins'
    "timer-stop":
      method: TimerStop
      path: '@wr24-greenit/if-webpage-plugins'
    "green-hosting":
      method: GreenHosting
      path: '@wr24-greenit/if-webpage-plugins'
    "measure-webpage":
      method: MeasureWebpage
      path: '@wr24-greenit/if-webpage-plugins'
    "co2js":
      method: Co2js
      path: '@wr24-greenit/if-webpage-plugins'
      global-config:
        options:
          firstVisitPercentage: 0.9
          returnVisitPercentage: 0.1
tree:
  children:
    child:
      pipeline:
        - timer-start
        - measure-webpage
        - timer-stop
        - green-hosting
        - co2js
      config:
        co2js:
          type: swd
        measure-webpage:
          lighthouse: true
          scrollToBottom: true
      inputs:
        - timestamp: '2024-01-01T00:00:00Z' # will be replaced by the actual timestamp
          duration: 1 # will be replaced by the time it took to execute the measure-webpage plugin
          url: https://www.tngtech.com
          resets: [true] # tells the timer-stop method to replace timestamp and duration
heaversm commented 1 month ago

Project Submission

Summary

We’ve built the guide we wish we’d had when we first used the Impact Framework along with examples, extensions and prototypes that we feel would make it easier for people to use in the future. It’s a pack of resources for web developers who are new to the Impact Framework to guide them through calculating the carbon impact of their websites. This includes: a video series demonstrating the Impact Framework, an article helping people understand the implementation stages and a plugin and example manifest that developers can use as a starting point.

Problem

The Impact Framework creates an incredibly flexible overarching structure for software impact measurement, with a plugin architecture that makes it possible to measure just about anything. But with this flexibility and the code-forward and nascent nature of the framework itself, it can be a bit daunting to navigate the varied and sometimes complex approaches each plugin takes toward measurement. Choosing the right plugins for your pipeline, understanding their required inputs, assumptions, order, and purpose, as well as decipher the output manifest file, can be intimidating for someone new to the green software space without proper guidance.

This complexity extends to developers of the plugins themselves - with the freedom afforded by the framework comes a lot of design decisions. What configuration options to allow, what units of measurement to enforce, what data to expose to the user in the output, and what logical prior or subsequent plugins might make sense to align with for common measurement tasks.

Our work in Carbon Hack 24 attempts to highlight, prototype, and address many of these issue we, as relative beginners, wrestled with and overcame in order to put the Impact Framework to use to measure website carbon.

Application

Our submission includes the following resources:

Prize category

📝 Best Content

Judging Criteria

Video

https://youtu.be/l3tUaNRjYQo

Artifacts

Currently Listed Here as well as above in "Application"

Usage

Visit each relevant artifact link for usage instructions on the specific component of interest.

Process

Each team member worked to their specific skillset in order to create deliverables for the overall submission:

Inspiration

Each of us on the team cares about the planet, and believes in the tools provided by the Green Software Foundation and other organizations as a way to build inroads toward more informed, optimized, and conscientious usage of technology for a sustainable future. The first step down that path for most of us was to first inform ourselves and share our knowledge.

Challenges

Accomplishments

We're proud of the great teamwork of each member of our scrappy team - we all found each other through the "looking for team members" discussion board, and our varied skillsets came together fairly seamlessly to create a large body of work despite busy lives and limited time.

We're also proud about how much we've learned about Green Software in the process - having developed skills through participation that we can carry forward into our own respective lives to further our education, collaboration, influence, and impact in the Green Software space.

Learnings

What's next?

How will your solution contribute long term to the Impact Framework eco-system

We discussed the potential to keep working on building what we started here as the Impact Framework develops and user adoption increases. We feel like we've built a pathway to adoption, some tools to do very common measurement tasks, as well as painted a picture of some tools and processes that the ecosystem could develop to make the Impact Framework even more powerful and user friendly.