summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@gmail.com>2016-11-14 18:43:23 -0800
committerClark Boylan <clark.boylan@gmail.com>2016-11-15 14:04:18 -0800
commitcbe2ba87241e719c0b49487db45605d630c04032 (patch)
tree550046f9b027e4aa5c54113964c202a7146ab393
parent411f392c147fa196d87b920c1e9bf37f1d1a1dd7 (diff)
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
Notes
Notes (review): Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Code-Review+2: Paul Belanger <pabelanger@redhat.com> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 06 Jan 2017 17:19:38 +0000 Reviewed-on: https://review.openstack.org/397488 Project: openstack-infra/puppet-ethercalc Branch: refs/heads/master
-rw-r--r--manifests/init.pp59
1 files 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 (
18 $ep_user = 'eplite', 18 $ep_user = 'eplite',
19 $eplite_version = 'develop', 19 $eplite_version = 'develop',
20 # If set to system will install system package. 20 # If set to system will install system package.
21 $nodejs_version = 'v0.10.21', 21 $nodejs_version = 'node_0.10',
22) { 22) {
23 23
24 # where the modules are, needed to easily install modules later 24 # where the modules are, needed to easily install modules later
@@ -53,58 +53,25 @@ class etherpad_lite (
53 ensure => present, 53 ensure => present,
54 } 54 }
55 55
56 if ($nodejs_version != 'system') { 56 anchor { 'nodejs-package-install': }
57 vcsrepo { "${base_install_dir}/nodejs":
58 ensure => present,
59 provider => git,
60 source => 'https://github.com/joyent/node.git',
61 revision => $nodejs_version,
62 require => [
63 Package['git'],
64 File[$base_install_dir],
65 ],
66 }
67
68 package { [
69 'gzip',
70 'python',
71 'libssl-dev',
72 'pkg-config',
73 'build-essential',
74 ]:
75 ensure => present,
76 }
77 57
78 package { ['nodejs', 'npm']: 58 if ($nodejs_version != 'system') {
79 ensure => purged, 59 class { '::nodejs':
80 } 60 repo_url_suffix => $nodejs_version,
81 61 before => Anchor['nodejs-package-install'],
82 buildsource { "${base_install_dir}/nodejs":
83 timeout => 900, # 15 minutes
84 creates => '/usr/local/bin/node',
85 require => [
86 Package['gzip'],
87 Package['curl'],
88 Package['python'],
89 Package['libssl-dev'],
90 Package['pkg-config'],
91 Package['build-essential'],
92 Vcsrepo["${base_install_dir}/nodejs"],
93 ],
94 before => Anchor['nodejs-anchor'],
95 } 62 }
96 } else { 63 } else {
97 package { ['nodejs', 'npm']: 64 package { ['nodejs', 'npm']:
98 ensure => present, 65 ensure => present,
99 before => Anchor['nodejs-anchor'], 66 before => Anchor['nodejs-package-install'],
100 } 67 }
68 }
101 69
102 file { '/usr/local/bin/node': 70 file { '/usr/local/bin/node':
103 ensure => link, 71 ensure => link,
104 target => '/usr/bin/nodejs', 72 target => '/usr/bin/nodejs',
105 before => Anchor['nodejs-anchor'], 73 require => Anchor['nodejs-package-install'],
106 require => Package['nodejs'], 74 before => Anchor['nodejs-anchor'],
107 }
108 } 75 }
109 76
110 anchor { 'nodejs-anchor': } 77 anchor { 'nodejs-anchor': }