Page MenuHomePhabricator

Allow the build script to pick different nodejs/npm versions
Closed, ResolvedPublic

Description

We are thinking of switching to Node.JS 4.x. In order to be able to test the services correctly (via service-runner docker-test) and build the node module dependencies correctly (via service-runner build --deploy-repo), service-runner's lib/docker.js needs to be able to select the correct versions of the nodejs and npm packages in the container.

Configuration

Just as we do for selecting the right target and the set of additional packages to install in the container, the version of node should be made part of package.json:

{
  // ...
  "deploy": {
    "node": "version",
    // other deploy-related stanzas, such as "target" and "dependencies"
  }
}

where version is the explicit Node.JS version to use (such as 0.10.40, 0.12, iojs-2.5, etc). If the node stanza is not supplied, the selected target's nodejs package should be used. To force official distro package usage, one can use "node": "system".

Implementation

In order to be able to accommodate such a variety of packages on various Linux flavours, we should install them using nvm, which is able to download and install them all. Note that the nodejs and npm packages should still get installed alongside nvm; partly because of the user's possibility of specifying the system version, but mostly because installing these two packages pulls in all of the needed system dependencies (most notably, build-essential on Debian-based systems).

Event Timeline

mobrovac created this task.Oct 1 2015, 6:47 PM
mobrovac raised the priority of this task from to Needs Triage.
mobrovac updated the task description. (Show Details)
mobrovac added projects: Services, service-runner.
mobrovac added a subscriber: mobrovac.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 1 2015, 6:47 PM
mobrovac updated the task description. (Show Details)Oct 20 2015, 11:55 AM
mobrovac set Security to None.

The PR has been merged, feature is available in service-runner@0.3.0

Pchelolo closed this task as Resolved.Oct 22 2015, 12:45 PM