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

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

Issue 6221863587938304: Issue 212 - Update Discourse (Closed)
Patch Set: Created March 27, 2014, 3:37 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/manifests/admin.pp ('k') | modules/discourse/templates/database.yml.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 inherits private::discourse { 1 class discourse(
2 $domain,
3 $is_default = false) inherits private::discourse {
Felix Dahlke 2014/03/27 15:49:11 Nit: We usually break before ")" in argument lists
Wladimir Palant 2014/03/27 20:28:24 From what I can tell, the only other occasions are
2 include postgresql::server 4 include postgresql::server
3 5
4 postgresql::database {'discourse':} 6 postgresql::database {'discourse':}
5 7
6 postgresql::role {'discourse': 8 postgresql::role {'discourse':
7 password_hash => $database_password, 9 password_hash => $database_password,
8 db => 'discourse', 10 db => 'discourse',
9 login => true, 11 login => true,
10 superuser => true, 12 superuser => true,
11 require => Postgresql::Database['discourse'] 13 require => Postgresql::Database['discourse']
12 } 14 }
13 15
14 package {['postgresql-contrib', 'redis-server', 'ruby1.9.1']: 16 package {['postgresql-contrib', 'redis-server', 'ruby1.9.1', 'libjemalloc1', ' imagemagick']:
15 ensure => present 17 ensure => present
16 } 18 }
17 19
18 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'} 20 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'}
19 21
20 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"': 22 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"':
21 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1" ', 23 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1" ',
22 require => Package['ruby1.9.1'] 24 require => Package['ruby1.9.1']
23 } 25 }
24 26
25 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"': 27 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"':
26 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"', 28 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"',
27 require => Package['ruby1.9.1'], 29 require => Package['ruby1.9.1'],
28 before => Package['bundler'] 30 before => Exec['/usr/bin/gem update --system 1.8.25']
31 }
32
33 exec {'/usr/bin/gem update --system 1.8.25':
34 unless => 'test $(gem -v) == "1.8.25"',
35 environment => 'REALLY_GEM_UPDATE_SYSTEM=1',
36 before => Package['bundler'],
29 } 37 }
30 38
31 package {'bundler': 39 package {'bundler':
32 ensure => present, 40 ensure => present,
33 provider => gem 41 provider => gem
34 } 42 }
35 43
36 $gem_dependencies = ['git', 'build-essential', 'ruby1.9.1-dev', 'libxml2-dev', 44 $gem_dependencies = ['git', 'build-essential', 'ruby1.9.1-dev', 'libxml2-dev',
37 'libxslt-dev', 'libpq-dev'] 45 'libxslt-dev', 'libpq-dev']
38 package {$gem_dependencies: ensure => present} 46 package {$gem_dependencies: ensure => present}
39 47
40 file {'/opt/discourse': 48 file {['/opt/discourse', '/opt/discourse/tmp', '/opt/discourse/tmp/pids']:
41 ensure => directory, 49 ensure => directory,
42 mode => 755, 50 mode => 755,
43 owner => discourse, 51 owner => discourse,
44 group => www-data 52 group => www-data
45 } 53 }
46 54
47 file {'/opt/discourse/config/database.yml': 55 file {'/opt/discourse/config/discourse.conf':
48 mode => 600, 56 mode => 600,
49 owner => discourse, 57 owner => discourse,
50 group => www-data, 58 group => www-data,
51 content => template('discourse/database.yml.erb'), 59 content => template('discourse/discourse.conf.erb'),
52 notify => Service['discourse-thin'], 60 notify => Service['discourse'],
53 require => Exec['fetch-discourse']
54 }
55
56 file {'/opt/discourse/config/redis.yml':
57 mode => 600,
58 owner => discourse,
59 group => www-data,
60 source => 'puppet:///modules/discourse/redis.yml',
61 notify => Service['discourse-thin'],
62 require => Exec['fetch-discourse'] 61 require => Exec['fetch-discourse']
63 } 62 }
64 63
65 file {'/usr/local/bin/init-discourse': 64 file {'/usr/local/bin/init-discourse':
66 mode => 0755, 65 mode => 0755,
67 owner => root, 66 owner => root,
68 group => root, 67 group => root,
69 source => 'puppet:///modules/discourse/init-discourse' 68 source => 'puppet:///modules/discourse/init-discourse'
70 } 69 }
71 70
(...skipping 14 matching lines...) Expand all
86 source => 'puppet:///modules/discourse/sudoers', 85 source => 'puppet:///modules/discourse/sudoers',
87 require => User['discourse'] 86 require => User['discourse']
88 } 87 }
89 88
90 exec {'fetch-discourse': 89 exec {'fetch-discourse':
91 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse", 90 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse",
92 path => ["/usr/bin/", "/bin/"], 91 path => ["/usr/bin/", "/bin/"],
93 user => discourse, 92 user => discourse,
94 group => www-data, 93 group => www-data,
95 require => [Package['mercurial'], File['/opt/discourse']], 94 require => [Package['mercurial'], File['/opt/discourse']],
95 notify => Exec['/usr/local/bin/init-discourse'],
96 onlyif => "test ! -d /opt/discourse/.hg" 96 onlyif => "test ! -d /opt/discourse/.hg"
97 } 97 }
98 98
99 exec {'/usr/local/bin/init-discourse': 99 exec {'/usr/local/bin/init-discourse':
100 subscribe => File['/usr/local/bin/init-discourse'], 100 subscribe => File['/usr/local/bin/init-discourse'],
101 refreshonly => true, 101 refreshonly => true,
102 environment => ["DISCOURSE_SECRET=${secret}", "AIRBRAKE_KEY=${airbrake_key}" ], 102 environment => ["AIRBRAKE_KEY=${airbrake_key}"],
103 user => discourse, 103 user => discourse,
104 group => www-data, 104 group => www-data,
105 timeout => 0, 105 timeout => 0,
106 logoutput => true, 106 logoutput => true,
107 require => [Package['bundler', 'postgresql-contrib', $gem_dependencies], 107 require => [Package['bundler', 'postgresql-contrib', $gem_dependencies],
108 User['discourse'], File['/etc/sudoers.d/discourse'], 108 User['discourse'], File['/etc/sudoers.d/discourse'],
109 Exec['fetch-discourse'], 109 Exec['fetch-discourse'],
110 File['/opt/discourse/config/database.yml'], 110 File['/opt/discourse/config/discourse.conf'],
111 File['/opt/discourse/config/redis.yml'],
112 Postgresql::Role['discourse']] 111 Postgresql::Role['discourse']]
113 } 112 }
114 113
115 Discourse::Sitesetting <| |> { 114 Discourse::Sitesetting <| |> {
116 require => Exec['/usr/local/bin/init-discourse'] 115 require => Exec['/usr/local/bin/init-discourse']
117 } 116 }
118 117
119 discourse::sitesetting {'title': 118 discourse::sitesetting {'title':
120 ensure => present, 119 ensure => present,
121 type => 1, 120 type => 1,
122 value => 'Adblock Plus internal discussions' 121 value => 'Adblock Plus internal discussions'
123 } 122 }
124 123
125 discourse::sitesetting {'notification_email': 124 discourse::sitesetting {'notification_email':
126 ensure => present, 125 ensure => present,
127 type => 1, 126 type => 1,
128 value => 'donotreply@adblockplus.org' 127 value => 'donotreply@adblockplus.org'
129 } 128 }
130 129
131 discourse::sitesetting {'contact_email': 130 discourse::sitesetting {'contact_email':
132 ensure => present, 131 ensure => present,
133 type => 1, 132 type => 1,
134 value => 'admins@adblockplus.org' 133 value => 'admins@adblockplus.org'
135 } 134 }
136 135
136 discourse::sitesetting {'site_contact_username':
137 ensure => present,
138 type => 1,
139 value => 'system'
140 }
141
137 discourse::sitesetting {'must_approve_users': 142 discourse::sitesetting {'must_approve_users':
138 ensure => present, 143 ensure => present,
139 type => 5, 144 type => 5,
140 value => 'f' 145 value => 'f'
141 } 146 }
142 147
143 discourse::sitesetting {'login_required': 148 discourse::sitesetting {'login_required':
144 ensure => present, 149 ensure => present,
145 type => 5, 150 type => 5,
146 value => 't' 151 value => 't'
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 is_flag => true 273 is_flag => true
269 } 274 }
270 275
271 discourse::postactiontype {'spam': 276 discourse::postactiontype {'spam':
272 ensure => present, 277 ensure => present,
273 id => 7, 278 id => 7,
274 position => 6, 279 position => 6,
275 is_flag => true 280 is_flag => true
276 } 281 }
277 282
278 discourse::admin {$admins: 283 Discourse::Customservice <| |> {
279 ensure => present, 284 user => 'discourse',
285 workdir => '/opt/discourse',
286 env => ['RAILS_ENV=production', 'RUBY_GC_MALLOC_LIMIT=90000000',
287 'UNICORN_WORKERS=2', 'LD_PRELOAD=/usr/lib/libjemalloc.so.1'],
280 require => Exec['/usr/local/bin/init-discourse'] 288 require => Exec['/usr/local/bin/init-discourse']
281 } 289 }
282 290
283 Discourse::Customservice <| |> { 291 discourse::customservice {'discourse':
284 user => 'discourse', 292 command => 'bundle exec config/unicorn_launcher -c config/unicorn.conf.rb',
285 workdir => '/opt/discourse', 293 require => File['/opt/discourse/tmp/pids'],
286 env => ['GEM_HOME=~discourse/.gems', 'RAILS_ENV=production', 'RUBY_GC_MALLOC _LIMIT=90000000'],
287 require => Exec['/usr/local/bin/init-discourse']
288 }
289
290 discourse::customservice {'discourse-thin':
291 command => 'bundle exec thin -S /tmp/discourse-thin.sock start'
292 } 294 }
293 295
294 discourse::customservice {'sidekiq': 296 discourse::customservice {'sidekiq':
295 command => 'bundle exec sidekiq' 297 command => 'bundle exec sidekiq'
296 } 298 }
297 299
298 discourse::customservice {'clockwork':
299 command => 'bundle exec clockwork config/clock.rb'
300 }
301
302 class {'nginx': 300 class {'nginx':
303 worker_processes => 1, 301 worker_processes => 1,
304 worker_connections => 500 302 worker_connections => 500
305 } 303 }
306 304
307 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key': 305 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key':
308 ensure => file, 306 ensure => file,
309 notify => Service['nginx'], 307 notify => Service['nginx'],
310 before => Nginx::Hostconfig['intraforum.adblockplus.org'], 308 before => Nginx::Hostconfig['intraforum.adblockplus.org'],
311 require => Package['nginx'], 309 require => Package['nginx'],
312 source => 'puppet:///modules/private/adblockplus.org_sslcert.key' 310 source => 'puppet:///modules/private/adblockplus.org_sslcert.key'
313 } 311 }
314 312
315 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem': 313 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem':
316 ensure => file, 314 ensure => file,
317 mode => 0400, 315 mode => 0400,
318 notify => Service['nginx'], 316 notify => Service['nginx'],
319 before => Nginx::Hostconfig['intraforum.adblockplus.org'], 317 before => Nginx::Hostconfig[$domain],
320 require => Package['nginx'], 318 require => Package['nginx'],
321 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem' 319 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem'
322 } 320 }
323 321
324 nginx::hostconfig{'intraforum.adblockplus.org': 322 nginx::hostconfig{$domain:
325 source => 'puppet:///modules/discourse/intraforum.adblockplus.org', 323 content => template('discourse/site.erb'),
326 enabled => true 324 enabled => true
327 } 325 }
328 326
329 file {'/etc/logrotate.d/nginx_intraforum.adblockplus.org': 327 file {"/etc/logrotate.d/nginx_$domain":
330 ensure => file, 328 ensure => file,
331 require => Nginx::Hostconfig['intraforum.adblockplus.org'], 329 require => Nginx::Hostconfig[$domain],
332 source => 'puppet:///modules/discourse/logrotate' 330 source => 'puppet:///modules/discourse/logrotate'
333 } 331 }
334 } 332 }
OLDNEW
« no previous file with comments | « modules/discourse/manifests/admin.pp ('k') | modules/discourse/templates/database.yml.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld