Page MenuHomePhabricator

MediaWiki-Vagrant should use the same Node.js version as Wikimedia production
Closed, ResolvedPublic

Description

Wikimedia production uses Node.js 6.11.0. Vagrant uses 6.16.0 (currently; for some reason only the major version is pinned). It should match production, or (preferably) make it possible to select the node version per service.

Event Timeline

Given we've been migrating to 10, we should also bump to that.

We are now using NodeJS 10. That can be aligned with Wikimedia production by using:

/etc/apt/sources.list.d/wikimedia-node10.list
deb http://apt.wikimedia.org/wikimedia stretch-wikimedia component/node10
#deb-src http://apt.wikimedia.org/wikimedia stretch-wikimedia component/node10

Change 545832 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[mediawiki/vagrant@master] WIP Update Node.js to v10

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

Change 545832 abandoned by Zfilipin:
WIP Update Node.js to v10

Reason:
no activity in a week

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

Production uses a mix of node 6 and node 10 (the more important ones are still on 6), see T210704: Migrate node-based services in production to node10.
So vagrant needs the ability to use multiple node versions in parallel. Currently either the eventlogging or the restbase role is broken, depending on how one sets npm::node_version.

So basically, we need to install something like nvm, install node manually (can't use apt / dpkg anymore; which also means we cannot automatically track production), extend npm::install and npm::update with a version parameter and make them call nvm use before-after the npm call, and do the same (of use nvm exec) for nodejs calls.

Alternatively, we could just wait until everything is kubernetized, at which point the issue will hopefully go away on its own.

Wrt using node 10 based CI tools on vagrant, my workaround is using nodeenv. It goes something like

sudo pip install nodeenv
cd <repo>
nodeenv ./nodeenv --node=10.20.1
source ./nodeenv/bin/activate
npm install
npm test
deactivate_node

Change 932452 had a related patch set uploaded (by Gergő Tisza; author: Mainframe98):

[mediawiki/vagrant@bullseye-migration] NodeJS: Use the version (12) that is provided by bullseye

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

Change 932452 merged by jenkins-bot:

[mediawiki/vagrant@bullseye-migration] NodeJS: Use the version (12) that is provided by bullseye

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

Previously the MediaWiki services were collocated on hosts with a fixed version of Node JS (version 10 at the time iirc). Nowadays they are running in Docker image which might have different versions of NodeJS depending on their maintainers velocity. At least MediaWiki vagrant got updated to NodeJS 12.

At least MediaWiki vagrant got updated to NodeJS 12.

It actually didn't.

vagrant@test:~$ node --version
v6.14.4

...which is just a consequence of RESTBase still being on Node 6. So we'll either have to wait for RESTBase to be fully deprecated or remove / update all Vagrant roles that require it (restbase, mobilecontentservice, proton, visualeditor_wikimedia, wikimediaproduction).

Change 982180 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/vagrant@master] Update Vagrant to Node 16

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

Change 982180 merged by jenkins-bot:

[mediawiki/vagrant@master] Update Vagrant to Node 16

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

Tgr claimed this task.

After merging rMWVA427f1168c688: Update Vagrant to Node 16, Node.js is now (by default) at v16.20.2. Production is mostly on Node 10 I believe, but being migrated to 16 (T308371: Migrate node-based services in production to node16) so close enough.

Originally this task was about matching both major and minor version of Node with production, but that's probably not worth the effort.