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: Removed post action types Created March 27, 2014, 11:09 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/manifests/postactiontype.pp » ('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
4 ) inherits private::discourse {
5
2 include postgresql::server 6 include postgresql::server
3 7
4 postgresql::database {'discourse':} 8 postgresql::database {'discourse':}
5 9
6 postgresql::role {'discourse': 10 postgresql::role {'discourse':
7 password_hash => $database_password, 11 password_hash => $database_password,
8 db => 'discourse', 12 db => 'discourse',
9 login => true, 13 login => true,
10 superuser => true, 14 superuser => true,
11 require => Postgresql::Database['discourse'] 15 require => Postgresql::Database['discourse']
12 } 16 }
13 17
14 package {['postgresql-contrib', 'redis-server', 'ruby1.9.1']: 18 $basic_dependencies = ['postgresql-contrib', 'redis-server', 'ruby1.9.1',
19 'libjemalloc1', 'curl']
20 $gem_dependencies = ['git', 'build-essential', 'ruby1.9.1-dev', 'libxml2-dev',
21 'libxslt-dev', 'libpq-dev']
22 $image_optim_dependencies = ['advancecomp', 'gifsicle', 'jhead', 'jpegoptim',
23 'libjpeg-progs', 'optipng', 'pngcrush']
24 $image_sorcery_dependencies = 'imagemagick'
25
26 package {[$basic_dependencies, $gem_dependencies, $image_optim_dependencies, $ image_sorcery_dependencies]:
15 ensure => present 27 ensure => present
16 } 28 }
17 29
18 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'} 30 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'}
19 31
20 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"': 32 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"':
21 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1" ', 33 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1" ',
22 require => Package['ruby1.9.1'] 34 require => Package['ruby1.9.1']
23 } 35 }
24 36
25 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"': 37 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"':
26 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"', 38 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"',
27 require => Package['ruby1.9.1'], 39 require => Package['ruby1.9.1'],
28 before => Package['bundler'] 40 before => Exec['update_gem']
41 }
42
43 exec {'update_gem':
44 command => '/usr/bin/gem update --system 1.8.25',
45 unless => 'test $(gem -v) == "1.8.25"',
46 environment => 'REALLY_GEM_UPDATE_SYSTEM=1',
29 } 47 }
30 48
31 package {'bundler': 49 package {'bundler':
32 ensure => present, 50 ensure => present,
33 provider => gem 51 provider => gem,
52 require => Exec['update_gem']
34 } 53 }
35 54
36 $gem_dependencies = ['git', 'build-essential', 'ruby1.9.1-dev', 'libxml2-dev',
37 'libxslt-dev', 'libpq-dev']
38 package {$gem_dependencies: ensure => present}
39
40 file {'/opt/discourse': 55 file {'/opt/discourse':
41 ensure => directory, 56 ensure => directory,
42 mode => 755, 57 mode => 755,
43 owner => discourse, 58 owner => discourse,
44 group => www-data 59 group => www-data
45 } 60 }
46 61
47 file {'/opt/discourse/config/database.yml': 62 file {['/opt/discourse/tmp', '/opt/discourse/tmp/pids']:
63 ensure => directory,
64 mode => 755,
65 owner => discourse,
66 group => www-data,
67 require => Exec['fetch-discourse']
68 }
69
70 file {'/opt/discourse/config/discourse.conf':
48 mode => 600, 71 mode => 600,
49 owner => discourse, 72 owner => discourse,
50 group => www-data, 73 group => www-data,
51 content => template('discourse/database.yml.erb'), 74 content => template('discourse/discourse.conf.erb'),
52 notify => Service['discourse-thin'], 75 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'] 76 require => Exec['fetch-discourse']
63 } 77 }
64 78
65 file {'/usr/local/bin/init-discourse': 79 file {'/usr/local/bin/init-discourse':
66 mode => 0755, 80 mode => 0755,
67 owner => root, 81 owner => root,
68 group => root, 82 group => root,
69 source => 'puppet:///modules/discourse/init-discourse' 83 source => 'puppet:///modules/discourse/init-discourse'
70 } 84 }
71 85
(...skipping 14 matching lines...) Expand all
86 source => 'puppet:///modules/discourse/sudoers', 100 source => 'puppet:///modules/discourse/sudoers',
87 require => User['discourse'] 101 require => User['discourse']
88 } 102 }
89 103
90 exec {'fetch-discourse': 104 exec {'fetch-discourse':
91 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse", 105 command => "hg clone https://hg.adblockplus.org/discourse /opt/discourse",
92 path => ["/usr/bin/", "/bin/"], 106 path => ["/usr/bin/", "/bin/"],
93 user => discourse, 107 user => discourse,
94 group => www-data, 108 group => www-data,
95 require => [Package['mercurial'], File['/opt/discourse']], 109 require => [Package['mercurial'], File['/opt/discourse']],
110 notify => Exec['/usr/local/bin/init-discourse'],
96 onlyif => "test ! -d /opt/discourse/.hg" 111 onlyif => "test ! -d /opt/discourse/.hg"
97 } 112 }
98 113
99 exec {'/usr/local/bin/init-discourse': 114 exec {'/usr/local/bin/init-discourse':
100 subscribe => File['/usr/local/bin/init-discourse'], 115 subscribe => File['/usr/local/bin/init-discourse'],
101 refreshonly => true, 116 refreshonly => true,
102 environment => ["DISCOURSE_SECRET=${secret}", "AIRBRAKE_KEY=${airbrake_key}" ], 117 environment => ["AIRBRAKE_KEY=${airbrake_key}"],
103 user => discourse, 118 user => discourse,
104 group => www-data, 119 group => www-data,
105 timeout => 0, 120 timeout => 0,
106 logoutput => true, 121 logoutput => true,
107 require => [Package['bundler', 'postgresql-contrib', $gem_dependencies], 122 require => [Package['bundler', $gem_dependencies],
108 User['discourse'], File['/etc/sudoers.d/discourse'], 123 User['discourse'], File['/etc/sudoers.d/discourse'],
109 Exec['fetch-discourse'], 124 Exec['fetch-discourse'],
110 File['/opt/discourse/config/database.yml'], 125 File['/opt/discourse/config/discourse.conf'],
111 File['/opt/discourse/config/redis.yml'],
112 Postgresql::Role['discourse']] 126 Postgresql::Role['discourse']]
113 } 127 }
114 128
115 Discourse::Sitesetting <| |> { 129 Discourse::Sitesetting <| |> {
116 require => Exec['/usr/local/bin/init-discourse'] 130 require => Exec['/usr/local/bin/init-discourse']
117 } 131 }
118 132
119 discourse::sitesetting {'title': 133 discourse::sitesetting {'title':
120 ensure => present, 134 ensure => present,
121 type => 1, 135 type => 1,
122 value => 'Adblock Plus internal discussions' 136 value => 'Adblock Plus internal discussions'
123 } 137 }
124 138
125 discourse::sitesetting {'notification_email': 139 discourse::sitesetting {'notification_email':
126 ensure => present, 140 ensure => present,
127 type => 1, 141 type => 1,
128 value => 'donotreply@adblockplus.org' 142 value => 'donotreply@adblockplus.org'
129 } 143 }
130 144
131 discourse::sitesetting {'contact_email': 145 discourse::sitesetting {'contact_email':
132 ensure => present, 146 ensure => present,
133 type => 1, 147 type => 1,
134 value => 'admins@adblockplus.org' 148 value => 'admins@adblockplus.org'
135 } 149 }
136 150
151 discourse::sitesetting {'site_contact_username':
152 ensure => present,
153 type => 1,
154 value => 'system'
155 }
156
137 discourse::sitesetting {'must_approve_users': 157 discourse::sitesetting {'must_approve_users':
138 ensure => present, 158 ensure => present,
139 type => 5, 159 type => 5,
140 value => 'f' 160 value => 'f'
141 } 161 }
142 162
143 discourse::sitesetting {'login_required': 163 discourse::sitesetting {'login_required':
144 ensure => present, 164 ensure => present,
145 type => 5, 165 type => 5,
146 value => 't' 166 value => 't'
147 } 167 }
148 168
149 discourse::sitesetting {'email_domains_blacklist': 169 discourse::sitesetting {'email_domains_blacklist':
150 ensure => present, 170 ensure => present,
151 type => 1, 171 type => 1,
152 value => '' 172 value => ''
153 } 173 }
154 174
155 discourse::sitesetting {'email_domains_whitelist': 175 discourse::sitesetting {'email_domains_whitelist':
156 ensure => present, 176 ensure => present,
157 type => 1, 177 type => 1,
158 value => 'adblockplus.org|eyeo.com' 178 value => 'adblockplus.org|eyeo.com'
159 } 179 }
160 180
161 discourse::sitesetting {'use_ssl': 181 discourse::sitesetting {'use_https':
162 ensure => present, 182 ensure => present,
163 type => 5, 183 type => 5,
164 value => 't' 184 value => 't'
165 } 185 }
166 186
167 discourse::sitesetting {'company_full_name': 187 discourse::sitesetting {'company_full_name':
168 ensure => present, 188 ensure => present,
169 type => 1, 189 type => 1,
170 value => 'Eyeo GmbH' 190 value => 'Eyeo GmbH'
171 } 191 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 type => 5, 237 type => 5,
218 value => 'f' 238 value => 'f'
219 } 239 }
220 240
221 discourse::sitesetting {'enforce_global_nicknames': 241 discourse::sitesetting {'enforce_global_nicknames':
222 ensure => present, 242 ensure => present,
223 type => 5, 243 type => 5,
224 value => 'f' 244 value => 'f'
225 } 245 }
226 246
227 Discourse::Postactiontype <| |> { 247 discourse::sitesetting {'allow_user_locale':
228 require => Exec['/usr/local/bin/init-discourse'] 248 ensure => present,
249 type => 5,
250 value => 't'
229 } 251 }
230 252
231 discourse::postactiontype {'bookmark': 253 discourse::sitesetting {'white_listed_spam_host_domains':
232 ensure => present, 254 ensure => present,
233 id => 1, 255 type => 1,
234 position => 1 256 value => 'adblockplus.org,eyeo.com'
235 }
236
237 discourse::postactiontype {'like':
238 ensure => present,
239 id => 2,
240 position => 2,
241 icon => 'heart'
242 }
243
244 discourse::postactiontype {'off_topic':
245 ensure => present,
246 id => 3,
247 position => 3,
248 is_flag => true
249 }
250
251 discourse::postactiontype {'inappropriate':
252 ensure => present,
253 id => 4,
254 position => 4,
255 is_flag => true
256 }
257
258 discourse::postactiontype {'vote':
259 ensure => present,
260 position => 5,
261 id => 5
262 }
263
264 discourse::postactiontype {'custom_flag':
265 ensure => present,
266 id => 6,
267 position => 7,
268 is_flag => true
269 }
270
271 discourse::postactiontype {'spam':
272 ensure => present,
273 id => 7,
274 position => 6,
275 is_flag => true
276 }
277
278 discourse::admin {$admins:
279 ensure => present,
280 require => Exec['/usr/local/bin/init-discourse']
281 } 257 }
282 258
283 Discourse::Customservice <| |> { 259 Discourse::Customservice <| |> {
284 user => 'discourse', 260 user => 'discourse',
285 workdir => '/opt/discourse', 261 workdir => '/opt/discourse',
286 env => ['GEM_HOME=~discourse/.gems', 'RAILS_ENV=production', 'RUBY_GC_MALLOC _LIMIT=90000000'], 262 env => ['RAILS_ENV=production', 'RUBY_GC_MALLOC_LIMIT=90000000',
263 'UNICORN_WORKERS=2', 'LD_PRELOAD=/usr/lib/libjemalloc.so.1'],
287 require => Exec['/usr/local/bin/init-discourse'] 264 require => Exec['/usr/local/bin/init-discourse']
288 } 265 }
289 266
290 discourse::customservice {'discourse-thin': 267 discourse::customservice {'discourse':
291 command => 'bundle exec thin -S /tmp/discourse-thin.sock start' 268 command => 'bundle exec config/unicorn_launcher -c config/unicorn.conf.rb',
269 require => File['/opt/discourse/tmp/pids'],
292 } 270 }
293 271
294 discourse::customservice {'sidekiq': 272 discourse::customservice {'sidekiq':
295 command => 'bundle exec sidekiq' 273 command => 'bundle exec sidekiq'
296 } 274 }
297 275
298 discourse::customservice {'clockwork':
299 command => 'bundle exec clockwork config/clock.rb'
300 }
301
302 class {'nginx': 276 class {'nginx':
303 worker_processes => 1, 277 worker_processes => 1,
304 worker_connections => 500 278 worker_connections => 500
305 } 279 }
306 280
307 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key': 281 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key':
308 ensure => file, 282 ensure => file,
309 notify => Service['nginx'], 283 notify => Service['nginx'],
310 before => Nginx::Hostconfig['intraforum.adblockplus.org'], 284 before => Nginx::Hostconfig['intraforum.adblockplus.org'],
311 require => Package['nginx'], 285 require => Package['nginx'],
312 source => 'puppet:///modules/private/adblockplus.org_sslcert.key' 286 source => 'puppet:///modules/private/adblockplus.org_sslcert.key'
313 } 287 }
314 288
315 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem': 289 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem':
316 ensure => file, 290 ensure => file,
317 mode => 0400, 291 mode => 0400,
318 notify => Service['nginx'], 292 notify => Service['nginx'],
319 before => Nginx::Hostconfig['intraforum.adblockplus.org'], 293 before => Nginx::Hostconfig[$domain],
320 require => Package['nginx'], 294 require => Package['nginx'],
321 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem' 295 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem'
322 } 296 }
323 297
324 nginx::hostconfig{'intraforum.adblockplus.org': 298 nginx::hostconfig{$domain:
325 source => 'puppet:///modules/discourse/intraforum.adblockplus.org', 299 content => template('discourse/site.erb'),
326 enabled => true 300 enabled => true
327 } 301 }
328 302
329 file {'/etc/logrotate.d/nginx_intraforum.adblockplus.org': 303 file {"/etc/logrotate.d/nginx_$domain":
330 ensure => file, 304 ensure => file,
331 require => Nginx::Hostconfig['intraforum.adblockplus.org'], 305 require => Nginx::Hostconfig[$domain],
332 source => 'puppet:///modules/discourse/logrotate' 306 source => 'puppet:///modules/discourse/logrotate'
333 } 307 }
334 } 308 }
OLDNEW
« no previous file with comments | « modules/discourse/manifests/admin.pp ('k') | modules/discourse/manifests/postactiontype.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld