From cbe2ba87241e719c0b49487db45605d630c04032 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 14 Nov 2016 18:43:23 -0800 Subject: [PATCH] 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 --- manifests/init.pp | 59 +++++++++++------------------------------------ 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 0739e77..80c2362 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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': }