Page MenuHomePhabricator

Remove provisioning for 'mwscript', 'foreachwikiindblist' etc from deployment host
Open, MediumPublic

Description

As seen by T253756, it is easy to mistakenly run a maintenance script from the deployment host rather than the maintenance host as their environment is so similar.

For a lot of people these two hosts are the only MediaWik-deployed hosts in production that they have shell access to.

To my knowledge, on a deployment host:

  • ... there is no use case for running foreachwiki .
  • ... there is one use case for automated/scripted running of mwscript, namely by Scap for generating the localisation cache. This does not need the CLI wrapper, though. I suggest letting scap run php multiversion/MWScript.php directly. That also means Scap is explicitly in control over whether it executes from /srv/mediawiki or /srv/mediawiki-staging. This latter part (control over whether /srv/mediawiki or /srv/mediawiki-staging is used) is true as of scap 4.3.0 and https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/759521
  • ... there is one use case for manual invocation of mwscript, namely as part of scap update-interwiki-cache. This has numerous other problems (per T247107), but given that this too is scripted by Scap, it would be trivial to write out the long-form here.

As such, I propose that the following are removed from the deployment host:

  • mwscript
  • foreachwiki
  • foreachwikiindblist
  • (any other MWScript wrappers?)

Thus making yielding a very obvious error that these are not available here. Just like when debugging a random app server in production, php MWScript.php can still be called directly ad-hoc if/when absolutely needed for some reason.

Event Timeline

Just out of curiosity, what's the problem with running scripts from the deployment host, other than "we prefer if they're run on mwmaint for consistency"?

I don't think it's harmful in any ways, but maybe I'm missing something.

Just out of curiosity, what's the problem with running scripts from the deployment host, other than "we prefer if they're run on mwmaint for consistency"?

deployment hosts are simultaneously everything and nothing. They are only partially provisioned as an app/maint server. As such, some deployment steps cannot be applied to itself. This means that /srv/mediawiki does not have a functioning localisation cache. There exists one at /srv/mediawiki-staging though, which mwscript uses if it exists.

I'm in favor of removing /srv/mediawiki entirely from the deployment host. My main motivation for that is ensuring that no part of scap (or the maintenance scripts that it runs) has the behavior of sometimes accessing /srv/mediawiki and sometimes accessing /srv/mediawiki-staging. This is how it works now and I find it very confusing. If /srv/mediawiki is removed, then anyone running mwscript on the deploy server will result in an error.

Change 757070 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[mediawiki/tools/scap@master] Make sync-world, etc work without /srv/mediawiki on deploy server

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

Change 757070 merged by jenkins-bot:

[mediawiki/tools/scap@master] Make sync-world, etc work without /srv/mediawiki on deploy server

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

Krinkle triaged this task as Medium priority.
dancy removed dancy as the assignee of this task.Sep 18 2023, 6:12 PM