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

Side by Side Diff: modules/discourse/manifests/init.pp

Issue 4924880143253504: Issue 2471 - Update our Discourse instance (Closed)
Patch Set: Created May 8, 2015, 7:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « modules/discourse/files/init-discourse ('k') | modules/discourse/templates/discourse.conf.erb » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class { 'postgresql::globals':
9 manage_package_repo => true,
10 version => '9.3',
11 }->
8 class {"postgresql::server":} 12 class {"postgresql::server":}
9 13
10 postgresql::server::database {'discourse':} 14 postgresql::server::database {'discourse':}
11 15
12 postgresql::server::role {'discourse': 16 postgresql::server::role {'discourse':
13 password_hash => postgresql_password('discourse', $database_password), 17 password_hash => postgresql_password('discourse', $database_password),
14 db => 'discourse', 18 db => 'discourse',
15 login => true, 19 login => true,
16 superuser => true, 20 superuser => true,
17 require => Postgresql::Server::Database['discourse'] 21 require => Postgresql::Server::Database['discourse']
18 } 22 }
19 23
20 $basic_dependencies = ['postgresql-contrib', 'redis-server', 'ruby1.9.1', 24 $basic_dependencies = ['redis-server', 'libjemalloc1', 'curl', 'libyaml-dev']
21 'libjemalloc1', 'curl'] 25 $gem_dependencies = ['git', 'build-essential', 'libxml2-dev',
22 $gem_dependencies = ['git', 'build-essential', 'ruby1.9.1-dev', 'libxml2-dev',
23 'libxslt-dev', 'libpq-dev'] 26 'libxslt-dev', 'libpq-dev']
24 $image_optim_dependencies = ['advancecomp', 'gifsicle', 'jhead', 'jpegoptim', 27 $image_optim_dependencies = ['advancecomp', 'gifsicle', 'jhead', 'jpegoptim',
25 'libjpeg-progs', 'optipng', 'pngcrush'] 28 'libjpeg-progs', 'optipng', 'pngcrush']
26 $image_sorcery_dependencies = 'imagemagick' 29 $image_sorcery_dependencies = 'imagemagick'
27 30
28 package {[$basic_dependencies, $gem_dependencies, $image_optim_dependencies, $ image_sorcery_dependencies]: 31 package {[$basic_dependencies, $gem_dependencies, $image_optim_dependencies, $ image_sorcery_dependencies]:
29 ensure => present 32 ensure => present
30 } 33 }
31 34
32 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'} 35 Exec <| tag == 'rvm' |> {
33 36 path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin:/home/discourse/.rvm/bin',
34 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"': 37 user => discourse,
35 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1" ', 38 group => www-data,
36 require => Package['ruby1.9.1'] 39 environment => ['HOME=/home/discourse'],
37 } 40 }
38 41
39 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"': 42 exec {'install-rvm-key':
40 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"', 43 command => 'gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C2754 62A1703113804BB82D39DC0E3',
41 require => Package['ruby1.9.1'], 44 tag => 'rvm',
42 before => Exec['update_gem'] 45 unless => 'gpg --list-keys | grep D39DC0E3',
43 } 46 }
44 47
45 exec {'update_gem': 48 exec {'install-ruby':
46 command => '/usr/bin/gem update --system 1.8.25', 49 command => 'curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.2',
47 unless => 'test $(gem -v) == "1.8.25"', 50 tag => 'rvm',
48 environment => 'REALLY_GEM_UPDATE_SYSTEM=1', 51 creates => '/home/discourse/.rvm',
52 require => [Exec['install-rvm-key'], Package[$basic_dependencies]],
49 } 53 }
50 54
51 package {'bundler': 55 exec {'install-bundler':
52 ensure => present, 56 command => 'rvm default do gem install bundler',
53 provider => gem, 57 tag => 'rvm',
54 require => Exec['update_gem'] 58 unless => 'rvm default do gem list | grep "^bundler ")',
59 require => Exec['install-ruby'],
55 } 60 }
56 61
57 file {'/opt/discourse': 62 file {'/opt/discourse':
58 ensure => directory, 63 ensure => directory,
59 mode => 755, 64 mode => 755,
60 owner => discourse, 65 owner => discourse,
61 group => www-data 66 group => www-data
62 } 67 }
63 68
64 file {['/opt/discourse/tmp', '/opt/discourse/tmp/pids']: 69 file {['/opt/discourse/tmp', '/opt/discourse/tmp/pids']:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 source => 'puppet:///modules/discourse/sudoers', 107 source => 'puppet:///modules/discourse/sudoers',
103 require => User['discourse'] 108 require => User['discourse']
104 } 109 }
105 110
106 exec {'fetch-discourse': 111 exec {'fetch-discourse':
107 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse", 112 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse",
108 path => ["/usr/bin/", "/bin/"], 113 path => ["/usr/bin/", "/bin/"],
109 user => discourse, 114 user => discourse,
110 group => www-data, 115 group => www-data,
111 require => [Package['mercurial'], File['/opt/discourse']], 116 require => [Package['mercurial'], File['/opt/discourse']],
112 notify => Exec['/usr/local/bin/init-discourse'], 117 notify => Exec['init-discourse'],
113 onlyif => "test ! -d /opt/discourse/.hg" 118 onlyif => "test ! -d /opt/discourse/.hg"
114 } 119 }
115 120
116 exec {'/usr/local/bin/init-discourse': 121 file {'/opt/discourse/config/initializers/airbrake.rb':
122 ensure => absent,
123 before => Exec['init-discourse'],
124 }
125
126 file {'/opt/discourse/config/version.rb':
127 ensure => present,
128 owner => discourse,
129 group => www-data,
130
131 # This is hardcoded here so that Discourse doesn't try to extract it from
132 # the repository. Ideally, we should update it when updating Discourse.
133 content => '$git_version = "8a3a02421a39f53b6adf3ca9a6fdba73f42bc932"',
134 before => Exec['init-discourse'],
135 }
136
137 exec {'init-discourse':
138 command => 'rvm default do /usr/local/bin/init-discourse',
139 tag => 'rvm',
117 subscribe => File['/usr/local/bin/init-discourse'], 140 subscribe => File['/usr/local/bin/init-discourse'],
118 refreshonly => true, 141 refreshonly => true,
119 environment => ["AIRBRAKE_KEY=${airbrake_key}"],
120 user => discourse,
121 group => www-data,
122 timeout => 0, 142 timeout => 0,
123 logoutput => true, 143 logoutput => true,
124 require => [Package['bundler', $gem_dependencies], 144 require => [Exec['install-bundler'],
145 Package['postgresql-server', $gem_dependencies],
125 User['discourse'], File['/etc/sudoers.d/discourse'], 146 User['discourse'], File['/etc/sudoers.d/discourse'],
126 Exec['fetch-discourse'], 147 Exec['fetch-discourse'],
127 File['/opt/discourse/config/discourse.conf'], 148 File['/opt/discourse/config/discourse.conf'],
128 Postgresql::Server::Role['discourse']] 149 Postgresql::Server::Role['discourse']]
129 } 150 }
130 151
131 Discourse::Sitesetting <| |> { 152 Discourse::Sitesetting <| |> {
132 require => Exec['/usr/local/bin/init-discourse'] 153 require => Exec['init-discourse']
133 } 154 }
134 155
135 discourse::sitesetting {'title': 156 discourse::sitesetting {'title':
136 ensure => present, 157 ensure => present,
137 type => 1, 158 type => 1,
138 value => 'Adblock Plus internal discussions' 159 value => 'Adblock Plus internal discussions'
139 } 160 }
140 161
141 discourse::sitesetting {'notification_email': 162 discourse::sitesetting {'notification_email':
142 ensure => present, 163 ensure => present,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 type => 5, 230 type => 5,
210 value => 'f' 231 value => 'f'
211 } 232 }
212 233
213 discourse::sitesetting {'enable_local_account_create': 234 discourse::sitesetting {'enable_local_account_create':
214 ensure => present, 235 ensure => present,
215 type => 5, 236 type => 5,
216 value => 'f' 237 value => 'f'
217 } 238 }
218 239
240 discourse::sitesetting {'enable_google_logins':
241 ensure => present,
242 type => 5,
243 value => 'f'
244 }
245
246 discourse::sitesetting {'enable_google_oauth2_logins':
247 ensure => present,
248 type => 5,
249 value => 't'
250 }
251
252 discourse::sitesetting {'google_oauth2_client_id':
253 ensure => present,
254 type => 1,
255 value => $google_client_id
256 }
257
258 discourse::sitesetting {'google_oauth2_client_secret':
259 ensure => present,
260 type => 1,
261 value => $google_client_secret
262 }
263
219 discourse::sitesetting {'enable_facebook_logins': 264 discourse::sitesetting {'enable_facebook_logins':
220 ensure => present, 265 ensure => present,
221 type => 5, 266 type => 5,
222 value => 'f' 267 value => 'f'
223 } 268 }
224 269
225 discourse::sitesetting {'enable_twitter_logins': 270 discourse::sitesetting {'enable_twitter_logins':
226 ensure => present, 271 ensure => present,
227 type => 5, 272 type => 5,
228 value => 'f' 273 value => 'f'
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ensure => present, 307 ensure => present,
263 type => 3, 308 type => 3,
264 value => '50', 309 value => '50',
265 } 310 }
266 311
267 Discourse::Customservice <| |> { 312 Discourse::Customservice <| |> {
268 user => 'discourse', 313 user => 'discourse',
269 workdir => '/opt/discourse', 314 workdir => '/opt/discourse',
270 env => ['RAILS_ENV=production', 'RUBY_GC_MALLOC_LIMIT=90000000', 315 env => ['RAILS_ENV=production', 'RUBY_GC_MALLOC_LIMIT=90000000',
271 'UNICORN_WORKERS=2', 'LD_PRELOAD=/usr/lib/libjemalloc.so.1'], 316 'UNICORN_WORKERS=2', 'LD_PRELOAD=/usr/lib/libjemalloc.so.1'],
272 require => Exec['/usr/local/bin/init-discourse'] 317 require => Exec['init-discourse']
273 } 318 }
274 319
275 discourse::customservice {'discourse': 320 discourse::customservice {'discourse':
276 command => 'bundle exec config/unicorn_launcher -c config/unicorn.conf.rb', 321 command => '/home/discourse/.rvm/bin/rvm default do bundle exec config/unico rn_launcher -c config/unicorn.conf.rb',
277 require => File['/opt/discourse/tmp/pids'], 322 require => File['/opt/discourse/tmp/pids'],
278 } 323 }
279 324
280 discourse::customservice {'sidekiq': 325 discourse::customservice {'sidekiq':
281 command => 'bundle exec sidekiq' 326 command => '/home/discourse/.rvm/bin/rvm default do bundle exec sidekiq'
282 } 327 }
283 328
284 class {'nginx': 329 class {'nginx':
285 worker_processes => 1, 330 worker_processes => 1,
286 worker_connections => 500 331 worker_connections => 500
287 } 332 }
288 333
289 nginx::hostconfig{$domain: 334 nginx::hostconfig{$domain:
290 source => 'puppet:///modules/discourse/site.conf', 335 source => 'puppet:///modules/discourse/site.conf',
291 global_config => ' 336 global_config => '
292 upstream discourse { 337 upstream discourse {
293 server localhost:3000; 338 server localhost:3000;
294 }', 339 }',
295 is_default => $is_default, 340 is_default => $is_default,
296 certificate => $certificate, 341 certificate => $certificate,
297 private_key => $private_key, 342 private_key => $private_key,
298 log => 'access_log_intraforum' 343 log => 'access_log_intraforum'
299 } 344 }
300 } 345 }
OLDNEW
« no previous file with comments | « modules/discourse/files/init-discourse ('k') | modules/discourse/templates/discourse.conf.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld