Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/discourse/manifests/init.pp

Issue 4924880143253504: Issue 2471 - Update our Discourse instance (Closed)
Left Patch Set: Addressed comments Created May 11, 2015, 3 p.m.
Right Patch Set: Check out correct revision Created May 12, 2015, 10:15 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « modules/discourse/files/init-discourse ('k') | modules/discourse/templates/discourse.conf.erb » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 class discourse( 1 class discourse(
2 $domain, 2 $domain,
3 $certificate, 3 $certificate,
4 $private_key, 4 $private_key,
5 $is_default = false 5 $is_default = false
6 ) inherits private::discourse { 6 ) inherits private::discourse {
7 7
8 $hg_revision = 'd31d28147381'
9 $git_revision = '8a3a02421a39f53b6adf3ca9a6fdba73f42bc932'
10 $ruby_version = '2.1.2'
11 $postgresql_version = '9.3'
12
8 class { 'postgresql::globals': 13 class { 'postgresql::globals':
9 manage_package_repo => true, 14 manage_package_repo => true,
10 version => '9.3', 15 version => $postgresql_version,
11 }-> 16 }->
12 class {"postgresql::server":} 17 class {"postgresql::server":}
13 18
14 class {"postgresql::server::contrib": 19 class {"postgresql::server::contrib":
15 package_ensure => 'present', 20 package_ensure => 'present',
16 } 21 }
17 22
18 postgresql::server::database {'discourse':} 23 postgresql::server::database {'discourse':}
19 24
20 postgresql::server::role {'discourse': 25 postgresql::server::role {'discourse':
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 exec {'install-rvm': 61 exec {'install-rvm':
57 command => 'curl -sSL https://get.rvm.io | bash -s stable', 62 command => 'curl -sSL https://get.rvm.io | bash -s stable',
58 tag => 'rvm', 63 tag => 'rvm',
59 creates => '/home/discourse/.rvm', 64 creates => '/home/discourse/.rvm',
60 timeout => 0, 65 timeout => 0,
61 logoutput => true, 66 logoutput => true,
62 require => [Exec['install-rvm-key'], Package[$rvm_dependencies]], 67 require => [Exec['install-rvm-key'], Package[$rvm_dependencies]],
63 } 68 }
64 69
65 exec {'install-ruby': 70 exec {'install-ruby':
66 command => 'rvm install 2.1.2 && rvm default do rvm --default use 2.1.2', 71 command => "rvm install $ruby_version && rvm default do rvm --default use $r uby_version",
67 tag => 'rvm', 72 tag => 'rvm',
68 unless => 'rvm list | grep 2.1.2', 73 unless => "rvm list | grep $ruby_version",
mathias 2015/05/26 10:02:16 Please use shellquote() to ensure $ruby_version ca
Wladimir Palant 2015/05/26 10:41:17 Given that $ruby_version is a constant set above,
mathias 2015/05/26 10:54:36 Indeed, it should be done there as well. And yes
69 timeout => 0, 74 timeout => 0,
70 logoutput => true, 75 logoutput => true,
71 notify => Exec['init-discourse'], 76 notify => Exec['init-discourse'],
72 require => Exec['install-rvm'], 77 require => Exec['install-rvm'],
73 } 78 }
74 79
75 exec {'install-bundler': 80 exec {'install-bundler':
76 command => 'rvm default do gem install bundler', 81 command => 'rvm default do gem install bundler',
77 tag => 'rvm', 82 tag => 'rvm',
78 unless => 'rvm default do gem list | grep "^bundler "', 83 unless => 'rvm default do gem list | grep "^bundler "',
(...skipping 14 matching lines...) Expand all
93 group => www-data, 98 group => www-data,
94 require => Exec['fetch-discourse'] 99 require => Exec['fetch-discourse']
95 } 100 }
96 101
97 file {'/opt/discourse/config/discourse.conf': 102 file {'/opt/discourse/config/discourse.conf':
98 mode => 600, 103 mode => 600,
99 owner => discourse, 104 owner => discourse,
100 group => www-data, 105 group => www-data,
101 content => template('discourse/discourse.conf.erb'), 106 content => template('discourse/discourse.conf.erb'),
102 notify => Service['discourse'], 107 notify => Service['discourse'],
103 require => Exec['fetch-discourse'] 108 require => Exec['update-discourse']
104 } 109 }
105 110
106 file {'/usr/local/bin/init-discourse': 111 file {'/usr/local/bin/init-discourse':
107 mode => 0755, 112 mode => 0755,
108 owner => root, 113 owner => root,
109 group => root, 114 group => root,
110 source => 'puppet:///modules/discourse/init-discourse' 115 source => 'puppet:///modules/discourse/init-discourse'
111 } 116 }
112 117
113 user {'discourse': 118 user {'discourse':
114 ensure => present, 119 ensure => present,
115 comment => 'Discourse user', 120 comment => 'Discourse user',
116 home => '/home/discourse', 121 home => '/home/discourse',
117 gid => www-data, 122 gid => www-data,
118 password => '*', 123 password => '*',
119 managehome => true 124 managehome => true
120 } 125 }
121 126
122 file {'/etc/sudoers.d/discourse': 127 file {'/etc/sudoers.d/discourse':
123 ensure => present, 128 ensure => present,
124 owner => root, 129 owner => root,
125 group => root, 130 group => root,
126 mode => 0440, 131 mode => 0440,
127 source => 'puppet:///modules/discourse/sudoers', 132 source => 'puppet:///modules/discourse/sudoers',
128 require => User['discourse'] 133 require => User['discourse']
129 } 134 }
130 135
131 exec {'fetch-discourse': 136 exec {'fetch-discourse':
132 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse", 137 command => 'hg clone --noupdate https://hg.adblockplus.org/discourse /opt/di scourse',
133 path => ["/usr/bin/", "/bin/"], 138 path => ["/usr/bin/", "/bin/"],
134 user => discourse, 139 user => discourse,
135 group => www-data, 140 group => www-data,
136 timeout => 0, 141 timeout => 0,
137 require => [Package['mercurial'], File['/opt/discourse']], 142 require => [Package['mercurial'], File['/opt/discourse']],
143 onlyif => "test ! -d /opt/discourse/.hg"
144 }
145
146 exec {'update-discourse':
147 command => "hg update -R /opt/discourse --clean -r $hg_revision",
148 unless => "hg id -R /opt/discourse | grep $hg_revision",
149 path => ["/usr/bin/", "/bin/"],
150 user => discourse,
151 group => www-data,
138 notify => Exec['init-discourse'], 152 notify => Exec['init-discourse'],
139 onlyif => "test ! -d /opt/discourse/.hg" 153 require => Exec['fetch-discourse'],
140 }
141
142 file {'/opt/discourse/config/initializers/airbrake.rb':
143 ensure => absent,
144 before => Exec['init-discourse'],
145 } 154 }
146 155
147 file {'/opt/discourse/config/version.rb': 156 file {'/opt/discourse/config/version.rb':
148 ensure => present, 157 ensure => present,
149 owner => discourse, 158 owner => discourse,
150 group => www-data, 159 group => www-data,
151 160
152 # This is hardcoded here so that Discourse doesn't try to extract it from 161 # This is hardcoded here so that Discourse doesn't try to extract it from
153 # the repository. Ideally, we should update it when updating Discourse. 162 # the repository. Ideally, we should update it when updating Discourse.
154 content => '$git_version = "8a3a02421a39f53b6adf3ca9a6fdba73f42bc932"', 163 content => "\$git_version = '$git_revision'",
155 require => Exec['fetch-discourse'], 164 require => Exec['update-discourse'],
156 before => Exec['init-discourse'], 165 before => Exec['init-discourse'],
157 } 166 }
158 167
159 exec {'init-discourse': 168 exec {'init-discourse':
160 command => 'rvm default do /usr/local/bin/init-discourse', 169 command => 'rvm default do /usr/local/bin/init-discourse',
161 tag => 'rvm', 170 tag => 'rvm',
162 subscribe => File['/usr/local/bin/init-discourse'], 171 subscribe => File['/usr/local/bin/init-discourse'],
163 refreshonly => true, 172 refreshonly => true,
164 timeout => 0, 173 timeout => 0,
165 logoutput => true, 174 logoutput => true,
166 require => [Exec['install-bundler'], 175 require => [Exec['install-bundler'],
167 Package[$discourse_dependencies, $gem_dependencies], 176 Package[$discourse_dependencies, $gem_dependencies],
168 User['discourse'], File['/etc/sudoers.d/discourse'], 177 User['discourse'], File['/etc/sudoers.d/discourse'],
169 Exec['fetch-discourse'], 178 Exec['update-discourse'],
170 File['/opt/discourse/config/discourse.conf'], 179 File['/opt/discourse/config/discourse.conf'],
171 Postgresql::Server::Role['discourse']] 180 Postgresql::Server::Role['discourse']]
172 } 181 }
173 182
174 Discourse::Sitesetting <| |> { 183 Discourse::Sitesetting <| |> {
175 require => Exec['init-discourse'] 184 require => Exec['init-discourse']
176 } 185 }
177 186
178 discourse::sitesetting {'title': 187 discourse::sitesetting {'title':
179 ensure => present, 188 ensure => present,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 global_config => ' 367 global_config => '
359 upstream discourse { 368 upstream discourse {
360 server localhost:3000; 369 server localhost:3000;
361 }', 370 }',
362 is_default => $is_default, 371 is_default => $is_default,
363 certificate => $certificate, 372 certificate => $certificate,
364 private_key => $private_key, 373 private_key => $private_key,
365 log => 'access_log_intraforum' 374 log => 'access_log_intraforum'
366 } 375 }
367 } 376 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld