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

Delta Between Two Patch Sets: modules/discourse/manifests/init.pp

Issue 29347356: Issue 4234 - Migrate Discourse to a Docker-based setup (Closed)
Left Patch Set: Created July 8, 2016, 3:35 p.m.
Right Patch Set: Clone from GitHub, updated to Discourse 1.6.4 Created Oct. 12, 2016, 1:17 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « modules/discourse/files/sudoers ('k') | modules/discourse/manifests/sitesetting.pp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 class discourse( 1 class discourse(
2 $domain, 2 $domain,
3 $certificate, 3 $certificate,
4 $private_key, 4 $private_key,
5 $site_settings, 5 $site_settings,
6 $is_default = false, 6 $is_default = false,
7 $admins = hiera('discourse::admins', []) 7 $admins = hiera('discourse::admins', [])
8 ) { 8 ) {
9 9
10 apt::source {'docker': 10 apt::source {'docker':
11 location => 'https://apt.dockerproject.org/repo', 11 location => 'https://apt.dockerproject.org/repo',
12 release => 'ubuntu-precise', 12 release => 'ubuntu-precise',
13 repos => 'main', 13 repos => 'main',
14 key => '58118E89F3A912897C070ADBF76221572C52609D', 14 key => '58118E89F3A912897C070ADBF76221572C52609D',
15 key_content => template('discourse/dockersource.gpg.key'), 15 key_content => template('discourse/dockersource.gpg.key'),
16 include_src => false, 16 include_src => false,
17 } 17 }
18 18
19 package {'docker-engine': 19 package {'docker-engine':
20 # This version is recommended by Discourse, version 1.11 seems incompatible 20 ensure => '1.11.0-0~precise',
21 # to Ubuntu 12.04
22 ensure => '1.8.0-0~precise',
23 require => Apt::Source['docker'], 21 require => Apt::Source['docker'],
24 } 22 }
25 23
26 package {'git': 24 package {'git':
27 ensure => present, 25 ensure => present,
Wladimir Palant 2016/07/08 15:46:38 Note that this installs git 1.7.9.5 which is lower
28 } 26 }
29 27
30 service {'docker': 28 service {'docker':
31 ensure => running, 29 ensure => running,
32 require => Package['docker-engine'], 30 require => Package['docker-engine'],
33 } 31 }
34 32
35 file {'/var/discourse': 33 file {'/var/discourse':
36 ensure => directory, 34 ensure => directory,
37 mode => 755, 35 mode => 755,
38 owner => root, 36 owner => root,
39 group => root 37 group => root
40 } 38 }
41 39
42 exec {'fetch-discourse-docker': 40 exec {'fetch-discourse-docker':
43 command => "hg clone https://hg.adblockplus.org/discourse_docker /var/discou rse", 41 command => "git clone https://github.com/discourse/discourse_docker.git /var /discourse",
44 path => ["/usr/bin/", "/bin/"], 42 path => ["/usr/bin/", "/bin/"],
45 user => root, 43 user => root,
46 timeout => 0, 44 timeout => 0,
47 require => [Package['mercurial'], File['/var/discourse']], 45 require => [Package['git'], File['/var/discourse']],
48 onlyif => "test ! -d /var/discourse/.hg" 46 unless => "test -d /var/discourse/.git"
49 } 47 }
50 48
51 file {'/var/discourse/containers/app.yml': 49 file {'/var/discourse/containers/app.yml':
52 ensure => file, 50 ensure => file,
53 mode => 600, 51 mode => 600,
54 owner => root, 52 owner => root,
55 group => root, 53 group => root,
56 content => template('discourse/app.yml.erb'), 54 content => template('discourse/app.yml.erb'),
57 require => Exec['fetch-discourse-docker'], 55 require => Exec['fetch-discourse-docker'],
58 } 56 }
59 57
60 exec {'rebuild': 58 exec {'rebuild':
61 command => '/var/discourse/launcher rebuild app --skip-prereqs', 59 command => '/var/discourse/launcher rebuild app --skip-prereqs',
62 user => root, 60 user => root,
63 subscribe => File['/var/discourse/containers/app.yml'], 61 subscribe => File['/var/discourse/containers/app.yml'],
64 refreshonly => true, 62 refreshonly => true,
65 logoutput => 'on_failure', 63 logoutput => 'on_failure',
66 timeout => 0, 64 timeout => 0,
67 require => [Exec['fetch-discourse-docker'], 65 require => [Exec['fetch-discourse-docker'],
68 Service['docker'], 66 Service['docker'],
69 Package['git']], 67 Package['git']],
70 } 68 }
71 69
72 exec {'start': 70 exec {'start':
73 command => '/var/discourse/launcher start app --skip-prereqs', 71 command => '/var/discourse/launcher start app --skip-prereqs',
74 user => root, 72 user => root,
75 subscribe => Exec['rebuild'], 73 logoutput => 'on_failure',
Wladimir Palant 2016/07/08 15:46:38 I still need to verify that this is working correc
Wladimir Palant 2016/07/10 16:42:12 I verified that the container will always get star
76 refreshonly => true, 74 require => Exec['rebuild'],
77 } 75 }
78 76
79 class {'nginx': 77 class {'nginx':
80 worker_connections => 500 78 worker_connections => 500
81 } 79 }
82 80
83 nginx::hostconfig {$domain: 81 nginx::hostconfig {$domain:
84 source => 'puppet:///modules/discourse/site.conf', 82 source => 'puppet:///modules/discourse/site.conf',
85 is_default => $is_default, 83 is_default => $is_default,
86 certificate => $certificate, 84 certificate => $certificate,
87 private_key => $private_key, 85 private_key => $private_key,
88 log => 'access_log_intraforum' 86 log => 'access_log_intraforum'
89 } 87 }
90 } 88 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld