Skip to content

Commit b5d3f5e

Browse files
authored
Update documentation for pressing (guardian#24676)
* Update existing docs on pressing
1 parent 9919a3f commit b5d3f5e

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

admin/conf/routes

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ POST /ajax/clear
5050
POST /interactive-librarian/live-presser/*path controllers.admin.InteractiveLibrarianController.liveContentsPress(path: String)
5151
POST /interactive-librarian/read-clean-write/*path controllers.admin.InteractiveLibrarianController.readCleanWrite(path: String)
5252

53+
# Articles / Interactives Pressing
5354
GET /press/content controllers.admin.InteractiveLibrarianController.pressForm()
5455
POST /press/content/*path controllers.admin.InteractiveLibrarianController.press(path: String)
5556

docs/06-features-and-components/04-The-Interactive-Librarian/01-README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Interactive Librarian was introduced in July 2021 as part of the migration o
66

77
### Context: the Interactives DCR migration
88

9-
When DCR was acquiring the ability to render interactives, it was decided that the initial implementation would work as follows:
9+
When DCR was acquiring the ability to render interactives, it was decided that the initial implementation would work as follows:
1010

1111
1. Any interactive published before a given date, switch date, would be rendered by frontend.
1212
2. Interactives published after that date would be sent to DCR for rendering (unless wearing a opt-out tag).
@@ -23,33 +23,33 @@ The population of aws S3 with interactive content was performed on all past inte
2323

2424
In fact, at the time these lines are written, the "ideal" for us is DCR being able to render all past interactives eventually, in which case the Librarian will be removed from frontend since it would then not be used.
2525

26-
In order to perform te migration, Pascal introduced two [admin] routes
26+
In order to perform te migration, Pascal introduced two [admin] routes
2727

2828
```
2929
# Interactive Pressing
30-
POST /interactive-librarian/live-presser/*path
31-
POST /interactive-librarian/read-clean-write/*path
30+
POST /interactive-librarian/live-presser/*path
31+
POST /interactive-librarian/read-clean-write/*path
3232
```
3333

3434
The reason why those were added to the [admin] app instead of, say, [applications], (where Pascal would have found more natural to add them) is because the [admin] app is the only app that has write access to S3.
3535

3636
### live-presser
3737

38-
The first route
38+
The first route
3939

4040
```
41-
POST /interactive-librarian/live-presser/*path
42-
```
43-
41+
POST /interactive-librarian/live-presser/*path
42+
```
43+
4444
calls `InteractiveLibrarian.pressLiveContents`, triggers the retrieval of a live document and stores it to S3 in the **aws-frontend-archives-original** bucket
4545

46-
For instance, given document path
46+
For instance, given document path
4747

4848
```
4949
/books/ng-interactive/2021/mar/05/this-months-best-paperbacks-michelle-obama-jan-morris-and-more
5050
```
5151

52-
The corresponding end points are
52+
The corresponding end points are
5353

5454

5555
LOCAL: http://localhost:9000/interactive-librarian/live-presser/books/ng-interactive/2021/mar/05/this-months-best-paperbacks-michelle-obama-jan-morris-and-more
@@ -58,33 +58,33 @@ CODE: https://m.code.dev-theguardian.com/interactive-librarian/live-presser/boo
5858

5959
PROD: https://frontend.gutools.co.uk/interactive-librarian/live-presser/books/ng-interactive/2021/mar/05/this-months-best-paperbacks-michelle-obama-jan-morris-and-more
6060

61-
Which you call with
61+
Which you call with
6262

6363
```
6464
curl -X POST "https://frontend.gutools.co.uk/interactive-librarian/live-presser/books/ng-interactive/2021/mar/05/this-months-best-paperbacks-michelle-obama-jan-morris-and-more"
6565
```
6666

6767
### read-clean-write
6868

69-
The second route
69+
The second route
7070

71-
```
72-
POST /interactive-librarian/read-clean-write/*path
71+
```
72+
POST /interactive-librarian/read-clean-write/*path
7373
```
7474

7575
performs the read of a previously stored document, its "cleaning" and stores the outcome to bucket **aws-frontend-archive**.
7676

7777
### Notes
7878

79-
A. In order for the two [admin] routes
79+
A. In order for the two [admin] routes
8080

8181
```
8282
# Interactive Pressing
83-
POST /interactive-librarian/live-presser/*path
84-
POST /interactive-librarian/read-clean-write/*path
83+
POST /interactive-librarian/live-presser/*path
84+
POST /interactive-librarian/read-clean-write/*path
8585
```
8686

87-
to work, the **interactive-librarian-admin-routes** switch must be ON. Because calling those routes is not part of "normal operations" for frontend, the switch should be OFF, unless otherwise specified. It never expires.
87+
to work, the **content-presser** switch must be ON. Because calling those routes is not part of "normal operations" for frontend, the switch should be OFF, unless otherwise specified. It never expires.
8888

8989
B. Since a route was introduced for capturing the live content and another one was introduced for the "cleaning" (meaning reading from **aws-frontend-archives-original**, cleaning and writing to **aws-frontend-archive**), the reader could wonder where the code that actually performed those batch operations is. Answer: it is not part of the scala code. Pascal wrote a Ruby script to perform them. For the first run (batch storing to **aws-frontend-archives-original**, see documentation folder **02-Batch-01**)
9090

@@ -94,7 +94,7 @@ D. Note that the scripts given **02-Batch-01** and **03-Batch-02**, are not port
9494

9595
E. One question that was left out from the above discussion is "How did you find the Interactive URLs ?", alternatively "How did you build [03.interactive-urls.txt](./02-Batch-01/03.interactive-urls.txt) ?" That list is the outcome of calling CAPI. This is done by the script **01-interactive-urls**.
9696

97-
### The cleaning process.
97+
### The cleaning process.
9898

9999
The `read-clean-write` routes call
100100

@@ -120,7 +120,7 @@ def cleanOriginalDocument(document: String): String = {
120120
}
121121
```
122122

123-
This highlights the following: The two routes in [admin] that perform Interactive Pressing, are unlikely to really change in the future, but this doesn't mean that the Librarian itself is finished. In fact the missing part of the librarian is really the cleaning function, which could not have been written when the Libraian was born because we didn't know at the time which cleaning would be required.
123+
This highlights the following: The two routes in [admin] that perform Interactive Pressing, are unlikely to really change in the future, but this doesn't mean that the Librarian itself is finished. In fact the missing part of the librarian is really the cleaning function, which could not have been written when the Libraian was born because we didn't know at the time which cleaning would be required.
124124

125125
That function doesn't need to be written from scratch. There are cleaners dating back from R2 and R2 Pressing that can be reused or adapted. See code in [admin] / app / pagepresser
126126

@@ -130,7 +130,7 @@ The future of the Librarian, at the very moment the first version of this docume
130130

131131
- Ideally, one day, we will find a way for DCR to render past interactives and get rid of the Librarian. (This might not happen actually...)
132132

133-
- The Interactive Pressing routes in [admin] will probably stay, the **interactive-librarian-admin-routes** switch should remain off in normal circumstances and be activated by dotcom engineers when calling the routes for good reasons (for instance a new batch cleaning by calling the `read-clean-write` route).
133+
- The Interactive Pressing routes in [admin] will probably stay, the **content-presser** switch should remain off in normal circumstances and be activated by dotcom engineers when calling the routes for good reasons (for instance a new batch cleaning by calling the `read-clean-write` route).
134134

135135
- The team will figure out which kind of cleaning those past contents needs, update the `cleanOriginalDocument` function accordingly, and rerun the `read-clean-write` operation, for all past interactives. Note that an engineer will have to either adapt Pascal's scripts or write new ones in the programming language of their choice.
136136

docs/06-features-and-components/04-The-Interactive-Librarian/02-interactive-migration.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Below describes the migration process:
2323
- For articles greater than 5 years old, we will press everything by default.
2424
- For articles less than 5 years old, The Visuals team will provide a list of interactives that will not be pressed, everything else will be pressed.
2525

26-
If issues are found with a migrated interactive then we have the the option to fix in one of three different ways:
26+
If issues are found with a migrated interactive then we have the option to fix in one of three different ways:
2727
1. Pressing the piece
2828
2. Visuals team fixing the piece
2929
3. Dotcom adding support to the platform
@@ -53,7 +53,7 @@ For pressing a batch of interactives this is controlled using command line scrip
5353
2. For every URL make a request to /interactive-librarian/live-presser/{path}
5454
3. For every successfully pressed article make a request to /interactive-librarian/read-clean-write/{path}
5555

56-
To press a single interactive we can use the frontend admin tool. On the admin tool, select the new option ‘Press an interactive’, enter the full URL for the interactive, click ‘Press’ and wait for the response. If there’s an error in the response it’ll need to be reported to the dotcom team.
56+
To press a single interactive we can use the frontend admin tool. On the admin tool, select the new option ‘Press an article / interactive’, enter the full URL, click ‘Press’ and wait for the response. If there’s an error in the response it’ll need to be reported to the dotcom team.
5757

5858
**How do we know a page is pressed?**
5959

@@ -68,7 +68,7 @@ In the long term we’d like to mark pressed articles with a tracking tag (track
6868
**How can we view a pressed page?**
6969
To view a pressed page there are a couple of options:
7070
- Get the document from S3 directly (aws-frontend-archive).
71-
- Intermediate solution: add the interactive path to the frontend config (https://github.com/guardian/frontend/blob/dlawes/serve-pressed-interactives/common/app/services/dotcomrendering/PressedInteractives.scala#L11).
71+
- Intermediate solution: add the interactive path to the frontend config (https://github.com/guardian/frontend/blob/main/common/app/model/pressedContent.scala).
7272
- Long-term solution: add tag tracking/dcroptout to article.
7373

7474
**Can we opt-out of pressing and render via frontend or DCR?**
@@ -103,3 +103,5 @@ A potential solution for reverting a migrated interactive to its pre-DCR form:
103103
- At this point,we also press every interactive (but not serve all this content to readers). Pressing the content would mean we save how the interactive renders via the existing platform.
104104
- If an article is migrated to DCR but we're unhappy with how it appears, we could fall back to serving the pressed version.
105105

106+
## Articles Pressing
107+
Migration of 100% articles to DCR has been completed. In order to press articles, the same mechanism as interactives was used.

0 commit comments

Comments
 (0)