Page MenuHomePhabricator

Locally Run Pingback Code
Closed, DeclinedPublic

Description

Current Situation:

  • Currently, the pingback code is located in the Wikibase extension of MediaWiki. We pull pre-packaged releases of MediaWiki to run Wikibase Suite, so any changes made to the pingback code would not be represented in an instance of Suite we might run.

Goal:

  • Ultimately, we would like to be able to edit the pingback code, run a Wikibase instance, and see the resulting data sent by the pingback.

Acceptance Criteria:

  • We can run a Wikibase instance and see pingback data
  • We can modify pingback code and see a change in the resulting data

[optional] Notes:

  • Meeting with Itamer next week regarding the development of pingback, hopefully they have some insight on how to locally run the code.

[optional] Open Questions:

  • Does this need to be in a Wikibase Suite instance in specific, or could we use some other method of running the code?

Event Timeline

RickiJay-WMDE changed the task status from Open to In Progress.May 24 2024, 8:56 AM
RickiJay-WMDE added a subscriber: ItamarWMDE.

Per @ItamarWMDE :

  1. install mediawiki thru mwcli
  2. install wikibase extension through gerrit/git
  3. create mock server for requests
  4. change pingback settings to mock server's url
  5. make changes
  6. commit
  7. review
  8. profit

HOKAY

Use mwcli to install mediawiki, using their first install guide.

You should have a Main Page running locally.

You do not need to re-install after this point. Running maintenance scripts will take care of the database upgrades; refreshing a page should trigger a fresh read of the LocalSettings.php file.

Installing Wikibase:

As outlined in PrPl Dev Env Cheat Sheet, fetch Wikibase code.

While their LocalSettings.php guide does include an example of wfLoadExtension(), DO NOT FOLLOW THAT EXAMPLE. Instead, use the configuration from the Wikibase/Installation guide. The maintenance scripts will need to be run inside the container; the Docker-Development-Environment/Mediawiki guide shows how to do that.

IN PRACTICE

Making use of the beacon.mjs script in the wikibase-release-pipeline repo does allow you to listen to localhost:8081; it returns the list of every request it's gotten in JSON format.

You can confirm that by simply poking localhost:8081 in a browser.

IN THEORY

Adding the following to LocalSettings.php should enable pingback and point it to localhost:8081.

$wgWBRepoSettings['wikibasePingback'] = true;
$wgWBRepoSettings['pingbackHost'] = 'localhost:8081';

Overriding HEARTBEAT_TIMEOUT in WikibasePingback.php to 10 should send such a ping every ten seconds.

IN PRACTICE

This does not work, and the reason so far eludes me.

RickiJay-WMDE renamed this task from Locally* Run Pingback Code to Locally Run Pingback Code.May 30 2024, 8:34 PM

We might have missed a trick here, since the DeferredUpdate that's supposed to send the request is running in a process in docker, I would assume it's "localhost" would not be the same as the process of the beacon running on your machine outside the container. But take that with a grain of salt, I'm just doing some guesswork on the fly.