Browse Source

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
changes/21/422921/1
Clark Boylan 2 years ago
parent
commit
cbe2ba8724
1 changed files with 13 additions and 46 deletions
  1. 13
    46
      manifests/init.pp

+ 13
- 46
manifests/init.pp View File

@@ -18,7 +18,7 @@ class etherpad_lite (
18 18
   $ep_user          = 'eplite',
19 19
   $eplite_version   = 'develop',
20 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 24
   # where the modules are, needed to easily install modules later
@@ -53,58 +53,25 @@ class etherpad_lite (
53 53
     ensure => present,
54 54
   }
55 55
 
56
-  if ($nodejs_version != 'system') {
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
-    }
56
+  anchor { 'nodejs-package-install': }
77 57
 
78
-    package { ['nodejs', 'npm']:
79
-      ensure => purged,
80
-    }
81
-
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'],
58
+  if ($nodejs_version != 'system') {
59
+    class { '::nodejs':
60
+      repo_url_suffix => $nodejs_version,
61
+      before          => Anchor['nodejs-package-install'],
95 62
     }
96 63
   } else {
97 64
     package { ['nodejs', 'npm']:
98 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':
103
-      ensure  => link,
104
-      target  => '/usr/bin/nodejs',
105
-      before  => Anchor['nodejs-anchor'],
106
-      require => Package['nodejs'],
107
-    }
70
+  file { '/usr/local/bin/node':
71
+    ensure  => link,
72
+    target  => '/usr/bin/nodejs',
73
+    require => Anchor['nodejs-package-install'],
74
+    before  => Anchor['nodejs-anchor'],
108 75
   }
109 76
 
110 77
   anchor { 'nodejs-anchor': }

Loading…
Cancel
Save