Migrated website from python to nodejs and merged HAR docs - #1276
max-ostapenko wants to merge 47 commits into
Conversation
…ve static HTML Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…e.js-based infrastructure Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…mp and filter selection logic Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…r with custom scoped HTTP Archive navigation component Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…dding settings Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…alization and build workflows Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
….json Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
….css Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…_updated configuration Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
….js-based infrastructure
…te scripting' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ort, function or class' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…x page layout Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…nd modernize CSS properties Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…harts-init.js and remove static file generation Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…remove static css file Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
… 4 compatibility Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…rchive.org into visiting-snail
…e_modules from HTML linting Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…validation, and rewrite timeseries card generation logic Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…lighthouse source map validation Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…ricCheck; enhance security in file path resolution
… traversal vulnerabilities
|
@tunetheweb closed all TODO's. |
…al dev proxy server Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…and add 404 page support Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…ns element value in report initialization Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…and normalize sitemap URLs Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…ort Astro migration Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…support docs path in layout resolution Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
|
@tunetheweb here are the summarized changes. Preview deployment: https://httparchive--staging-supndlqf.web.app/ 1. Hosting
2. Custom 404 & SEO Parity
3. Development Workflow
4. GitHub Actions
5. Code Generators (
|
| Route Path | Production main (Flask) |
Migrated Version (Astro / Firebase) | Output Artifact |
|---|---|---|---|
/ |
server/routes.py: index() -> templates/index.html |
src/pages/index.astro |
dist/index.html |
/about |
server/routes.py: about() -> templates/about.html |
src/pages/about.astro |
dist/about/index.html |
/faq |
server/routes.py: faq() -> templates/faq.html |
src/pages/faq.astro |
dist/faq/index.html |
/reports |
server/routes.py: reports() -> templates/reports.html |
src/pages/reports/index.astro |
dist/reports/index.html |
/reports/[report_id] |
server/routes.py: report() -> templates/report/report.html |
src/pages/reports/[report_id].astro |
dist/reports/[report_id]/index.html |
/reports/techreport/landing |
server/routes.py: techreportlanding() -> templates/techreport/landing.html |
src/pages/reports/techreport/landing.astro |
dist/reports/techreport/landing/index.html |
/reports/techreport/tech |
server/routes.py: techreport() -> templates/techreport/techreport.html |
src/pages/reports/techreport/tech.astro |
dist/reports/techreport/tech/index.html |
/reports/techreport/[page_id] |
server/routes.py: techreportlanding() |
src/pages/reports/techreport/[page_id].astro |
dist/reports/techreport/[page_id]/index.html |
/docs/* |
N/A | src/content/docs/docs/* (Starlight MDX) |
dist/docs/* |
/404 |
server/errors.py -> templates/error/404.html |
src/pages/404.astro |
dist/404.html |
/sitemap.xml |
server/routes.py -> templates/sitemap.xml |
tools/generate/generate_sitemap.js |
public/sitemap.xml |
/robots.txt |
server/routes.py: static_from_root() |
public/robots.txt |
dist/robots.txt |
/favicon.ico |
server/routes.py: favicon() |
public/favicon.ico |
dist/favicon.ico |
8. HTTP Headers
Production Talisman headers (server/csp.py) were ported 1:1 into firebase.json for all routes (/**).
9. HAR
Migrated into content/docs/docs.
10. Server logic moved to API
See HTTPArchive/tech-report-apis#128
Note: I think it may be more ergonomic to merge API here, keeping closer to frontend.
|
@max-ostapenko finally coming round to look at this (apologies for the delay!) and stumbling at the first hurdle: I also see some merge conflicts. Can you look at resolving this and will have a look. |
Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
…larified icon documentation Signed-off-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
|
@tunetheweb resolved. |
| - name: Run the website | ||
| run: ./tools/scripts/run_and_test_website.sh | ||
| - name: Update timestamps | ||
| run: npm run timestamps |
There was a problem hiding this comment.
Out of interest why are these not needed? They are used to provide a lastmod to /sitemap.xml
There was a problem hiding this comment.
I was testing automating this step, and forgot to add it back.
|
|
||
| The test agents are run from [Google Cloud regions](https://cloud.google.com/compute/docs/regions-zones) across the US. Each URL is loaded once with an empty cache ("first view") for normal metrics collection and again, in a clean browser profile, using [Lighthouse](https://developers.google.com/web/tools/lighthouse). The data is collected via a [HAR file](https://en.wikipedia.org/wiki/.har). The HTTP Archive collects these HAR files, parses them, and populates [a public dataset in BigQuery](https://har.fyi/guides/getting-started/). | ||
|
|
||
| The test agents are run from [Google Cloud regions](https://cloud.google.com/compute/docs/regions-zones) across the US. Each URL is loaded once with an empty cache ("first view") for normal metrics collection and again, in a clean browser profile, using [Lighthouse](https://developers.google.com/web/tools/lighthouse). The data is collected via a [HAR file](https://en.wikipedia.org/wiki/.har). The HTTP Archive collects these HAR files, parses them, and populates [a public dataset in BigQuery](docs/guides/getting-started/). |
There was a problem hiding this comment.
| The test agents are run from [Google Cloud regions](https://cloud.google.com/compute/docs/regions-zones) across the US. Each URL is loaded once with an empty cache ("first view") for normal metrics collection and again, in a clean browser profile, using [Lighthouse](https://developers.google.com/web/tools/lighthouse). The data is collected via a [HAR file](https://en.wikipedia.org/wiki/.har). The HTTP Archive collects these HAR files, parses them, and populates [a public dataset in BigQuery](docs/guides/getting-started/). | |
| The test agents are run from [Google Cloud regions](https://cloud.google.com/compute/docs/regions-zones) across the US. Each URL is loaded once with an empty cache ("first view") for normal metrics collection and again, in a clean browser profile, using [Lighthouse](https://developers.google.com/web/tools/lighthouse). The data is collected via a [HAR file](https://en.wikipedia.org/wiki/.har). The HTTP Archive collects these HAR files, parses them, and populates [a public dataset in BigQuery](/docs/guides/getting-started/). |
|
|
||
| The HTTP Archive dataset is available publicly on BigQuery. Check out [Getting Started Accessing the HTTP Archive with BigQuery](https://har.fyi/guides/getting-started/). | ||
|
|
||
| The HTTP Archive dataset is available publicly on BigQuery. Check out [Getting Started Accessing the HTTP Archive with BigQuery](docs/guides/getting-started/). |
There was a problem hiding this comment.
| The HTTP Archive dataset is available publicly on BigQuery. Check out [Getting Started Accessing the HTTP Archive with BigQuery](docs/guides/getting-started/). | |
| The HTTP Archive dataset is available publicly on BigQuery. Check out [Getting Started Accessing the HTTP Archive with BigQuery](/docs/guides/getting-started/). |
There was a problem hiding this comment.
Why map.png instead of web.png as it was before? That's not a great name either to be honest so maybe hero.png is better?
| "lint:darwin:linux": "docker container run -it --rm --platform linux/amd64 -e SHELL=/bin/bash -v \"$PWD\":/app -w /app --entrypoint=./tools/scripts/run_linter_locally.sh ghcr.io/super-linter/super-linter:slim-v8", | ||
| "lint:win32": "docker container run --rm -e SHELL=/bin/bash -v \"%cd%\":/app -w /app/ --entrypoint=./tools/scripts/run_linter_locally.sh ghcr.io/super-linter/super-linter:slim-v8", | ||
| "test": "node ./tools/test", | ||
| "start": "npm run build && npx -y firebase-tools@latest emulators:start --only hosting", |
There was a problem hiding this comment.
This doesn't auto refresh when editing code. Should we use astro:dev which includes a server so doesn't need firebase?
Or is there some combo of both if you want to test e2e to include firebase?
There was a problem hiding this comment.
astro:dev definitely gives auto-refresh, not sure you can connect these 2 stages live.
There was a problem hiding this comment.
Do we really need the double nesting of docs in content/docs/docs/? I know it isn't surfaced to the user in the URL but it's still quite confusing...
There was a problem hiding this comment.
First docs/ is required by Astro, second is just a path.
Should we use any other path for docs?
| components: { | ||
| Header: './src/components/docs/Header.astro', | ||
| }, | ||
| sidebar: [ |
There was a problem hiding this comment.
I see a double hamburger menu in /docs:
Additionally, the original hamburger menu differs from the rest of the site (Reports is not, and cannot be expanded):
I think we're biting off too much in one go here and should split this PR into 3 PRs:
- Migrate from python to node
- Migrate from App Engine to Firebase
- Integrate har.fyi

datesandmetricsto API endpointsdocs/There were many duplicated and custom operations, like JS management and resources versioning, that are taken care of by framework anyway.