Page MenuHomePhabricator

⬆️🚦Implement MW hosts endpoint in Platform API
Open, Needs TriagePublic

Description

Child of T409078: ⬆️🚦Deduplicate mapping of mediawiki backend versions

  • Currently, the mapping from database version to MediaWiki hosts gets duplicated across our codebases
  • The Goal of this ticket is to create a platform API endpoint that provides URLs to the correct hosts (i.e. mediawiki-139-app-backend.default.svc.cluster.local)

ACs:

  • A new backend endpoint in the Platform API is implemented which returns an appropriate MW version given a domain

Task breakdown notes:

  • API Spec:
    • Path: /backend/getWikiHostForDomain
    • Request Parameters: ?domain=coffebase.wikibase.cloud
    • Response Body: { backend-host: mediawiki-139-app-backend.default.svc.cluster.local, web-host: mediawiki-139-app-web.default.svc.cluster.local, api-host: mediawiki-139-app-api.default.svc.cluster.local, alpha-host: mediawiki-139-app-alpha.default.svc.cluster.local }
    • Response Headers:
      • x-backend-host: mediawiki-139-app-backend.default.svc.cluster.local
      • x-web-host: mediawiki-139-app-web.default.svc.cluster.local
      • x-api-host: mediawiki-139-app-api.default.svc.cluster.local
      • x-alpha-host: mediawiki-139-app-alpha.default.svc.cluster.local

PRs:

Details

Other Assignee
Ollie.Shotton_WMDE

Event Timeline

Tarrow updated the task description. (Show Details)
Tarrow updated the task description. (Show Details)
Tarrow updated the task description. (Show Details)
Tarrow renamed this task from ⬆️🚦Implement MW host endpoint in API to ⬆️🚦Implement MW version endpoint in API.Nov 11 2025, 1:57 PM
Tarrow updated the task description. (Show Details)
Tarrow updated the task description. (Show Details)

Suggestion from @dena: maybe we could have a config.php file that returns an array by parsing a json file on disk.

Another option from them is: put each key value pair as a separate environment variable?

In any case we agree that we'll start by looking at first putting the config here: https://github.com/wbstack/api/tree/main/config and making an endpoint that works and then worry about the mechanics of loading the config map which is a bit tricky.

Another, slightly hacky, suggestion is to use an environment variable where the mapping is a JSON encoded string and then json_decode it in PHP:

$ MW_DB_TO_VERSION_MAP='{"mw1.39-wbs1": "139", "mw1.43-wbs1": "143"}' php -r 'var_export(json_decode(getenv("MW_DB_TO_VERSION_MAP"))); echo "\n";'
(object) array(
   'mw1.39-wbs1' => '139',
   'mw1.43-wbs1' => '143',
)

I wouldn't want to do this for large amounts of JSON, but given it's likely only going to be an object with a few key value pairs, it might not be too bad.

Ollie.Shotton_WMDE renamed this task from ⬆️🚦Implement MW version endpoint in API to ⬆️🚦Implement MW hosts endpoint in Platform API.Thu, Nov 27, 10:44 AM
Ollie.Shotton_WMDE updated the task description. (Show Details)