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

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

Issue 29362580: Issue 4641 - Append performance fix to trac cgi file (Closed)
Left Patch Set: Created Nov. 15, 2016, 6:42 p.m.
Right Patch Set: Forgot the py file Created Nov. 18, 2016, 9:32 a.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/trac/files/trac_performance_fix.py ('k') | no next file » | 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 trac( 1 class trac(
2 $domain, 2 $domain,
3 $certificate, 3 $certificate,
4 $private_key, 4 $private_key,
5 $fcgi_config_dir = '/etc/nginx/trac.d', 5 $fcgi_config_dir = '/etc/nginx/trac.d',
6 $is_default = false) inherits private::trac { 6 $is_default = false) inherits private::trac {
7 7
8 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']: 8 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']:
9 ensure => present 9 ensure => present
10 } 10 }
11 11
12 include nginx, spawn-fcgi 12 include stdlib,
13 nginx,
14 spawn-fcgi
13 15
14 file {$fcgi_config_dir: 16 file {$fcgi_config_dir:
15 ensure => directory, 17 ensure => directory,
16 owner => 'root', 18 owner => 'root',
17 mode => 755, 19 mode => 755,
18 require => Package['nginx'], 20 require => Package['nginx'],
19 } 21 }
20 22
21 nginx::hostconfig {$domain: 23 nginx::hostconfig {$domain:
22 content => "include $fcgi_config_dir/*;", 24 content => "include $fcgi_config_dir/*;",
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 command => "pip install TracThemeEngine", 96 command => "pip install TracThemeEngine",
95 require => Package['python-pip'], 97 require => Package['python-pip'],
96 unless => "python -c 'import themeengine'", 98 unless => "python -c 'import themeengine'",
97 } 99 }
98 100
99 package { 'spambayes': 101 package { 'spambayes':
100 ensure => "installed" 102 ensure => "installed"
101 } 103 }
102 104
103 exec { 'install_TracSpamFilter': 105 exec { 'install_TracSpamFilter':
104 command => "pip install svn+http://svn.edgewall.com/repos/trac/plugins/1.0/s pam-filter", 106 command => "pip install svn+https://svn.edgewall.org/repos/trac/plugins/1.0/ spam-filter",
105 require => Package[ 107 require => Package[
106 'spambayes', 108 'spambayes',
107 'python-pip'], 109 'python-pip'],
108 unless => "python -c 'import tracspamfilter'", 110 unless => "python -c 'import tracspamfilter'",
109 } 111 }
110 112
111 exec { 'install_Tractags': 113 exec { 'install_Tractags':
112 command => "pip install svn+https://trac-hacks.org/svn/tagsplugin/tags/0.7/" , 114 command => "pip install svn+https://trac-hacks.org/svn/tagsplugin/tags/0.7/" ,
113 require => Package['python-pip'], 115 require => Package['python-pip'],
114 unless => "python -c 'import tractags'", 116 unless => "python -c 'import tractags'",
(...skipping 23 matching lines...) Expand all
138 owner => 'trac', 140 owner => 'trac',
139 mode => 644, 141 mode => 644,
140 } 142 }
141 143
142 file {'/home/trac/robots.txt': 144 file {'/home/trac/robots.txt':
143 ensure => 'present', 145 ensure => 'present',
144 source => 'puppet:///modules/trac/robots.txt', 146 source => 'puppet:///modules/trac/robots.txt',
145 owner => 'trac', 147 owner => 'trac',
146 mode => 644, 148 mode => 644,
147 } 149 }
150
151 file {"trac_performance_fix_py":
152 ensure => present,
153 path => '/usr/local/lib/python2.7/dist-packages/trac_performance_fix.py',
154 source => 'puppet:///modules/trac/trac_performance_fix.py',
155 owner => 'root',
156 mode => 644,
157 }
158
148 159
149 define instance ( 160 define instance (
150 $config = 'trac/trac.ini.erb', 161 $config = 'trac/trac.ini.erb',
151 $description = 'Issue Tracker', 162 $description = 'Issue Tracker',
152 $location = '/', 163 $location = '/',
153 $logo = 'puppet:///modules/trac/logo.png', 164 $logo = 'puppet:///modules/trac/logo.png',
154 $database = 'trac', 165 $database = 'trac',
155 $permissions = 'puppet:///modules/trac/permissions.csv', 166 $permissions = 'puppet:///modules/trac/permissions.csv',
156 $theme = 'puppet:///modules/trac/theme.css') { 167 $theme = 'puppet:///modules/trac/theme.css') {
157 168
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Exec['install_TicketTemplate'], 237 Exec['install_TicketTemplate'],
227 Exec['install_NeverNotifyUpdater'], 238 Exec['install_NeverNotifyUpdater'],
228 Exec['install_MasterTickets'], 239 Exec['install_MasterTickets'],
229 Exec['install_ThemeEngine'], 240 Exec['install_ThemeEngine'],
230 Exec['install_Tractags'], 241 Exec['install_Tractags'],
231 Exec['install_TracSpamFilter'], 242 Exec['install_TracSpamFilter'],
232 Exec['install_PrivateTickets'], 243 Exec['install_PrivateTickets'],
233 Exec['install_TracXMLRPC'], 244 Exec['install_TracXMLRPC'],
234 Exec['install_TracHTTPAuth']], 245 Exec['install_TracHTTPAuth']],
235 } 246 }
236 247
237 # Ref https://issues.adblockplus.org/ticket/4641
238 $cgi_performance_fix = "
Wladimir Palant 2016/11/16 09:26:18 Nit: This isn't really related to CGI in any way,
f.nicolaisen 2016/11/16 15:01:28 Acknowledged.
239 ### Local modifications to the trac.fcgi file
240 from trac.web.session import Session
241 orig_get = Session.get
242 def patched_get(self, key, default=None):
243 if key == 'accesskeys':
244 return '1'
245 return orig_get(self, key, default)
246 Session.get = patched_get
247 ### End of local modifications
248 "
249
250 exec {"deploy_$name": 248 exec {"deploy_$name":
251 command => "trac-admin /home/trac/$environment \ 249 command => "trac-admin /home/trac/$environment \
252 deploy /home/trac/htdocs-$name \ 250 deploy /home/trac/htdocs-$name \
253 && fromdos /home/trac/htdocs-$name/cgi-bin/trac.fcgi \ 251 && fromdos /home/trac/htdocs-$name/cgi-bin/trac.fcgi \
254 && chmod 755 /home/trac/htdocs-$name/cgi-bin/trac.fcgi", 252 && chmod 755 /home/trac/htdocs-$name/cgi-bin/trac.fcgi",
255 user => trac, 253 user => trac,
256 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 254 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
257 require => [ 255 require => [
258 Exec["update_env_$name"], 256 Exec["update_env_$name"],
259 Package["tofrodos"]], 257 Package["tofrodos"]],
260 } -> 258 }
261 exec {"append_cgi_config_to_$name": 259
262 command => "echo \"$cgi_performance_fix\" >> /home/trac/htdocs-$name/cgi-b in/trac.fcgi", 260 file_line { "patch $name trac.fcgi":
Wladimir Palant 2016/11/16 09:26:18 Actually, this needs to be added at the top of the
f.nicolaisen 2016/11/16 15:01:28 Acknowledged.
263 user => trac, 261 path => "/home/trac/htdocs-$name/cgi-bin/trac.fcgi",
264 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 262 match => '^# Author.*$',
Wladimir Palant 2016/11/16 09:26:18 The way I see it, this command will run every time
f.nicolaisen 2016/11/16 15:01:28 Won't it only run after the "deploy_$name" exec is
Wladimir Palant 2016/11/16 15:16:44 Given that deploy_$name runs every time - sure. No
263 line => "# Author\nimport trac_performance_fix",
264 require => Exec["deploy_$name"],
265 } 265 }
266 266
267 file {"/home/trac/htdocs-$name/htdocs/common/logo.png": 267 file {"/home/trac/htdocs-$name/htdocs/common/logo.png":
268 ensure => present, 268 ensure => present,
269 source => $logo, 269 source => $logo,
270 owner => trac, 270 owner => trac,
271 require => Exec["deploy_$name"], 271 require => Exec["deploy_$name"],
272 } 272 }
273 273
274 spawn-fcgi::pool {"tracd_${name}": 274 spawn-fcgi::pool {"tracd_${name}":
(...skipping 15 matching lines...) Expand all
290 # Daily restart required for log rotation of all instances at once 290 # Daily restart required for log rotation of all instances at once
291 cron {'restart-trac-daily': 291 cron {'restart-trac-daily':
292 command => 'service spawn-fcgi restart >/tmp/spawn-fcgi-restart.log', 292 command => 'service spawn-fcgi restart >/tmp/spawn-fcgi-restart.log',
293 environment => hiera('cron::environment', []), 293 environment => hiera('cron::environment', []),
294 hour => '1', 294 hour => '1',
295 minute => '0', 295 minute => '0',
296 user => 'root', 296 user => 'root',
297 } 297 }
298 } 298 }
299 299
LEFTRIGHT

Powered by Google App Engine
This is Rietveld