Page MenuHomePhabricator

Switchover plan from restbase to api gateway for wikifeeds
Closed, ResolvedPublic

Description

Mapping of production URLs to be routed to wikifeeds:

Service location: wikifeeds.discovery.wmnet
Service port: 4101
Use TLS: yes

  • Announcements endpoint
    • Production endpoint:
      • <domain>/api/rest_v1/feed/announcements
    • RESTBase endpoint:
      • <domain>/v1/feed/announcements
    • Wikifeeds endpoint:
      • <domain>/v1/feed/announcements
  • Onthisday endpoint
    • Production endpoint:
      • <domain>/api/rest_v1/feed/onthisday/<type>/<mm>/<dd>
    • RESTBase endpoint:
      • <domain>/v1/feed/onthisday/<type>/<mm>/<dd>
    • Wikifeeds endpoint:
      • <domain>/v1/aggregated/onthisday/<type>/<mm>/<dd>
  • Featured endpoint
    • Production endpoint:
      • <domain>/api/rest_v1/feed/featured/<year>/<mm>/<dd>
    • RESTBase endpoint:
      • <domain>/v1/feed/featured/<year>/<mm>/<dd>
    • Wikifeeds endpoint:
      • <domain>/v1/aggregated/featured/<year>/<mm>/<dd>
  • Random endpoint
    • Production endpoint:
      • <domain>/api/rest_v1/page/random/<format>
    • RESTBase endpoint:
      • <domain>/v1/page/random/<format>
    • Wikifeeds endpoint:
      • <domain>/v1/page/random/redirect/<format>

Only for wikimedia.org level (used by android apps):

  • RESTBase
    • {domain}/v1/feed/availability
  • Wikifeeds
    • {domain}/v1/feed/availability

Event Timeline

hnowlan renamed this task from Switchover plan from restbase to api gateway to Switchover plan from restbase to api gateway for wikifeeds.Jul 14 2023, 3:10 PM
hnowlan updated the task description. (Show Details)

Just to note that wikifeeds sends a different access-control-allow-headers header - restbase overrides this so it's not a major concern for the rest gateway.

< access-control-allow-headers: accept, x-requested-with, content-type

Change 938265 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] rest-gateway: add routes for wikifeeds

https://gerrit.wikimedia.org/r/938265

Looking at the spec, it appears there are a few more endpoints not covered: https://github.com/wikimedia/mediawiki-services-wikifeeds/blob/master/spec.yaml Should these also be configured? it also appears that aggregated is an alternate path for most (all?) endpoints - should all cases of this be catered for?

These were never exposed in public traffic so I don't think they need to be exposed now (also unnecessary risk)

Regarding aggregated are you referring to the query aggregated = true for example here? https://github.com/wikimedia/mediawiki-services-wikifeeds/blob/master/spec.yaml#L366
I think that wikifeeds has (some) aggregate implementation but for parity i just implemented what restbase is doing.

As regards aggregated stuff, I mean the difference between https://wikifeeds.discovery.wmnet:4101/en.wikipedia.org/v1/page/featured/2023/01/01 (2607 chars) and curl https://wikifeeds.discovery.wmnet:4101/en.wikipedia.org/v1/aggregated/featured/2023/01/01 (321309 chars). Just wanted to make sure as I typoed my tests and discovered that during testing - Happy to follow your lead on the above being the canonical list

The /aggregated path is to be exposed for the restbase replacement, the other shouldn't be exposed.

Change 938265 merged by jenkins-bot:

[operations/deployment-charts@master] rest-gateway: add routes for wikifeeds

https://gerrit.wikimedia.org/r/938265

Change 943609 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] rest-gateway: add citoid and wikifeeds egress

https://gerrit.wikimedia.org/r/943609

Change 943609 merged by jenkins-bot:

[operations/deployment-charts@master] rest-gateway: add citoid and wikifeeds egress

https://gerrit.wikimedia.org/r/943609

Not specific to this specific ticket but while checking the difftests between restbase and rest-gateway it looks like we have a missing header that is applied globally on restbase:

"content-location": "https://fr.wikipedia.org/api/rest_v1/feed/onthisday/all/11/23"

This is injected by the restbase codebase:
https://github.com/wikimedia/restbase/blob/50152c49dc8b8e7219bf00562ca4b37e7f057c8a/lib/content_location_filter.js#L70

I am not sure if its needed to be ported though.

From difftests:

  • Random endpoint redirects as expected
  • Announcements is return the same responses between restbase/gateway (although empty)
  • Onthisday mostly returns the same responses (there was a 10% responses with differences but it looked like it was a content change between the requests, structure was fine)

There were some missing headers but it should be fixed after this deployment chart bump:
https://gerrit.wikimedia.org/r/c/operations/deployment-charts/+/945539

I rerun the tests once again after the patch and it looks like we are good to go:

  • Failures for onthisday were transient or internal metadata/tids changed
  • Cache/content-type headers look OK

Change 945558 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/puppet@production] trafficserver: route wikifeeds requests via the rest-gateway

https://gerrit.wikimedia.org/r/945558

Lets hold on this because it looks like wikifeeds doesn't handle onthisday URL routing right. It only handles type=all currently working on a patch to fix the URL matching.

Change 945567 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[operations/deployment-charts@master] rest-gateway: Fix onthisday feed routing

https://gerrit.wikimedia.org/r/945567

Change 945567 merged by jenkins-bot:

[operations/deployment-charts@master] rest-gateway: Fix onthisday feed routing

https://gerrit.wikimedia.org/r/945567

Just tested the fix on staging and looks OK.

Something that we've not captured is /feed/availability which is only served under wikimedia.org RESTBase endpoint:

https://wikimedia.org/api/rest_v1/feed/availability

This brings the following 2 topics:

  • We should add a route for /feed/availability (its just passthrough to wikifeeds so its just a matter of rest-gateway routing) ?
  • How are we handling the namespacing pattern RESTBase implements (different configurations per group of wikis) ?

Change 945591 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[operations/deployment-charts@master] rest-gateway: Add route for wikifeeds availability

https://gerrit.wikimedia.org/r/945591

Change 945599 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/services/wikifeeds@master] Bump onthisday spec version to match restbase

https://gerrit.wikimedia.org/r/945599

Change 945591 merged by jenkins-bot:

[operations/deployment-charts@master] rest-gateway: Add route for wikifeeds availability

https://gerrit.wikimedia.org/r/945591

Change 945599 merged by jenkins-bot:

[mediawiki/services/wikifeeds@master] Bump onthisday spec version to match restbase

https://gerrit.wikimedia.org/r/945599

Change 945784 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/deployment-charts@master] rest-gateway: add availability route

https://gerrit.wikimedia.org/r/945784

Change 945784 abandoned by Hnowlan:

[operations/deployment-charts@master] rest-gateway: add availability route

Reason:

Already done

https://gerrit.wikimedia.org/r/945784

Change 945558 merged by Hnowlan:

[operations/puppet@production] trafficserver: route wikifeeds requests via the rest-gateway

https://gerrit.wikimedia.org/r/945558

Change 947327 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/services/wikifeeds@master] Add missing cache-control headers

https://gerrit.wikimedia.org/r/947327

Change 947327 merged by jenkins-bot:

[mediawiki/services/wikifeeds@master] Add missing cache-control headers

https://gerrit.wikimedia.org/r/947327

Change 947372 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/puppet@production] trafficserver: route wikifeeds

https://gerrit.wikimedia.org/r/947372

Change 947372 merged by Hnowlan:

[operations/puppet@production] trafficserver: route wikifeeds

https://gerrit.wikimedia.org/r/947372

Change 956895 had a related patch set uploaded (by Hnowlan; author: Hnowlan):

[operations/puppet@production] trafficserver: route to wikifeeds via rest-gateway

https://gerrit.wikimedia.org/r/956895

Change 956895 merged by Hnowlan:

[operations/puppet@production] trafficserver: route to wikifeeds via rest-gateway

https://gerrit.wikimedia.org/r/956895