Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 # == Class: discourse_docker | |
2 # | |
3 # Depends on module docker (for now) | |
4 # | |
5 # == Parameters: | |
6 | |
7 # [*domain*] | |
8 # Set the domain (hostname) for the site. This will be used in both nginx and d iscourse settings. | |
9 # | |
10 # [*certificate*] | |
11 # SSL cert file (in modules/private/files/) for using in nginx. | |
12 # | |
13 # [*private_key*] | |
14 # SSL private key file (in modules/private/files/) for nginx. | |
15 # | |
16 # [*site_settings*] | |
17 # Hash used for discourse configuration. See https://github.com/discourse/disco urse/blob/master/config/site_settings.yml | |
18 # for all defaults and possible options. | |
19 # | |
20 # [*is_default*] | |
21 # Passed on to nginx (whether or not the site config should be default). | |
22 # | |
23 # [*admins*] | |
24 # Emails of accounts that will be made admin and developer on initial signup. | |
25 # | |
26 # [*google_oauth2_client_id*] | |
27 # Client ID from Google API console - see https://developers.google.com/identit y/protocols/OAuth2 . | |
28 # | |
29 # [*google_oauth2_client_secret*] | |
30 # Secret from Google API console - matching client_id above. | |
31 # | |
32 # === Examples: | |
33 # | |
34 # class {'discourse_docker': | |
35 # domain => 'forum.adblockplus.org', | |
36 # certificate => 'forum.adblockplus.org_sslcert.pem', | |
37 # private_key => 'forum.adblockplus.org_sslcert.key', | |
38 # is_default => true, | |
39 # admins => ['test1@adblockplus.org','test2@adblockplus.org'], | |
40 # google_oauth2_client_id => '698703124405-3jodbnl423ie9r01gv4j3ve1olg02sv3. apps.googleusercontent.com', | |
41 # google_oauth2_client_secret => 'tB2ESr1b99qJpbOYqv3PtuPU', | |
42 # site_settings => { | |
43 # title => 'Awesome Forum', | |
44 # # .. many more site settings here... | |
45 # } | |
46 # } | |
47 # | |
48 class discourse_docker( | |
49 $domain, | |
50 $certificate = hiera('discourse_docker::certificate', undef), | |
51 $private_key = hiera('discourse_docker::private_key', undef), | |
52 $site_settings = hiera('discourse_docker::site_settings', {}), | |
53 $is_default = hiera('discourse_docker::is_default', false), | |
54 $admins = hiera('discourse_docker::admins', []), | |
55 $google_oauth2_client_id = hiera('discourse_docker::google_oauth2_client_id', 'undef'), | |
56 $google_oauth2_client_secret = hiera('discourse_docker::google_oauth2_client_s ecret', 'undef'), | |
57 ) { | |
58 | |
59 include stdlib | |
60 | |
61 package {'git': | |
62 ensure => present, | |
63 } | |
64 | |
65 file {'/var/discourse': | |
66 ensure => directory, | |
67 mode => 755, | |
68 owner => root, | |
69 group => root | |
70 } | |
71 | |
72 exec {'fetch-discourse-docker': | |
73 command => "git clone https://github.com/discourse/discourse_docker.git /var /discourse", | |
74 path => ["/usr/bin/", "/bin/"], | |
75 user => root, | |
76 timeout => 0, | |
77 require => [Package['git'], File['/var/discourse']], | |
78 unless => "test -d /var/discourse/.git" | |
79 } | |
80 | |
81 file {'/var/discourse/containers/app.yml': | |
82 ensure => file, | |
83 mode => 600, | |
84 owner => root, | |
85 group => root, | |
86 content => template('discourse_docker/app.yml.erb'), | |
87 require => Class['docker'], | |
88 } | |
89 | |
90 exec {'rebuild': | |
91 command => '/var/discourse/launcher rebuild app --skip-prereqs', | |
92 user => root, | |
93 subscribe => File['/var/discourse/containers/app.yml'], | |
94 refreshonly => true, | |
95 logoutput => 'on_failure', | |
96 timeout => 0, | |
97 require => [Exec['fetch-discourse-docker'], | |
98 Class['docker'], | |
99 Package['git']], | |
100 } | |
101 | |
102 exec {'start': | |
103 command => '/var/discourse/launcher start app --skip-prereqs', | |
104 user => root, | |
105 logoutput => 'on_failure', | |
106 require => Exec['rebuild'], | |
107 } | |
108 | |
109 nginx::hostconfig {$domain: | |
110 source => "puppet:///modules/discourse_docker/site.conf", | |
111 certificate => $certificate, | |
112 private_key => $private_key, | |
113 is_default => $is_default, | |
114 log => "access_log_intraforum" | |
115 } | |
116 } | |
f.lopez
2017/01/06 15:37:31
are we missing a new line here?
f.nicolaisen
2017/01/06 15:41:06
Acknowledged.
| |
OLD | NEW |