Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 class discourse_docker( | |
2 $domain, | |
f.lopez
2017/01/03 20:22:45
we need to set default values for these variables,
| |
3 $certificate, | |
4 $private_key, | |
f.lopez
2017/01/03 20:22:45
we might want to add a $ensure variable so we can
| |
5 $site_settings, | |
6 $is_default = false, | |
7 $admins = hiera('discourse_docker::admins', []) | |
8 ) { | |
9 | |
10 apt::source {'docker': | |
11 before => Package['docker-engine'], | |
12 location => 'https://apt.dockerproject.org/repo', | |
13 release => downcase("$::osfamily-$::lsbdistcodename"), | |
14 include_src => false, | |
15 key => '58118E89F3A912897C070ADBF76221572C52609D', | |
16 key_server => 'hkp://ha.pool.sks-keyservers.net:80', | |
17 } | |
18 | |
19 package {'git': | |
20 ensure => present, | |
21 } | |
22 | |
f.lopez
2017/01/03 20:22:45
for these packages we can use the `ensure_resource
| |
23 package {'docker-engine': | |
24 ensure => 'present', | |
25 require => Apt::Source['docker'], | |
26 } | |
27 | |
28 service {'docker': | |
29 ensure => running, | |
30 require => Package['docker-engine'], | |
31 } | |
32 | |
33 file {'/var/discourse': | |
34 ensure => directory, | |
35 mode => 755, | |
36 owner => root, | |
37 group => root | |
38 } | |
39 | |
40 exec {'fetch-discourse-docker': | |
41 command => "git clone https://github.com/discourse/discourse_docker.git /var /discourse", | |
42 path => ["/usr/bin/", "/bin/"], | |
43 user => root, | |
44 timeout => 0, | |
45 require => [Package['git'], File['/var/discourse']], | |
46 unless => "test -d /var/discourse/.git" | |
47 } | |
48 | |
49 file {'/var/discourse/containers/app.yml': | |
50 ensure => file, | |
51 mode => 600, | |
52 owner => root, | |
53 group => root, | |
54 content => template('discourse_docker/app.yml.erb'), | |
55 require => Package['docker-engine'], | |
56 } | |
57 | |
58 exec {'rebuild': | |
59 command => '/var/discourse/launcher rebuild app --skip-prereqs', | |
60 user => root, | |
61 subscribe => File['/var/discourse/containers/app.yml'], | |
62 refreshonly => true, | |
63 logoutput => 'on_failure', | |
64 timeout => 0, | |
65 require => [Exec['fetch-discourse-docker'], | |
66 Service['docker'], | |
67 Package['git']], | |
68 } | |
69 | |
70 exec {'start': | |
71 command => '/var/discourse/launcher start app --skip-prereqs', | |
72 user => root, | |
73 logoutput => 'on_failure', | |
74 require => Exec['rebuild'], | |
75 } | |
f.lopez
2017/01/03 20:22:45
this can be inside a conditional from `service {'d
| |
76 | |
77 class {'nginx': | |
78 worker_connections => 500 | |
79 } | |
80 | |
81 nginx::hostconfig {$domain: | |
82 source => 'puppet:///modules/discourse_docker/site.conf', | |
83 is_default => $is_default, | |
84 certificate => $certificate, | |
85 private_key => $private_key, | |
86 log => 'access_log_intraforum' | |
87 } | |
88 } | |
OLD | NEW |