Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC 90: Sustainability roadmap #90

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
268 changes: 268 additions & 0 deletions text/090-sustainability-roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
# RFC [90](https://github.com/wagtail/rfcs/pull/90): Sustainability roadmap

- RFC: [090](https://github.com/wagtail/rfcs/pull/90)
- Author: Thibaud Colas
- Created: 2023-11-27
- Last Modified: 2023-11-27

## Abstract

Wagtail’s carbon footprint is on the order of thousands of tons of CO2-equivalent per year.
With Wagtail now having a [sustainability statement](https://wagtail.org/sustainability/) and the start of [documentation for sites to reduce emissions](https://docs.wagtail.org/en/stable/advanced_topics/sustainability_considerations.html#sustainability-considerations), we need a clearer roadmap to reduce the carbon footprint of Wagtail websites and Wagtail as a whole.

Creating this roadmap as an RFC will allow for community feedback, help contributors be aware of this effort as early as possible, and encourage collaboration.

To help with planning, we track possible improvements across three themes:

1. [**🔍 Measure the carbon footprint of Wagtail**](#-measure-the-carbon-footprint-of-wagtail)
2. [**📣 Spread the word**](#-spread-the-word)
3. [**📉 Reduce the carbon footprint of Wagtail**](#-reduce-the-carbon-footprint-of-wagtail)

With Wagtail being open source self-hosted software, the impact of this effort will be entirely dependent on the adoption of the improvements by Wagtail site implementers.

## Supporting activities

Here are possible activities which we could take on to support the creation and delivery of this roadmap.

- Creation of a sustainability team for Wagtail
- Upskill of Wagtail contributors via [Green Software for Practitioners course](https://training.linuxfoundation.org/training/green-software-for-practitioners-lfc131/)
- Review of [Green Software Patterns](https://patterns.greensoftware.foundation/) relevance for Wagtail & Wagtail websites
- Review of [Web Sustainability Guidelines](https://w3c.github.io/sustyweb/) relevance for authoring tools: [Authoring Tool Guidance sustyweb#22](https://github.com/w3c/sustyweb/issues/22)
- Audit Wagtail websites with [Web Sustainability Guidelines](https://w3c.github.io/sustyweb/)
- Review Wagtail on [Green Software Maturity Matrix](https://docs.google.com/document/d/1wa2lliXQeH6HE1JHqwjTFuVndRUXzxGlbYXRtTQxF5o/edit)
- Review of carbon footprint reductions attempted in past releases and already on the roadmap, tying them to the improvements listed below.
- Quantitative analysis of possible carbon footprint reductions to identify most promising improvements.

## Key measures

With a lot of room for climate change efforts to be data-driven, we propose the following key metrics to assess the impact of possible efforts across the three themes outlined above.

### Carbon footprint of Wagtail

As tons of CO2-equivalent emissions per year (tCO2e/year).

This is the total amount of carbon emissions generated by Wagtail as an open source organization and the websites using Wagtail.
It includes the emissions of Wagtail project infrastructure, maintainers, contributors, and users.
It includes the emissions of Wagtail websites, to the extent that they can be determined with publicly-available data.

This figure should be reported in accordance with the [Greenhouse Gas Protocol (GHG)](https://ghgprotocol.org/).
In particular, it should include all Scope 1, Scope 2, and Scope 3 emissions.

### Scoring of Wagtail websites on Web Sustainability Guidelines audits

As a median, average, or other measure of the statistical distribution of scores of Wagtail websites.

The score would be a yet-to-be implemented measurement of how well a website conforms with the [Web Sustainability Guidelines (WSG)](https://w3c.github.io/sustyweb/).
At its most basic, it could be a count of how many WSG success criteria are "passed". 3. **Number of Wagtail websites with a Net Zero target**.

The WSG aren’t well established yet, so this would require a lot of R&D work, and collaboration with the community group behind the guidelines.

### Number of Wagtail websites with a Net Zero target

As an absolute count of how many websites have such targets.

Websites with specific climate commitments would count whether the targets are present due to the websites’ local legal landscape, or a commitment of the website owner’s organization, or a specific goal at the level of the individual website.

## Possible improvements

### 🔍 Measure the carbon footprint of Wagtail

**Ideal outcome**: A community-wide understanding of how Wagtail websites and community efforts contribute to climate change. Methodologies we can confidently use to assess the impact of future work.

#### Top 3 improvements

Here are the top three improvements we would recommend prioritizing:

1. Create a methodology to measure the carbon footprint of Wagtail websites
2. Measure the carbon footprint of building Wagtail: Wagtail events
3. Establish a methodology to collect data about how many Wagtail websites there are and their characteristics

#### All improvements

Here all are possible improvements within this area:

- Create a methodology to measure the carbon footprint of Wagtail websites
- Measure the carbon footprint of building Wagtail:
- Wagtail project infrastructure
- Wagtail events
- Wagtail maintainers and contributors
- Establish a methodology to collect data about how many Wagtail websites there are and their characteristics
- Document a methodology to extrapolate the carbon footprint of all Wagtail websites from publicly-available data
- Create a methodology to measure the footprint of specific features
- Define more granular carbon footprint KPIs that could be referenced on a regular basis

#### Prior work

- [Results of the 2023 Wagtail Deployment Survey](https://wagtail.org/blog/2023-wagtail-deployment-survey/)
- [Wagtail docs: Sustainability considerations](https://docs.wagtail.org/en/stable/advanced_topics/sustainability_considerations.html)
- [Estimating Wagtail websites’ emissions](https://wagtail.org/blog/estimating-wagtail-websites-emissions/)
- [Greener coding - Making a 'gold' reference configuration with the Wagtail demo site](https://github.com/wagtail/wagtail/discussions/8843)
- [Django Developers Survey 2022](https://lp.jetbrains.com/django-developer-survey-2022/)

### 📣 Spread the word

**Ideal outcome**: Buy-in from Wagtail users and wider industry on the importance of sustainability, and the role of Wagtail in this.

#### Top 3 improvements

Here are the top three improvements we would recommend prioritizing:

1. Create a sustainability team for Wagtail
2. Refine Wagtail’s current sustainability statement, and make it more visible
3. Publish case studies on tackling sustainability-related requirements on Wagtail projects

#### All improvements

Here are all possible improvements within this theme:

- Refine Wagtail’s current sustainability statement, and make it more visible
- Organise sustainability-themed Wagtail events
- Sustainability sprint
- What’s New in Wagtail – sustainability edition
- Sustainability-themed Wagtail Space
- Create a sustainability team for Wagtail
- Publish case studies on tackling sustainability-related requirements on Wagtail projects
- Write a yearly sustainability report for Wagtail
- Improve the documentation’s "Sustainability considerations" page
- Create a sustainability improvements pitch deck to look for funding
- Attend sustainability events to represent Wagtail and find project sponsors
- Rate possible [Wagtail hosting providers](https://github.com/wagtail/wagtail/wiki/Wagtail-Hosting-Providers) on sustainability considerations

#### Prior work

- [Wagtail sustainability statement](https://wagtail.org/sustainability/)
- [Estimating Wagtail websites’ emissions](https://wagtail.org/blog/estimating-wagtail-websites-emissions/)
- [Evaluating the carbon footprint of Django and Wagtail sites | Django London](https://docs.google.com/presentation/d/1nt70OGv7yq-W0FOnaPeQAW42i6D1lMl3Fi_hEAADWgc/edit)
- [DjangoCon Europe 2021 – How to be a Djangonaut in a climate emergency](https://www.thegreenwebfoundation.org/talks/djangocon-eu-2021/)

### 📉 Reduce the carbon footprint of Wagtail

**Ideal outcome**: a lower carbon footprint for Wagtail websites and Wagtail as a whole.

#### Top six improvements

Here are our top six improvements we would recommend prioritizing:

1. Scale-to-zero CMS database
2. Scale-to-zero CMS server
3. Light YouTube embeds
4. Reporting of performance scores in the CMS
5. Starter templates focused on sustainability
6. Support for static sites with 90+% of CMS features

#### All improvements

Here are all possible improvements within this theme. Explanation of the columns:

- **Scope clarity**: how well-defined is the improvement? Is it clear what the improvement is, and how it would be implemented?
- **Impact**: how much of an impact would this improvement have on the carbon footprint of Wagtail websites?
- **Reach**: how many Wagtail websites would this improvement affect (given the sites were to upgrade to the relevant version)?
- **Complexity**: how complex would this improvement be to implement?
- **Measures**: what measures would we use to assess the impact of this improvement?

#### Shorter user journeys

| Improvement | Scope clarity | Impact | Reach | Complexity | Measures |
| --------------------------------------------------------------------------- | ------------- | ------ | ----- | ---------- | ------------------------ |
| schema.org or similar structured data as a first-party feature | Low | Low | 50% | Low | Time spent on site |
| Validation of Wagtail sites’ treatment in search knowledge graphs | Low | Low | 50% | Medium | Time spent on site |
| Yoast-style content analysis & reporting features for Wagtail sites | Low | Low | 50% | Medium | Time spent on site |
| Support for functionality like Rich Results, Web Stories, etc in CMS | Medium | Low | 5% | Low | Site page views |
| Better sitemap generation, including more of the site’s contents | Medium | Low | 5% | Low | Server-side energy usage |
| Redirects awareness, reporting, optimisation to reduce usage where possible | Low | Low | 1% | Low | Server-side energy usage |
| Canonical page awareness, reporting, optimisation to reduce duplications | Low | Low | 1% | Low | Server-side energy usage |
| Documentation of front-end performance issues in Wagtail | High | High | 10% | Low | CWV scores |
Comment on lines +165 to +174

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to sort these row by one of the columns (at a glance, I assumed it was sorted by Reach, but the last row is 10%)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I’d probably go for "Impact" and then "Reach" if we did that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we consider our CSP roadmap item here. I know it's security related but from my understanding it helps browsers know when to cache things better and stops additional unexpected scripts from running in the browser. When combined with nonce usage, we get a nice set of improvements for both security and performance in the browser.

E.g. https://techdocs.akamai.com/edgeworkers/docs/content-security-policy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I don’t think I’ve seen anyone make that case but there’s probably some performance benefits


#### Cloud infrastructure

| Improvement | Scope clarity | Impact | Reach | Complexity | Measures |
| ---------------------------------------------------------- | ------------- | ------ | ----- | ---------- | ------------------------ |
| Better CDN support, higher cache hit rates | Medium | Low | 10% | Medium | Server-side energy usage |
| Official "Wagtail on cloud" hosting guide | Medium | Low | 5% | Low | Server-side energy usage |
| Support for static sites with 90+% of CMS features | Medium | High | 10% | Medium | Server-side energy usage |
| Incremental rebuilds for static content | Medium | High | 1% | High | Server-side energy usage |
| Benchmarking of energy usage - scale-to-zero vs. always-on | High | Medium | 10% | Low | Server-side energy usage |
| Scale-to-zero CMS database | Medium | High | 10% | Medium | Server-side energy usage |
| Scale-to-zero CMS server on FaaS or container-as-a-service | Low | Low | 1% | High | Server-side energy usage |
| Documentation on preview / staging sites’ best practices | Low | Low | 1% | High | Server-side energy usage |
| Carbon-aware CMS server | Low | Medium | 10% | High | Server-side energy usage |
| Carbon-aware background jobs | Low | Medium | 10% | High | Server-side energy usage |
Comment on lines +178 to +189

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, would it make sense to sort by one of the columns?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we also consider the cloud impact of Wagtail itself (our main website, docs hosting) and the CI runners?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely! I’ll try to think of where to add this. I’m not sure this type of consideration needs an RFC as much, but it’s good to consider.

#### Media

| Improvement | Scope clarity | Impact | Reach | Complexity | Measures |
| --------------------------------------- | ------------- | ------ | ----- | ---------- | ------------------------------ |
| Responsive images | High | High | 50% | Medium | Image weight |
| Optimised Wagtail renditions | High | High | 50% | Medium | Image weight |
| AVIF images | High | High | 50% | Medium | Image weight |
| WebP images | High | High | 50% | Medium | Image weight |
| Lossless image optimisation (PNG) | High | High | 50% | Medium | Image weight |
| Lossy image optimisation (PNG, MozJPEG) | High | High | 50% | Medium | Image weight |
| Lazy-loading of images | Medium | High | 50% | Low | Image weight |
| Optional site images (low-carbon site) | Medium | High | 1% | Low | Image weight |
| Light YouTube embeds | High | High | 10% | Low | YouTube embed weight reduction |
Comment on lines +194 to +203

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again... although this might be sorted by complexity?


#### CMS features

| Improvement | Scope clarity | Impact | Reach | Complexity | Measures |
| ------------------------------------------- | ------------- | ------ | ----- | ---------- | ------------------------ |
| Dark mode | High | High | 50% | Low | Screen energy usage |
| Performance budgets in the CMS | Medium | High | 100% | Medium | CWV scores |
| Reporting of performance scores in the CMS | Medium | High | 100% | Medium | CWV scores |
| Duplicate files | Low | Low | 5% | Medium | Server-side energy usage |
| Starter templates focused on sustainability | Medium | High | 1% | Low | Server-side energy usage |

#### Data processing

| Improvement | Scope clarity | Impact | Reach | Complexity | Measures |
| --------------------------------------------- | ------------- | ------ | ----- | ---------- | ---------------------------- |
| Documentation for back-end performance issues | High | High | 10% | Low | Server-side energy usage |
| Background workers | Medium | Medium | 50% | Medium | Server-side carbon emissions |
| Wagtail cache tags aware of previews, drafts | High | High | 50% | Medium | Server-side energy usage |
| Template caching for admin | High | High | 100% | Low | Server-side energy usage |
| Wagtail-aware Django debug toolbar | High | High | 5% | Low | Server-side energy usage |
| SQL performance optimisations | High | High | 50% | Medium | Server-side energy usage |
| Rewrite performance-sensitive code in Rust | Medium | Medium | 100% | Medium | Server-side energy usage |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we also consider the CSS and JS assets loading in the admin?

These may not impact the front facing parts of the website but will impact the energy usage of those accessing the admin and the servers that host the Wagtail instances.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should! I’ll add it. I’ve been trying to quantify how much usage the admin gets based on internal data about Torchbox websites. It’s really hard.


#### Prior work

Prior work in Wagtail:

- [Willow v1.6: AVIF and support for optimizer libraries](https://github.com/wagtail/Willow/releases/tag/v1.6)
- [Greener coding - Making a 'gold' reference configuration with the Wagtail demo site](https://github.com/wagtail/wagtail/discussions/8843)
- [Preview-aware caching](https://docs.wagtail.org/en/stable/topics/writing_templates.html#wagtailcache)
- [Wagtail websites sustainability improvements](https://docs.google.com/spreadsheets/d/1TiX4D-nFd2F3vlFljZ0PYNLBq3ZPLeeQkDh8QH7LvRw/edit#)

Prior work outside Wagtail:

- [Quantifying greenness in FaaS](https://www.linkedin.com/pulse/quantifying-greenness-faas-lukasz-mastalerz/)
- [GSF carbon-aware SDK](https://github.com/Green-Software-Foundation/carbon-aware-sdk)
- [Contemplating codecs comparison - Cloudinary](https://cloudinary.com/blog/contemplating-codec-comparisons)
- [Organic Basics - Low impact website](https://github.com/Organic-Basics/ob-low-impact-website)
- [Granian – A Rust HTTP server for Python applications](https://github.com/emmett-framework/granian)

## Open questions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider our community platforms?

Maybe it's a bit too much scope (or not even measurable), but not only do we extensively use these tools but we also create an example for other communities. This might not need to be a comparison for adopting different platforms but it could involve insuring we see if the platforms actually have their own sustainability considerations/policy.

Off the top of my head; Slack, StackOverflow, Zoom (What's new in Wagtail, meetings), GitHub.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Definitely. Will try to think of where to add this.

### Should the Wagtail project have a Net Zero target or other formal climate commitment?

This would be unprecedented.
Net Zero commitments such as the [Paris Agreement](https://unfccc.int/process-and-meetings/the-paris-agreement), [Race to Zero](https://unfccc.int/climate-action/race-to-zero-campaign) or the [SBTi Corporate Net-Zero Standard](https://sciencebasedtargets.org/net-zero) aren't designed for open source projects.
They’re great ways to drive ambitious climate action nonetheless.
Comment on lines +248 to +250

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there are implications from calculating Wagtail's carbon footprint on this one that might be worth noting for discussion. If we're including that in the Wagtail project's overall carbon footprint, I think there's some imprecision in any claims to net zero and risk that decisions made wholly independent of the Wagtail project could impact a net zero target.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you expand @willbarton, on the imprecisions in particular? From my understanding you’re right, but this is the case with all carbon footprint accounting / Net Zero claims and wouldn’t be specific to Wagtail or open source more widely.


### Should the Wagtail project follow Web Sustainability Guidelines?

The [Web Sustainability Guidelines](https://w3c.github.io/sustyweb/) are a set of guidelines to help organizations reduce the environmental impact of their websites.
They are currently authored by a _Community Group_ at W3C, and as such don’t have the authoritativeness of web standards.
They’re still in draft, and not (yet) widely adopted.
Comment on lines +254 to +256

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be controversial? Are there reasons not to follow the WSG (and possibly influence their development by attempting to put them into practice)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see three reasons:

  1. They’re very recent, and as such harder to make use of than more established sets of guidelines.
  2. They’re evolving fast, so there’s a chance we’d do things and have some re-work if the guidelines evolve (not super concerned about this)
  3. They encompass a wider definition of sustainability than what we’re currently aiming for here (see the last sentence below).


### What do we mean by "sustainability"?

People mean different things when they talk about sustainability.
This is a good statement [from Wikipedia](https://en.wikipedia.org/wiki/Sustainability):

Sustainability is a social goal for people to co-exist on Earth over a long time.
Specific definitions of this term are disputed and have varied with literature, context, and time.
Experts often describe sustainability as having three dimensions (or pillars): environmental, economic, and social, and many publications emphasize the environmental dimension.
In everyday use, sustainability often focuses on countering major environmental problems, including climate change, loss of biodiversity, loss of ecosystem services, land degradation, and air and water pollution.

For Wagtail, the majority of current sustainability efforts are about environmental issues and climate change in particular, but guidelines like WSG have a much broader scope.