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

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

Issue 29370691: Issue 4234 - New discourse module based on docker (Closed)
Patch Set: Added docs, using docker class Created Jan. 6, 2017, 10:39 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(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
f.lopez 2017/01/06 14:37:54 we don't use a new line after the documentation
f.nicolaisen 2017/01/06 15:36:03 Acknowledged.
49 class discourse_docker(
50 $domain,
51 $certificate = hiera('discourse_docker::certificate', undef),
52 $private_key = hiera('discourse_docker::private_key', undef),
53 $site_settings = hiera('discourse_docker::site_settings', {}),
54 $is_default = hiera('discourse_docker::is_default', false),
55 $admins = hiera('discourse_docker::admins', []),
56 $google_oauth2_client_id = hiera('discourse_docker::google_oauth2_client_id', 'undef'),
57 $google_oauth2_client_secret = hiera('discourse_docker::google_oauth2_client_s ecret', 'undef'),
58 ) {
59
60 include stdlib
61
62 package {'git':
63 ensure => present,
64 }
65
66 file {'/var/discourse':
67 ensure => directory,
68 mode => 755,
69 owner => root,
70 group => root
71 }
72
73 exec {'fetch-discourse-docker':
74 command => "git clone https://github.com/discourse/discourse_docker.git /var /discourse",
75 path => ["/usr/bin/", "/bin/"],
76 user => root,
77 timeout => 0,
78 require => [Package['git'], File['/var/discourse']],
79 unless => "test -d /var/discourse/.git"
80 }
81
82 file {'/var/discourse/containers/app.yml':
83 ensure => file,
84 mode => 600,
85 owner => root,
86 group => root,
87 content => template('discourse_docker/app.yml.erb'),
88 require => Class['docker'],
89 }
90
91 exec {'rebuild':
92 command => '/var/discourse/launcher rebuild app --skip-prereqs',
93 user => root,
94 subscribe => File['/var/discourse/containers/app.yml'],
95 refreshonly => true,
96 logoutput => 'on_failure',
97 timeout => 0,
98 require => [Exec['fetch-discourse-docker'],
99 Class['docker'],
100 Package['git']],
101 }
102
103 exec {'start':
104 command => '/var/discourse/launcher start app --skip-prereqs',
105 user => root,
106 logoutput => 'on_failure',
107 require => Exec['rebuild'],
108 }
109
110 nginx::hostconfig {$domain:
111 source => "puppet:///modules/discourse_docker/site.conf",
112 certificate => $certificate,
113 private_key => $private_key,
114 is_default => $is_default,
115 log => "access_log_intraforum"
116 }
117 }
OLDNEW

Powered by Google App Engine
This is Rietveld