Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 class trac($domain) inherits private::trac { | 1 class trac( |
2 package {['python-mysqldb','python-setuptools','subversion']: ensure => presen t} | 2 $domain, |
Wladimir Palant
2014/03/03 08:44:31
Style nit: Could you please put |ensure => present
| |
3 $is_default = false) inherits private::trac { | |
4 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']: | |
5 ensure => present | |
6 } | |
3 | 7 |
4 include nginx | 8 include nginx, spawn-fcgi |
5 | 9 |
6 nginx::hostconfig {$domain: | 10 nginx::hostconfig {$domain: |
7 content => template('trac/site.erb'), | 11 content => template('trac/site.erb'), |
8 enabled => true | 12 enabled => true |
9 } | 13 } |
10 | 14 |
11 user {'trac': | 15 user {'trac': |
12 ensure => present, | 16 ensure => present, |
13 comment => 'User of the trac installation', | 17 comment => 'User of the trac installation', |
14 home => '/home/trac', | 18 home => '/home/trac', |
15 managehome => true | 19 managehome => true |
16 } | 20 } |
17 | 21 |
18 class {'mysql::server': | 22 class {'mysql::server': |
19 config_hash => {'root_password' => $database_root_password} | 23 root_password => $database_root_password |
20 } | 24 } |
21 | 25 |
22 mysql::db {'trac': | 26 mysql::db {'trac': |
23 user => 'trac', | 27 user => 'trac', |
24 password => $database_password, | 28 password => $database_password, |
25 host => 'localhost', | 29 host => 'localhost', |
26 grant => ['all'], | 30 grant => ['all'], |
27 require => Class['mysql::config'] | 31 charset => 'utf8', |
32 collate => 'utf8_bin', | |
33 require => Class['mysql::server'] | |
28 } | 34 } |
29 | 35 |
30 Exec { | 36 Exec { |
31 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | 37 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
32 } | 38 } |
33 | 39 |
34 exec { 'collate': | |
35 command => "echo \"ALTER DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE ut f8_bin;\" | mysql -u trac -p${database_password}", | |
36 require => Mysql::Db['trac'] | |
Wladimir Palant
2014/03/03 08:44:31
Please add charset => 'utf8 COLLATE utf8_bin' to t
| |
37 } | |
38 | |
39 exec { 'install_trac': | 40 exec { 'install_trac': |
40 command => "easy_install Trac==1.0", | 41 command => "pip install Trac==1.0", |
Wladimir Palant
2014/03/03 08:44:31
We might want to use the python-pip package and |p
| |
41 require => [ | 42 require => Package['python-pip'], |
42 » Package['python-mysqldb', 'python-setuptools'], | 43 unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1. 0\" else 1)'", |
43 » Exec['collate']], | |
44 unless => "which tracd" | |
Wladimir Palant
2014/03/03 08:44:31
We might prefer something like "python -c 'import
| |
45 } | 44 } |
46 | 45 |
47 exec { 'trac_env': | 46 exec { 'trac_env': |
48 command => "trac-admin /home/trac/environment initenv \"Adblock Plus issue t racker\" mysql://trac:${database_password}@localhost:3306/trac", | 47 command => "trac-admin /home/trac/environment initenv \"Adblock Plus issue t racker\" mysql://trac:${database_password}@localhost:3306/trac", |
49 require => Exec['install_trac'], | 48 require => [ |
49 Exec['install_trac'], | |
50 Mysql_grant['trac@localhost/trac.*'] | |
51 ], | |
50 user => trac, | 52 user => trac, |
51 onlyif => "test ! -d /home/trac/environment" | 53 unless => "test -d /home/trac/environment" |
52 } | 54 } |
53 | 55 |
54 | |
55 exec { 'install_BlackMagicTicketTweaks': | 56 exec { 'install_BlackMagicTicketTweaks': |
56 command => "easy_install http://trac-hacks.org/svn/blackmagictickettweaksplu gin/0.12/", | 57 command => "pip install svn+http://trac-hacks.org/svn/blackmagictickettweaks plugin/0.12/", |
57 require => [ | 58 require => Package['subversion', 'python-pip'], |
58 » Package['subversion'], | 59 unless => "python -c 'import blackmagic'", |
59 » Exec['trac_env']] | |
Wladimir Palant
2014/03/03 08:44:31
This doesn't really depend on the trac enviroment,
| |
60 } | 60 } |
61 | 61 |
62 exec { 'install_SensitiveTickets': | 62 exec { 'install_SensitiveTickets': |
63 command => "easy_install http://trac-hacks.org/svn/sensitiveticketsplugin/tr unk/", | 63 command => "pip install svn+http://trac-hacks.org/svn/sensitiveticketsplugin /trunk/", |
64 require => [ | 64 require => Package['subversion', 'python-pip'], |
65 » Package['subversion'], | 65 unless => "python -c 'import sensitivetickets'", |
66 » Exec['trac_env']] | |
67 } | 66 } |
68 | 67 |
69 exec { 'install_AccountManager': | 68 exec { 'install_AccountManager': |
70 command => "easy_install http://trac-hacks.org/svn/accountmanagerplugin/tags /acct_mgr-0.4.3/", | 69 command => "pip install svn+http://trac-hacks.org/svn/accountmanagerplugin/t ags/acct_mgr-0.4.3/", |
71 require => [ | 70 require => Package['subversion', 'python-pip'], |
72 » Package['subversion'], | 71 unless => "python -c 'import acct_mgr'", |
73 » Exec['trac_env']] | |
74 } | 72 } |
75 | 73 |
76 | |
77 exec { 'install_TicketTemplate': | 74 exec { 'install_TicketTemplate': |
78 command => "easy_install http://trac-hacks.org/svn/tractickettemplateplugin/ 0.11/", | 75 command => "pip install svn+http://trac-hacks.org/svn/tractickettemplateplug in/0.11/", |
79 require => [ | 76 require => Package['subversion', 'python-pip'], |
80 » Package['subversion'], | 77 unless => "python -c 'import tickettemplate'", |
81 » Exec['trac_env']] | |
82 } | 78 } |
83 | 79 |
80 exec { 'install_AutocompleteUsers': | |
81 command => "pip install svn+http://trac-hacks.org/svn/autocompleteusersplugi n/trunk/", | |
82 require => Package['subversion', 'python-pip'], | |
83 unless => "python -c 'import autocompleteusers'", | |
84 } | |
84 | 85 |
85 exec { 'install_AutocompleteUsers': | 86 exec { 'install_MasterTickets': |
86 command => "easy_install http://trac-hacks.org/svn/autocompleteusersplugin/t runk/", | 87 command => "pip install svn+http://trac-hacks.org/svn/masterticketsplugin/tr unk/", |
87 require => [ | 88 require => Package['subversion', 'python-pip', 'graphviz'], |
88 » Package['subversion'], | 89 unless => "python -c 'import mastertickets'", |
89 » Exec['trac_env']] | |
90 } | 90 } |
91 | 91 |
92 file {"/home/trac/environment/conf/trac.ini": | 92 file {"/home/trac/environment/conf/trac.ini": |
93 ensure => present, | 93 ensure => present, |
94 content => template('trac/trac.ini.erb'), | 94 content => template('trac/trac.ini.erb'), |
95 owner => trac, | |
95 require => Exec['trac_env'] | 96 require => Exec['trac_env'] |
96 } | 97 } |
97 | 98 |
98 file {"/home/trac/environment/htdocs/adblockplus_logo.png": | 99 file {"/home/trac/htdocs/htdocs/common/adblockplus_logo.png": |
99 ensure => present, | 100 ensure => present, |
100 source => 'puppet:///modules/trac/adblockplus_logo.png', | 101 source => 'puppet:///modules/trac/adblockplus_logo.png', |
101 require => Exec['trac_env'] | 102 owner => trac, |
102 } | 103 require => Exec['deploy'] |
103 | |
104 exec {"tracd": | |
105 command => "tracd --port 8088 -d -s /home/trac/environment", | |
Wladimir Palant
2014/03/03 08:44:31
This needs to run as a service, otherwise it won't
| |
106 require => [ | |
107 » Exec['install_SensitiveTickets'], | |
108 » Exec['install_BlackMagicTicketTweaks'], | |
109 » Exec['install_AccountManager'], | |
110 » Exec['install_AutocompleteUsers'], | |
111 » Exec['install_TicketTemplate']] | |
112 } | 104 } |
113 | 105 |
114 exec {"update_env": | 106 exec {"update_env": |
115 command => "trac-admin /home/trac/environment upgrade", | 107 command => "trac-admin /home/trac/environment upgrade", |
Wladimir Palant
2014/03/03 08:44:31
Shouldn't we rather initialize the environment onl
Philip Hill
2014/03/06 14:50:20
As far as I unterstood, installing Plugins require
| |
108 user => trac, | |
116 require => [ | 109 require => [ |
117 » Exec['install_SensitiveTickets'], | 110 File['/home/trac/environment/conf/trac.ini'], |
118 » Exec['install_BlackMagicTicketTweaks'], | 111 Exec['install_SensitiveTickets'], |
119 » Exec['install_AccountManager'], | 112 Exec['install_BlackMagicTicketTweaks'], |
120 » Exec['install_AutocompleteUsers'], | 113 Exec['install_AccountManager'], |
121 » Exec['install_TicketTemplate']] | 114 Exec['install_AutocompleteUsers'], |
115 Exec['install_TicketTemplate'], | |
116 Exec['install_MasterTickets']] | |
117 } | |
118 | |
119 exec {"deploy": | |
120 command => "trac-admin /home/trac/environment deploy /home/trac/htdocs && fr omdos /home/trac/htdocs/cgi-bin/trac.fcgi && chmod 755 /home/trac/htdocs/cgi-bin /trac.fcgi", | |
121 user => trac, | |
122 require => [ | |
123 Exec["update_env"], | |
124 Package["tofrodos"]] | |
125 } | |
126 | |
127 spawn-fcgi::pool {"tracd": | |
128 ensure => present, | |
129 fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi", | |
130 socket => "/tmp/trac-fastcgi.sock", | |
131 mode => "0666", | |
132 user => trac, | |
133 children => 1, | |
134 require => Exec['deploy'], | |
122 } | 135 } |
123 | 136 |
124 file {"/home/trac/permissions.csv": | 137 file {"/home/trac/permissions.csv": |
125 ensure => present, | 138 ensure => present, |
126 source => 'puppet:///modules/trac/permissions.csv', | 139 owner => trac, |
127 require => Exec['trac_env'] | 140 source => 'puppet:///modules/trac/permissions.csv' |
128 } | |
129 | |
130 exec { "set_permission_groups": | |
131 command => "trac-admin /home/trac/environment permission import /home/trac/p ermissions.csv", | |
Wladimir Palant
2014/03/03 08:44:31
I don't think that we want to run that every time
| |
132 require => [ | |
133 » Exec['trac_env'], | |
134 » File['/home/trac/environment/conf/trac.ini']] | |
135 } | 141 } |
136 | 142 |
137 } | 143 } |
LEFT | RIGHT |