LEFT | RIGHT |
1 class discourse( | 1 class discourse( |
2 $domain, | 2 $domain, |
3 $is_default = false | 3 $is_default = false |
4 ) inherits private::discourse { | 4 ) inherits private::discourse { |
5 | 5 |
6 include postgresql::server | 6 include postgresql::server |
7 | 7 |
8 postgresql::database {'discourse':} | 8 postgresql::database {'discourse':} |
9 | 9 |
10 postgresql::role {'discourse': | 10 postgresql::role {'discourse': |
11 password_hash => $database_password, | 11 password_hash => $database_password, |
12 db => 'discourse', | 12 db => 'discourse', |
13 login => true, | 13 login => true, |
14 superuser => true, | 14 superuser => true, |
15 require => Postgresql::Database['discourse'] | 15 require => Postgresql::Database['discourse'] |
16 } | 16 } |
17 | 17 |
18 package {['postgresql-contrib', 'redis-server', 'ruby1.9.1', 'libjemalloc1', '
imagemagick']: | 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]: |
19 ensure => present | 27 ensure => present |
20 } | 28 } |
21 | 29 |
22 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'} | 30 Exec {path => '/bin:/usr/bin:/usr/sbin:/usr/local/bin'} |
23 | 31 |
24 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"': | 32 exec {'update-alternatives --set ruby "/usr/bin/ruby1.9.1"': |
25 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1"
', | 33 unless => 'test $(readlink "/etc/alternatives/ruby") == "/usr/bin/ruby1.9.1"
', |
26 require => Package['ruby1.9.1'] | 34 require => Package['ruby1.9.1'] |
27 } | 35 } |
28 | 36 |
29 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"': | 37 exec {'update-alternatives --set gem "/usr/bin/gem1.9.1"': |
30 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"', | 38 unless => 'test $(readlink "/etc/alternatives/gem") == "/usr/bin/gem1.9.1"', |
31 require => Package['ruby1.9.1'], | 39 require => Package['ruby1.9.1'], |
32 before => Exec['/usr/bin/gem update --system 1.8.25'] | 40 before => Exec['update_gem'] |
33 } | 41 } |
34 | 42 |
35 exec {'/usr/bin/gem update --system 1.8.25': | 43 exec {'update_gem': |
| 44 command => '/usr/bin/gem update --system 1.8.25', |
36 unless => 'test $(gem -v) == "1.8.25"', | 45 unless => 'test $(gem -v) == "1.8.25"', |
37 environment => 'REALLY_GEM_UPDATE_SYSTEM=1', | 46 environment => 'REALLY_GEM_UPDATE_SYSTEM=1', |
38 before => Package['bundler'], | |
39 } | 47 } |
40 | 48 |
41 package {'bundler': | 49 package {'bundler': |
42 ensure => present, | 50 ensure => present, |
43 provider => gem | 51 provider => gem, |
44 } | 52 require => Exec['update_gem'] |
45 | 53 } |
46 $gem_dependencies = ['git', 'build-essential', 'ruby1.9.1-dev', 'libxml2-dev', | 54 |
47 'libxslt-dev', 'libpq-dev'] | 55 file {'/opt/discourse': |
48 package {$gem_dependencies: ensure => present} | |
49 | |
50 file {['/opt/discourse', '/opt/discourse/tmp', '/opt/discourse/tmp/pids']: | |
51 ensure => directory, | 56 ensure => directory, |
52 mode => 755, | 57 mode => 755, |
53 owner => discourse, | 58 owner => discourse, |
54 group => www-data | 59 group => www-data |
| 60 } |
| 61 |
| 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'] |
55 } | 68 } |
56 | 69 |
57 file {'/opt/discourse/config/discourse.conf': | 70 file {'/opt/discourse/config/discourse.conf': |
58 mode => 600, | 71 mode => 600, |
59 owner => discourse, | 72 owner => discourse, |
60 group => www-data, | 73 group => www-data, |
61 content => template('discourse/discourse.conf.erb'), | 74 content => template('discourse/discourse.conf.erb'), |
62 notify => Service['discourse'], | 75 notify => Service['discourse'], |
63 require => Exec['fetch-discourse'] | 76 require => Exec['fetch-discourse'] |
64 } | 77 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 112 } |
100 | 113 |
101 exec {'/usr/local/bin/init-discourse': | 114 exec {'/usr/local/bin/init-discourse': |
102 subscribe => File['/usr/local/bin/init-discourse'], | 115 subscribe => File['/usr/local/bin/init-discourse'], |
103 refreshonly => true, | 116 refreshonly => true, |
104 environment => ["AIRBRAKE_KEY=${airbrake_key}"], | 117 environment => ["AIRBRAKE_KEY=${airbrake_key}"], |
105 user => discourse, | 118 user => discourse, |
106 group => www-data, | 119 group => www-data, |
107 timeout => 0, | 120 timeout => 0, |
108 logoutput => true, | 121 logoutput => true, |
109 require => [Package['bundler', 'postgresql-contrib', $gem_dependencies], | 122 require => [Package['bundler', $gem_dependencies], |
110 User['discourse'], File['/etc/sudoers.d/discourse'], | 123 User['discourse'], File['/etc/sudoers.d/discourse'], |
111 Exec['fetch-discourse'], | 124 Exec['fetch-discourse'], |
112 File['/opt/discourse/config/discourse.conf'], | 125 File['/opt/discourse/config/discourse.conf'], |
113 Postgresql::Role['discourse']] | 126 Postgresql::Role['discourse']] |
114 } | 127 } |
115 | 128 |
116 Discourse::Sitesetting <| |> { | 129 Discourse::Sitesetting <| |> { |
117 require => Exec['/usr/local/bin/init-discourse'] | 130 require => Exec['/usr/local/bin/init-discourse'] |
118 } | 131 } |
119 | 132 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 discourse::sitesetting {'allow_user_locale': | 247 discourse::sitesetting {'allow_user_locale': |
235 ensure => present, | 248 ensure => present, |
236 type => 5, | 249 type => 5, |
237 value => 't' | 250 value => 't' |
238 } | 251 } |
239 | 252 |
240 discourse::sitesetting {'white_listed_spam_host_domains': | 253 discourse::sitesetting {'white_listed_spam_host_domains': |
241 ensure => present, | 254 ensure => present, |
242 type => 1, | 255 type => 1, |
243 value => 'adblockplus.org,eyeo.com' | 256 value => 'adblockplus.org,eyeo.com' |
244 } | |
245 | |
246 Discourse::Postactiontype <| |> { | |
247 require => Exec['/usr/local/bin/init-discourse'] | |
248 } | |
249 | |
250 discourse::postactiontype {'bookmark': | |
251 ensure => present, | |
252 id => 1, | |
253 position => 1 | |
254 } | |
255 | |
256 discourse::postactiontype {'like': | |
257 ensure => present, | |
258 id => 2, | |
259 position => 2, | |
260 icon => 'heart' | |
261 } | |
262 | |
263 discourse::postactiontype {'off_topic': | |
264 ensure => present, | |
265 id => 3, | |
266 position => 3, | |
267 is_flag => true | |
268 } | |
269 | |
270 discourse::postactiontype {'inappropriate': | |
271 ensure => present, | |
272 id => 4, | |
273 position => 4, | |
274 is_flag => true | |
275 } | |
276 | |
277 discourse::postactiontype {'vote': | |
278 ensure => present, | |
279 position => 5, | |
280 id => 5 | |
281 } | |
282 | |
283 discourse::postactiontype {'custom_flag': | |
284 ensure => present, | |
285 id => 6, | |
286 position => 7, | |
287 is_flag => true | |
288 } | |
289 | |
290 discourse::postactiontype {'spam': | |
291 ensure => present, | |
292 id => 7, | |
293 position => 6, | |
294 is_flag => true | |
295 } | 257 } |
296 | 258 |
297 Discourse::Customservice <| |> { | 259 Discourse::Customservice <| |> { |
298 user => 'discourse', | 260 user => 'discourse', |
299 workdir => '/opt/discourse', | 261 workdir => '/opt/discourse', |
300 env => ['RAILS_ENV=production', 'RUBY_GC_MALLOC_LIMIT=90000000', | 262 env => ['RAILS_ENV=production', 'RUBY_GC_MALLOC_LIMIT=90000000', |
301 'UNICORN_WORKERS=2', 'LD_PRELOAD=/usr/lib/libjemalloc.so.1'], | 263 'UNICORN_WORKERS=2', 'LD_PRELOAD=/usr/lib/libjemalloc.so.1'], |
302 require => Exec['/usr/local/bin/init-discourse'] | 264 require => Exec['/usr/local/bin/init-discourse'] |
303 } | 265 } |
304 | 266 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 content => template('discourse/site.erb'), | 299 content => template('discourse/site.erb'), |
338 enabled => true | 300 enabled => true |
339 } | 301 } |
340 | 302 |
341 file {"/etc/logrotate.d/nginx_$domain": | 303 file {"/etc/logrotate.d/nginx_$domain": |
342 ensure => file, | 304 ensure => file, |
343 require => Nginx::Hostconfig[$domain], | 305 require => Nginx::Hostconfig[$domain], |
344 source => 'puppet:///modules/discourse/logrotate' | 306 source => 'puppet:///modules/discourse/logrotate' |
345 } | 307 } |
346 } | 308 } |
LEFT | RIGHT |