diff --git a/text/090-sustainability-roadmap.md b/text/090-sustainability-roadmap.md new file mode 100644 index 00000000..85de9471 --- /dev/null +++ b/text/090-sustainability-roadmap.md @@ -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". + +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://thib.me/evaluating-carbon-footprint-django-wagtail) +- [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 | + +#### 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 | + +#### 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 | + +#### 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 | + +#### 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 + +### 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. + +### 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. + +### 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.