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

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

Issue 4553114493386752: Initial configuration for issues.adblockplus.org (Closed)
Left Patch Set: Created Dec. 13, 2013, 6:22 p.m.
Right Patch Set: Add to monitoring, rename to issues1 consistently, remove trailing ? Created Jan. 22, 2014, 2:50 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/private-stub/manifests/roundup.pp ('k') | modules/roundup/templates/config.ini.erb » ('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 roundup($tracker_name, $domain) inherits private::roundup { 1 class roundup($tracker_name, $domain) inherits private::roundup {
2 package {['roundup', 'python-mysqldb']: ensure => present} 2 package {['roundup', 'python-mysqldb']: ensure => present}
3 3
4 include nginx 4 include nginx
5 5
6 nginx::hostconfig {$domain: 6 nginx::hostconfig {$domain:
7 content => template('roundup/site.erb'), 7 content => template('roundup/site.erb'),
8 enabled => true 8 enabled => true
9 } 9 }
10 10
11 include postfix
Wladimir Palant 2014/01/22 09:05:29 Why do we need that? It is already included in the
Felix Dahlke 2014/01/22 13:53:58 Done.
12
13 class {'mysql::server': 11 class {'mysql::server':
14 config_hash => {'root_password' => $database_root_password} 12 config_hash => {'root_password' => $database_root_password}
15 } 13 }
Wladimir Palant 2014/01/22 09:05:29 Any particular reason why we are using MySQL rathe
Felix Dahlke 2014/01/22 13:53:58 Discourse doesn't support MySQL, that's why I went
16 14
17 mysql::db {'roundup': 15 mysql::db {'roundup':
18 user => 'roundup', 16 user => 'roundup',
19 password => $database_password, 17 password => $database_password,
20 host => 'localhost', 18 host => 'localhost',
21 grant => ['all'], 19 grant => ['all'],
22 require => Class['mysql::config'] 20 require => Class['mysql::config']
23 } 21 }
24 22
25 file {'/etc/roundup/roundup-server.ini': 23 file {'/etc/roundup/roundup-server.ini':
26 ensure => present, 24 ensure => present,
27 content => template('roundup/roundup-server.ini.erb'), 25 content => template('roundup/roundup-server.ini.erb'),
28 require => Package['roundup'] 26 require => Package['roundup'],
27 notify => Service['roundup']
29 } 28 }
30 29
31 $tracker_home = "/var/lib/roundup/trackers/${tracker_name}" 30 $tracker_home = "/var/lib/roundup/trackers/${tracker_name}"
32 31
33 Exec { 32 Exec {
34 path => ['/bin', '/usr/bin'], 33 path => ['/bin', '/usr/bin'],
35 } 34 }
36 35
37 exec {'install': 36 exec {'install':
38 command => "roundup-admin -i ${tracker_home} install classic mysql", 37 command => "roundup-admin -i ${tracker_home} install classic mysql",
39 onlyif => "test ! -d ${tracker_home}", 38 onlyif => "test ! -d ${tracker_home}",
40 require => Package['roundup', 'python-mysqldb'] 39 require => Package['roundup', 'python-mysqldb']
41 } 40 }
42 41
43 file {"${tracker_home}/config.ini": 42 file {"${tracker_home}/config.ini":
44 ensure => present, 43 ensure => present,
45 content => template('roundup/config.ini.erb'), 44 content => template('roundup/config.ini.erb'),
46 require => Exec['install'] 45 require => Exec['install'],
46 notify => Service['roundup']
47 } 47 }
48
49 $db_path = "${tracker_home}/db"
Wladimir Palant 2014/01/22 09:05:29 Nit: move this further down where it is used?
Felix Dahlke 2014/01/22 13:53:58 Done.
50 48
51 service {'roundup': 49 service {'roundup':
52 ensure => running, 50 ensure => running,
53 hasstatus => false, 51 hasstatus => false
54 require => Package['roundup']
Wladimir Palant 2014/01/22 09:05:29 Doesn't that require config.ini or at least roundu
Felix Dahlke 2014/01/22 13:53:58 Yes, both apparently. Added a notify to those.
55 } 52 }
56
57 # The following wrapper script is a hack that solves two problems:
58 # 1. roundup-admin initialise insists on user input when initialising the
59 # MySQL database.
60 # 2. Puppet commands can apparently not do input redirection, hence the
61 # wrapper script. It doesn't seem to be possible to create temporary
62 # files with Puppet either, so it has to stick around.
63
64 $roundup_initialise_wrapper = '/root/roundup-initialise'
65 53
66 file {$roundup_initialise_wrapper: 54 $db_path = "${tracker_home}/db"
67 content => "echo y | roundup-admin -i ${tracker_home} initialise ${admin_pas sword}"
68 }
69 55
70 exec {'initialise': 56 exec {'initialise':
71 command => "bash ${roundup_initialise_wrapper}", 57 command => "bash -c 'echo y | roundup-admin -i ${tracker_home} initialise ${ admin_password}'",
Wladimir Palant 2014/01/22 09:05:29 Why use a script file? "bash -c 'echo y | roundup-
Felix Dahlke 2014/01/22 13:53:58 Well that's embarrassing, didn't think of -c. Done
72 onlyif => "test ! -d ${db_path}/lock", 58 onlyif => "test ! -d ${db_path}/lock",
73 require => [Package['roundup'], File[$roundup_initialise_wrapper], 59 require => [Package['roundup'], Mysql::Db['roundup']],
74 Mysql::Db['roundup']],
75 notify => File[$db_path] 60 notify => File[$db_path]
76 } 61 }
77 62
78 file {$db_path: 63 file {$db_path:
79 owner => 'roundup', 64 owner => 'roundup',
80 notify => Service['roundup'] 65 notify => Service['roundup']
81 } 66 }
82 } 67 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld