Use nodejs class to install nodejs

This is a backward incompatible change. Sorry. But now we can rely on a
much better portable system for installing nodejs using the nodesource
packages instaed of building it ourselves. This is important because the
system packages on some distros (like Ubuntu Trusty) can no longer talk
to npm resulting in a failed etherpad install.

You can continue to use the system packages if you desire using the same
old config. But you now need to provide the nodejs class'
repo_url_suffix as your nodejs_version parameter should you not want to
use the system packages.

Note that transitioning from system to the nodesource packaged nodejs is
not currently supported by this change. Basically this means that if you
have an existing system setup which uses old npm you may want to just
redeploy your server from scratch using the nodesource packages to move
forward.

Change-Id: Ia686f9eba15e0a3dfa81d08aecc212853b3f7189
This commit is contained in:
Clark Boylan 2016-11-14 18:43:23 -08:00
parent 411f392c14
commit cbe2ba8724
1 changed files with 13 additions and 46 deletions

View File

@ -18,7 +18,7 @@ class etherpad_lite (
$ep_user = 'eplite',
$eplite_version = 'develop',
# If set to system will install system package.
$nodejs_version = 'v0.10.21',
$nodejs_version = 'node_0.10',
) {
# where the modules are, needed to easily install modules later
@ -53,58 +53,25 @@ class etherpad_lite (
ensure => present,
}
anchor { 'nodejs-package-install': }
if ($nodejs_version != 'system') {
vcsrepo { "${base_install_dir}/nodejs":
ensure => present,
provider => git,
source => 'https://github.com/joyent/node.git',
revision => $nodejs_version,
require => [
Package['git'],
File[$base_install_dir],
],
}
package { [
'gzip',
'python',
'libssl-dev',
'pkg-config',
'build-essential',
]:
ensure => present,
}
package { ['nodejs', 'npm']:
ensure => purged,
}
buildsource { "${base_install_dir}/nodejs":
timeout => 900, # 15 minutes
creates => '/usr/local/bin/node',
require => [
Package['gzip'],
Package['curl'],
Package['python'],
Package['libssl-dev'],
Package['pkg-config'],
Package['build-essential'],
Vcsrepo["${base_install_dir}/nodejs"],
],
before => Anchor['nodejs-anchor'],
class { '::nodejs':
repo_url_suffix => $nodejs_version,
before => Anchor['nodejs-package-install'],
}
} else {
package { ['nodejs', 'npm']:
ensure => present,
before => Anchor['nodejs-anchor'],
before => Anchor['nodejs-package-install'],
}
}
file { '/usr/local/bin/node':
ensure => link,
target => '/usr/bin/nodejs',
before => Anchor['nodejs-anchor'],
require => Package['nodejs'],
}
file { '/usr/local/bin/node':
ensure => link,
target => '/usr/bin/nodejs',
require => Anchor['nodejs-package-install'],
before => Anchor['nodejs-anchor'],
}
anchor { 'nodejs-anchor': }