summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@gmail.com>2015-08-19 15:26:19 -0700
committerJeremy Stanley <fungi@yuggoth.org>2015-08-20 15:17:04 +0000
commit6a254faec50a641e9c766a4fd671169e70b49dac (patch)
treed52a62cc22b8b95aab0bc9ace7430cb913b555fc
parentcc8e0cbad842a38c9bae4659f24265844aa8e65f (diff)
Allow system nodejs install
Allow setting the nodejs_version to 'system' which will tell the module to install the nodejs and npm packages from their system package manager rather than building the specified version from source, and symlink the expected interpreter name. Change-Id: I9831526581a5fc1f2014c9985637664c79b937bf
Notes
Notes (review): Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Code-Review+1: Craige McWhirter <craige@mcwhirter.io> Code-Review+2: Spencer Krum <nibz@spencerkrum.com> Code-Review+2: yolanda.robla <yroblamo@redhat.com> Workflow+1: Jeremy Stanley <fungi@yuggoth.org> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 21 Aug 2015 13:58:33 +0000 Reviewed-on: https://review.openstack.org/214821 Project: openstack-infra/puppet-ethercalc Branch: refs/heads/master
-rw-r--r--manifests/init.pp92
1 files changed, 55 insertions, 37 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 30b7f9b..08cdfce 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -15,6 +15,7 @@ class etherpad_lite (
15 $ep_user = 'eplite', 15 $ep_user = 'eplite',
16 $base_log_dir = '/var/log', 16 $base_log_dir = '/var/log',
17 $base_install_dir = '/opt/etherpad-lite', 17 $base_install_dir = '/opt/etherpad-lite',
18 # If set to system will install system package.
18 $nodejs_version = 'v0.10.21', 19 $nodejs_version = 'v0.10.21',
19 $eplite_version = 'develop', 20 $eplite_version = 'develop',
20 $ep_ensure = 'present', 21 $ep_ensure = 'present',
@@ -44,47 +45,64 @@ class etherpad_lite (
44 mode => '0664', 45 mode => '0664',
45 } 46 }
46 47
47 vcsrepo { "${base_install_dir}/nodejs": 48 if ($nodejs_version != 'system') {
48 ensure => present, 49 vcsrepo { "${base_install_dir}/nodejs":
49 provider => git, 50 ensure => present,
50 source => 'https://github.com/joyent/node.git', 51 provider => git,
51 revision => $nodejs_version, 52 source => 'https://github.com/joyent/node.git',
52 require => [ 53 revision => $nodejs_version,
53 Package['git'], 54 require => [
54 File[$base_install_dir], 55 Package['git'],
55 ], 56 File[$base_install_dir],
56 } 57 ],
58 }
57 59
58 package { [ 60 package { [
59 'gzip', 61 'gzip',
60 'curl', 62 'curl',
61 'python', 63 'python',
62 'libssl-dev', 64 'libssl-dev',
63 'pkg-config', 65 'pkg-config',
64 'abiword', 66 'abiword',
65 'build-essential', 67 'build-essential',
66 ]: 68 ]:
67 ensure => present, 69 ensure => present,
68 } 70 }
69 71
70 package { ['nodejs', 'npm']: 72 package { ['nodejs', 'npm']:
71 ensure => purged, 73 ensure => purged,
72 } 74 }
73 75
74 buildsource { "${base_install_dir}/nodejs": 76 buildsource { "${base_install_dir}/nodejs":
75 timeout => 900, # 15 minutes 77 timeout => 900, # 15 minutes
76 creates => '/usr/local/bin/node', 78 creates => '/usr/local/bin/node',
77 require => [ 79 require => [
78 Package['gzip'], 80 Package['gzip'],
79 Package['curl'], 81 Package['curl'],
80 Package['python'], 82 Package['python'],
81 Package['libssl-dev'], 83 Package['libssl-dev'],
82 Package['pkg-config'], 84 Package['pkg-config'],
83 Package['build-essential'], 85 Package['build-essential'],
84 Vcsrepo["${base_install_dir}/nodejs"], 86 Vcsrepo["${base_install_dir}/nodejs"],
85 ], 87 ],
88 before => Anchor['nodejs-anchor'],
89 }
90 } else {
91 package { ['nodejs', 'npm']:
92 ensure => present,
93 before => Anchor['nodejs-anchor'],
94 }
95
96 file { '/usr/local/bin/node':
97 ensure => link,
98 target => '/usr/bin/nodejs',
99 before => Anchor['nodejs-anchor'],
100 require => Package['nodejs'],
101 }
86 } 102 }
87 103
104 anchor { 'nodejs-anchor': }
105
88 vcsrepo { "${base_install_dir}/etherpad-lite": 106 vcsrepo { "${base_install_dir}/etherpad-lite":
89 ensure => $ep_ensure, 107 ensure => $ep_ensure,
90 provider => git, 108 provider => git,
@@ -105,7 +123,7 @@ class etherpad_lite (
105 environment => "HOME=${base_log_dir}/${ep_user}", 123 environment => "HOME=${base_log_dir}/${ep_user}",
106 require => [ 124 require => [
107 Vcsrepo["${base_install_dir}/etherpad-lite"], 125 Vcsrepo["${base_install_dir}/etherpad-lite"],
108 Buildsource["${base_install_dir}/nodejs"], 126 Anchor['nodejs-anchor'],
109 ], 127 ],
110 before => File["${base_install_dir}/etherpad-lite/settings.json"], 128 before => File["${base_install_dir}/etherpad-lite/settings.json"],
111 creates => "${base_install_dir}/etherpad-lite/node_modules", 129 creates => "${base_install_dir}/etherpad-lite/node_modules",