Page MenuHomePhabricator

MediaWiki-Vagrant should use the same Node.js version as Wikimedia production
Open, Needs TriagePublic

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.

Related Objects

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