Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Financial-Times/google-amp

Repository files navigation

google-amp

Circle CI Known Vulnerabilities

AMP HTML rendering for FT articles

Getting started

  1. Install the project dependencies, make install

  2. Fetch the environment variables for the app, make .env

  3. Generate a self-signed certificate:

    make certificate
    

    And add the certificate to your keychain:

    security import cert.pem; security add-trusted-cert cert.pem
    
  4. Run the app (no build is required in development mode), make run

  5. Open https://local.ft.com:5050/content/<Content UUID>

Barrier flow diagram

https://app.lucidchart.com/invitations/accept/97a58184-f4b9-4ebf-b253-17f62799e460

Tests

To run the tests and linter locally, run npm test.

A Day in the Life of an AMP Article

  1. Google crawls FT.com and finds an article, /content/ffffffff-ffff-ffff-ffff-ffffffffffff
  2. The article has a <link rel="amphtml">, with href pointing to amp.ft.com/content/ffffffff-ffff-ffff-ffff-ffffffffffff
  3. The Google crawler fetches the AMP URL, which hits this service
  4. The amp-page.js controller runs
    1. It fetches the content from Elastic Search using n-es-client
    2. It runs various transforms on the article data and body HTML
    3. It renders the transformed data into the template and responds with it
  5. The crawler validates the returned markup, and if it's valid AMP markup, stores it in the AMP cache
  6. When a mobile user searches for something that returns articles from FT with AMP versions, they're preloaded, and if the user taps on one of those results the AMP page is displayed immediately.

Deployment

The main branch deploys automatically to prod once the tests are green. Pull requests deploy to review apps, look out for the @username deployed to google-amp-prod-eu-pr-XXX messages in the PR.

Rolling back

Use the Roll back to... button on the Heroku activity tab or the heroku releases:rollback command.