Left: | ||
Right: |
OLD | NEW |
---|---|
1 class trac( | 1 class trac( |
2 $domain, | 2 $domain, |
3 $certificate, | 3 $certificate, |
4 $private_key, | 4 $private_key, |
5 $permissions = "puppet:///modules/trac/permissions.csv", | |
Wladimir Palant
2014/07/22 13:52:24
Shouldn't this be an instance parameter? While thi
| |
5 $is_default = false) inherits private::trac { | 6 $is_default = false) inherits private::trac { |
7 | |
6 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']: | 8 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']: |
7 ensure => present | 9 ensure => present |
8 } | 10 } |
9 | 11 |
10 include nginx, spawn-fcgi | 12 include nginx, spawn-fcgi |
11 | 13 |
12 nginx::hostconfig {$domain: | 14 nginx::hostconfig {$domain: |
13 source => 'puppet:///modules/trac/site.conf', | 15 source => 'puppet:///modules/trac/site.conf', |
mathias
2014/07/24 16:36:49
What about a directory to write the necessary frag
| |
14 is_default => $is_default, | 16 is_default => $is_default, |
15 certificate => $certificate, | 17 certificate => $certificate, |
16 private_key => $private_key, | 18 private_key => $private_key, |
17 log => 'access_log_trac' | 19 log => 'access_log_trac' |
18 } | 20 } |
19 | 21 |
20 user {'trac': | 22 user {'trac': |
21 ensure => present, | 23 ensure => present, |
22 comment => 'User of the trac installation', | 24 comment => 'User of the trac installation', |
23 home => '/home/trac', | 25 home => '/home/trac', |
24 managehome => true | 26 managehome => true |
25 } | 27 } |
26 | 28 |
27 class {'mysql::server': | 29 class {'mysql::server': |
28 root_password => $database_root_password | 30 root_password => $database_root_password, |
29 } | 31 override_options => { |
30 | 32 'mysqld' => { 'federated' => true }, |
31 mysql::db {'trac': | 33 }, |
32 user => 'trac', | 34 restart => true, |
33 password => $database_password, | |
34 host => 'localhost', | |
35 grant => ['all'], | |
36 charset => 'utf8', | |
37 collate => 'utf8_bin', | |
38 require => Class['mysql::server'] | |
39 } | 35 } |
40 | 36 |
41 Exec { | 37 Exec { |
42 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | 38 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
43 } | 39 } |
44 | 40 |
45 exec { 'install_trac': | 41 exec { 'install_trac': |
46 command => "pip install Trac==1.0.1", | 42 command => "pip install Trac==1.0.1", |
47 require => Package['python-pip'], | 43 require => Package['python-pip'], |
48 unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1. 0.1\" else 1)'", | 44 unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1. 0.1\" else 1)'", |
49 } | 45 } |
50 | 46 |
51 exec { 'trac_env': | |
52 command => "trac-admin /home/trac/environment initenv \"Adblock Plus issue t racker\" mysql://trac:${database_password}@localhost:3306/trac", | |
53 require => [ | |
54 Exec['install_trac'], | |
55 Mysql_grant['trac@localhost/trac.*'] | |
56 ], | |
57 user => trac, | |
58 unless => "test -d /home/trac/environment" | |
59 } | |
60 | |
61 exec { 'install_BlackMagicTicketTweaks': | 47 exec { 'install_BlackMagicTicketTweaks': |
62 command => "pip install svn+http://trac-hacks.org/svn/blackmagictickettweaks plugin/0.12/", | 48 command => "pip install svn+http://trac-hacks.org/svn/blackmagictickettweaks plugin/0.12/", |
63 require => Package['subversion', 'python-pip'], | 49 require => Package['subversion', 'python-pip'], |
64 unless => "python -c 'import blackmagic'", | 50 unless => "python -c 'import blackmagic'", |
65 } | 51 } |
66 | 52 |
67 exec { 'install_SensitiveTickets': | 53 exec { 'install_SensitiveTickets': |
68 command => "pip install svn+http://trac-hacks.org/svn/sensitiveticketsplugin /trunk/", | 54 command => "pip install svn+http://trac-hacks.org/svn/sensitiveticketsplugin /trunk/", |
69 require => Package['subversion', 'python-pip'], | 55 require => Package['subversion', 'python-pip'], |
70 unless => "python -c 'import sensitivetickets'", | 56 unless => "python -c 'import sensitivetickets'", |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 } | 97 } |
112 | 98 |
113 exec { 'install_TracSpamFilter': | 99 exec { 'install_TracSpamFilter': |
114 command => "pip install svn+http://svn.edgewall.com/repos/trac/plugins/1.0/s pam-filter", | 100 command => "pip install svn+http://svn.edgewall.com/repos/trac/plugins/1.0/s pam-filter", |
115 require => Package[ | 101 require => Package[ |
116 'spambayes', | 102 'spambayes', |
117 'python-pip'], | 103 'python-pip'], |
118 unless => "python -c 'import tracspamfilter'", | 104 unless => "python -c 'import tracspamfilter'", |
119 } | 105 } |
120 | 106 |
121 file {"/home/trac/environment/conf/trac.ini": | |
122 ensure => present, | |
123 content => template('trac/trac.ini.erb'), | |
124 owner => trac, | |
125 require => Exec['trac_env'] | |
126 } | |
127 | |
128 exec { 'install_Tractags': | 107 exec { 'install_Tractags': |
129 command => "pip install svn+http://trac-hacks.org/svn/tagsplugin/tags/0.7/", | 108 command => "pip install svn+http://trac-hacks.org/svn/tagsplugin/tags/0.7/", |
130 require => Package['python-pip'], | 109 require => Package['python-pip'], |
131 unless => "python -c 'import tractags'", | 110 unless => "python -c 'import tractags'", |
132 } | 111 } |
133 | 112 |
134 file {"/home/trac/htdocs/htdocs/common/adblockplus_logo.png": | |
135 ensure => present, | |
136 source => 'puppet:///modules/trac/adblockplus_logo.png', | |
137 owner => trac, | |
138 require => Exec['deploy'] | |
139 } | |
140 | |
141 file {"/home/trac/environment/htdocs/theme.css": | |
142 ensure => present, | |
143 source => 'puppet:///modules/trac/theme.css', | |
144 owner => trac, | |
145 require => Exec['trac_env'] | |
146 } | |
147 | |
148 exec {"update_env": | |
149 command => "trac-admin /home/trac/environment upgrade", | |
150 user => trac, | |
151 require => [ | |
152 File['/home/trac/environment/conf/trac.ini'], | |
153 Exec['install_SensitiveTickets'], | |
154 Exec['install_BlackMagicTicketTweaks'], | |
155 Exec['install_AccountManager'], | |
156 Exec['install_AutocompleteUsers'], | |
157 Exec['install_TicketTemplate'], | |
158 Exec['install_NeverNotifyUpdater'], | |
159 Exec['install_MasterTickets'], | |
160 Exec['install_ThemeEngine'], | |
161 Exec['install_Tractags'], | |
162 Exec['install_TracSpamFilter']] | |
163 } | |
164 | |
165 exec {"deploy": | |
166 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", | |
167 user => trac, | |
168 require => [ | |
169 Exec["update_env"], | |
170 Package["tofrodos"]] | |
171 } | |
172 | |
173 spawn-fcgi::pool {"tracd": | |
174 ensure => present, | |
175 fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi", | |
176 socket => "/tmp/trac-fastcgi.sock", | |
177 mode => "0666", | |
178 user => trac, | |
179 children => 1, | |
180 require => Exec['deploy'], | |
181 } | |
182 | |
183 file {"/home/trac/permissions.csv": | 113 file {"/home/trac/permissions.csv": |
184 ensure => present, | 114 ensure => present, |
185 owner => trac, | 115 owner => trac, |
186 source => 'puppet:///modules/trac/permissions.csv' | 116 source => $permissions, |
187 } | 117 } |
188 | 118 |
119 define instance ( | |
120 $config = 'trac/trac.ini.erb', | |
121 $description = 'Issue Tracker', | |
122 $environment = 'environment', | |
123 $location = '/', | |
124 $logo = 'eyeo_logo.png', | |
125 $database = 'trac', | |
126 $database_password = $private::trac::database_password, | |
127 $theme = 'puppet:///modules/trac/theme.css') { | |
128 | |
129 mysql::db {$database: | |
130 user => 'trac', | |
131 password => $database_password, | |
132 host => 'localhost', | |
133 grant => ['all'], | |
134 charset => 'utf8', | |
135 collate => 'utf8_bin', | |
136 require => Class['mysql::server'], | |
137 } | |
138 | |
139 exec {"trac_env_$name": | |
140 command => "trac-admin /home/trac/$environment initenv \"$description\" my sql://trac:${database_password}@localhost:3306/$database", | |
Wladimir Palant
2014/07/31 09:46:53
Indeed, didn't know it existed. We should use that
| |
141 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | |
142 require => [ | |
143 Exec['install_trac'], | |
144 Mysql_grant["trac@localhost/$database.*"] | |
145 ], | |
146 user => trac, | |
147 unless => "test -d /home/trac/$environment" | |
148 } | |
149 | |
150 file {"/home/trac/$environment/conf/trac.ini": | |
151 ensure => present, | |
152 content => template($config), | |
153 owner => trac, | |
154 require => Exec["trac_env_$name"] | |
155 } | |
156 | |
157 file {"/home/trac/$environment/htdocs/theme.css": | |
158 ensure => present, | |
159 source => $theme, | |
160 owner => trac, | |
161 require => Exec["trac_env_$name"], | |
162 } | |
163 | |
164 exec {"update_env_$name": | |
165 command => "trac-admin /home/trac/$environment upgrade", | |
166 user => trac, | |
167 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | |
168 require => [ | |
169 File["/home/trac/$environment/conf/trac.ini"], | |
170 Exec['install_SensitiveTickets'], | |
171 Exec['install_BlackMagicTicketTweaks'], | |
172 Exec['install_AccountManager'], | |
173 Exec['install_AutocompleteUsers'], | |
174 Exec['install_TicketTemplate'], | |
175 Exec['install_NeverNotifyUpdater'], | |
176 Exec['install_MasterTickets'], | |
177 Exec['install_ThemeEngine'], | |
178 Exec['install_Tractags'], | |
179 Exec['install_TracSpamFilter']] | |
180 } | |
181 | |
182 exec {"deploy_$name": | |
183 command => "trac-admin /home/trac/$environment deploy /home/trac/htdocs && fromdos /home/trac/htdocs/cgi-bin/trac.fcgi && chmod 755 /home/trac/htdocs/cgi- bin/trac.fcgi", | |
184 user => trac, | |
185 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | |
186 require => [ | |
187 Exec["update_env_$name"], | |
188 Package["tofrodos"]] | |
189 } | |
190 | |
191 file {"/home/trac/htdocs/htdocs/common/$logo": | |
192 ensure => present, | |
193 source => "puppet:///modules/trac/$logo", | |
194 owner => trac, | |
195 require => Exec["deploy_$name"], | |
196 } | |
197 | |
198 file {"/home/trac/htdocs/cgi-bin/trac.fcgi.$name": | |
199 ensure => present, | |
200 owner => trac, | |
201 mode => 774, | |
202 content => "#!/bin/sh | |
203 SCRIPT=`dirname \$0`/`basename \$0 .$name` | |
204 TRAC_ENV=/home/trac/$environment \$SCRIPT \"\$@\" | |
Wladimir Palant
2014/07/22 13:52:24
This hack is only necessary because of reusing the
| |
205 ", | |
206 require => Exec["deploy_$name"], | |
207 } | |
208 | |
209 spawn-fcgi::pool {"tracd_$name": | |
210 ensure => present, | |
211 fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi.$name", | |
212 socket => "/tmp/${name}-fastcgi.sock", | |
213 mode => "0666", | |
214 user => trac, | |
215 children => 1, | |
216 require => File["/home/trac/htdocs/cgi-bin/trac.fcgi.$name"], | |
217 } | |
218 | |
219 } | |
189 } | 220 } |
221 | |
OLD | NEW |