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

Unified Diff: modules/roundup/manifests/init.pp

Issue 4553114493386752: Initial configuration for issues.adblockplus.org (Closed)
Patch Set: Created Dec. 13, 2013, 6:22 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/roundup/manifests/init.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/roundup/manifests/init.pp
@@ -0,0 +1,82 @@
+class roundup($tracker_name, $domain) inherits private::roundup {
+ package {['roundup', 'python-mysqldb']: ensure => present}
+
+ include nginx
+
+ nginx::hostconfig {$domain:
+ content => template('roundup/site.erb'),
+ enabled => true
+ }
+
+ 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.
+
+ class {'mysql::server':
+ config_hash => {'root_password' => $database_root_password}
+ }
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
+
+ mysql::db {'roundup':
+ user => 'roundup',
+ password => $database_password,
+ host => 'localhost',
+ grant => ['all'],
+ require => Class['mysql::config']
+ }
+
+ file {'/etc/roundup/roundup-server.ini':
+ ensure => present,
+ content => template('roundup/roundup-server.ini.erb'),
+ require => Package['roundup']
+ }
+
+ $tracker_home = "/var/lib/roundup/trackers/${tracker_name}"
+
+ Exec {
+ path => ['/bin', '/usr/bin'],
+ }
+
+ exec {'install':
+ command => "roundup-admin -i ${tracker_home} install classic mysql",
+ onlyif => "test ! -d ${tracker_home}",
+ require => Package['roundup', 'python-mysqldb']
+ }
+
+ file {"${tracker_home}/config.ini":
+ ensure => present,
+ content => template('roundup/config.ini.erb'),
+ require => Exec['install']
+ }
+
+ $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.
+
+ service {'roundup':
+ ensure => running,
+ hasstatus => false,
+ 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.
+ }
+
+ # The following wrapper script is a hack that solves two problems:
+ # 1. roundup-admin initialise insists on user input when initialising the
+ # MySQL database.
+ # 2. Puppet commands can apparently not do input redirection, hence the
+ # wrapper script. It doesn't seem to be possible to create temporary
+ # files with Puppet either, so it has to stick around.
+
+ $roundup_initialise_wrapper = '/root/roundup-initialise'
+
+ file {$roundup_initialise_wrapper:
+ content => "echo y | roundup-admin -i ${tracker_home} initialise ${admin_password}"
+ }
+
+ exec {'initialise':
+ command => "bash ${roundup_initialise_wrapper}",
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
+ onlyif => "test ! -d ${db_path}/lock",
+ require => [Package['roundup'], File[$roundup_initialise_wrapper],
+ Mysql::Db['roundup']],
+ notify => File[$db_path]
+ }
+
+ file {$db_path:
+ owner => 'roundup',
+ notify => Service['roundup']
+ }
+}

Powered by Google App Engine
This is Rietveld