Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

legacy jobrunner: use RunJobs for beta #4104

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 73 additions & 4 deletions modules/mediawiki/manifests/jobqueue/shared.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,79 @@
String $version,
VMlib::Ensure $ensure = present,
) {
if versioncmp($version, '1.40') >= 0 {
$runner = "/srv/mediawiki/${version}/maintenance/run.php "
} else {
$runner = ''

$local_only_port = 9007
$php_fpm_sock = 'php/fpm-www.sock'

# Add headers lost by mod_proxy_fastcgi
# The apache module doesn't pass along to the fastcgi appserver
# a few headers, like Content-Type and Content-Length.
# We need to add them back here.
::httpd::conf { 'fcgi_headers':
source => 'puppet:///modules/mediawiki/fcgi_headers.conf',
priority => 0,
}
# Declare the proxies explicitly with retry=0
httpd::conf { 'fcgi_proxies':
ensure => present,
content => template('mediawiki/fcgi_proxies.conf.erb')
}

class { 'httpd':
period => 'daily',
rotate => 7,
modules => [
'alias',
'authz_host',
'autoindex',
'deflate',
'dir',
'expires',
'headers',
'mime',
'rewrite',
'setenvif',
'ssl',
'proxy_fcgi',
]
}

class { 'httpd::mpm':
mpm => 'worker',
}

# Modules we don't enable.
httpd::mod_conf { [
'authz_default',
'authz_groupfile',
'cgi',
]:
ensure => absent,
}

file { '/srv/mediawiki/rpc':
ensure => 'link',
target => '/srv/mediawiki/config/rpc',
owner => 'www-data',
group => 'www-data',
require => File['/srv/mediawiki/config'],
}

httpd::conf { 'jobrunner_port':
ensure => present,
priority => 1,
content => inline_template("# This file is managed by Puppet\nListen <%= @local_only_port %>\n"),
}

httpd::conf { 'jobrunner_timeout':
ensure => present,
priority => 1,
content => inline_template("# This file is managed by Puppet\nTimeout 259200\n"),
}

httpd::site { 'jobrunner':
priority => 1,
content => template('mediawiki/jobrunner_legacy.conf.erb'),
}

git::clone { 'JobRunner':
Expand Down
2 changes: 1 addition & 1 deletion modules/mediawiki/templates/jobrunner-hi.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,5 @@
},

// Command used to launch a runner for a given job queue
"dispatcher": "JOBRUNNER_RUN=true php <%= @runner %>/srv/mediawiki/<%= @version %>/maintenance/runJobs.php --wiki=%(db)x --type=%(type)x --maxtime=%(maxtime)x --memory-limit=%(maxmem)x --result=json"
"dispatcher": "curl -XPOST -s -a 'http:\/\/127.0.0.1:9007\/rpc\/RunJobs.php?wiki=%(db)u&type=%(type)u&maxtime=%(maxtime)u&maxmem=%(maxmem)u'""
}
2 changes: 1 addition & 1 deletion modules/mediawiki/templates/jobrunner.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@
},

// Command used to launch a runner for a given job queue
"dispatcher": "nice -19 php <%= @runner %>/srv/mediawiki/<%= @version %>/maintenance/runJobs.php --wiki=%(db)x --type=%(type)x --maxtime=%(maxtime)x --memory-limit=%(maxmem)x --result=json"
"dispatcher": "curl -XPOST -s -a 'http:\/\/127.0.0.1:9007\/rpc\/RunJobs.php?wiki=%(db)u&type=%(type)u&maxtime=%(maxtime)u&maxmem=%(maxmem)u'"
}
20 changes: 20 additions & 0 deletions modules/mediawiki/templates/jobrunner_legacy.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<%-
-%>
# This file is managed by Puppet

<VirtualHost *:<%= @local_only_port %>>
Timeout 259202
DocumentRoot "/srv/mediawiki"
RewriteEngine On
<Directory /srv/mediawiki>
Require all granted
</Directory>
# Only selected paths are allowed here
RewriteCond %{REQUEST_URI} !^/(w/healthcheck|rpc/RunJobs)\.php
RewriteRule ^ - [R=404,L]
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/<%= @php_fpm_sock %>|fcgi://www"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/jobqueue-error.log
CustomLog ${APACHE_LOG_DIR}/jobqueue-access.log wt
</VirtualHost>
Loading