Skip to content

guardian/editions

Repository files navigation

Editions

The Guardian Editions app includes the UK Daily edition, Australia Weekend and other special editions. The app is available on Android and iOS phones and tablets.

Setup

If you haven't already it's worth running strap & then installing gu-base which adds a load of useful stuff including VSCode - the editor used by the editions team.

The project uses nvm so this will need to be installed before if it's not already. Do not install it using brew.

Once nvm is installed run nvm use.

Run make install, this will install the dependencies for all sub-projects.

You will need mobile and cmsFronts.s3Read credentials loaded. (NOTE: At present, if you have [default] credentials set in ~/.aws/credentials) the app won't build - best to delete these before continuing)

App setup

To run the client-side app, cd into projects/Mallard and check out it's README.

Subprojects

The project is split into several sub projects, located in the projects directory. Each of these contains a package.json and README.md file.

Installing, building, testing and linting

Make targets are used to build, lint, test and install dependencies. These can either run against one, some, or all of the subprojects.

  • make install install node dependencies with yarn
  • make validate run lint
  • make fix run lint with autofix
  • make test run unit tests
  • make build compile
  • make clean delete node modules and other build related things
  • make list

To run a make target against one project only, follow it with - and the project name:

make install-Mallard

To exclude one or more projects, set the EXCLUDE environment variable to the names of the project seperated by spaces. This is used on CI to produce backend only builds.

This is the mobile app for downloading and viewing Editions. It runs on Android and iOS via react-native.

This is the lambda which turns CAPI, fronts data and images into a format the app can use, it can be run as a local http service for development.

This is a collection of lambdas which form a step function which uses the backend to generate the contents of the S3 buckets which the app reads from.

This is the Amazon architecture for the backend and archiver, expressed as cdk.

This contains common which is the code shared between app and backends and crosswords which is the crossword.

Deployment

backend, archiver and aws

These all deploy in one go. The default github branch is main which automatically triggers CI deployment once someone merges code changes into it. If you need to deploy from a different branch (i.e. from a PR branch) first make sure it builds ok in teamcity job (Editions > Build) and make sure you choose the right branch before you press the run button in teamcity. Once the build completes successfully, make a note of the build number, go to riffraff, type/find the editions project and choose the build number you noted from teamcity. As usual, you can choose CODE or PROD to deploy depending on your needs.

Uploading iOS internal beta to testflight

There is a scheduled github action which runs everyday at 3pm and uploads an internal beta build to testflight.

To manually upload an internal beta

  1. Go to the scheduled github action
  2. Select Run Worflow
  3. Select which branch you would like to use the workflow from

Complete Process Flow

  1. Editors open the Fronts tool and collate the content for an issue.
  2. Editors click 'Proof'
  3. The list of articles forming the content is written to a json file in a specific s3 bucket
  4. A policy on that bucket notifies a function running in AWS Lambda service
  5. That function (and a bunch of others that follow it) produces the entire issue content and write it to a different s3 bucket ('proofed')
  6. The download location of that content is added to an index file in that bucket
  7. Editions click 'Publish' when it is ready
  8. That triggers another step function in 'archiver' which copy all the generated content in previous step to a different s3 ('published')
  9. The app is opened and fetches the index file
  10. The user chooses which issues they would like to have
  11. The app fetches those issues
  12. The user reads the e-paper, there is applause, fireworks, etc.

Notification Flow

  • Fronts tool (aka facia-tool)
    • owned by the cmsFronts account, facia-$STAGE stack

writes to

  • bucket published-editions-$STAGE
    • owned by the cmsFronts account, facia-db-$STAGE stack

which notifies

  • the lambda specified in the mobile account
    • Currently this is:
      • arn:aws:lambda:eu-west-1:201359054765:function:editions-proof-archiver-s3-event-listener-CODE
      • arn:aws:lambda:eu-west-1:201359054765:function:editions-proof-archiver-s3-event-listener-PROD

which kicks off the step function, which writes to

  • the s3 bucket editions-proofed-$STAGE

    • owned by the mobile account

until the complete issue is ready to publish, when it is copied to

  • the s3 bucket editions-published-$STAGE
    • owned by the mobile account