Add a reindex lock
This modifies the apache configuration to look for a reindexing lock file and return a 503 page if it exists. This is intended to be managed by a cron job during reindexing procedures. Change-Id: I9d28201bca75b624e07cbba14c870151094fc7ae
This commit is contained in:
parent
0ec1c6f0cd
commit
e27427d7ef
|
@ -3,3 +3,8 @@
|
|||
## Overview
|
||||
|
||||
Install and configure Hound.
|
||||
|
||||
Since indexing can take some time, the Apache host is setup to look
|
||||
for a $docroot/hound.reindexing file, and return a sensible 503
|
||||
maintenance page. An external script can manage this file as
|
||||
reindexing takes place.
|
||||
|
|
|
@ -5,6 +5,7 @@ class hound (
|
|||
$config_json = 'hound/config.json',
|
||||
$datadir = '/home/hound/data',
|
||||
$manage_config = true,
|
||||
$docroot = '/var/www/hound',
|
||||
$serveradmin = "webmaster@${::fqdn}",
|
||||
$serveraliases = undef,
|
||||
$vhost_name = $::fqdn,
|
||||
|
@ -114,9 +115,25 @@ class hound (
|
|||
|
||||
httpd::vhost { $vhost_name:
|
||||
port => 80,
|
||||
docroot => 'MEANINGLESS ARGUMENT',
|
||||
docroot => $docroot,
|
||||
priority => '50',
|
||||
template => 'hound/hound.vhost.erb',
|
||||
require => File["${docroot}/503.html"],
|
||||
}
|
||||
|
||||
file { $docroot:
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755'
|
||||
}
|
||||
|
||||
file { "${docroot}/503.html":
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template('hound/503.html.erb'),
|
||||
}
|
||||
|
||||
file { '/var/log/hound.log':
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<html>
|
||||
<title>codesearch is updating</title>
|
||||
<body>
|
||||
<p>Codesearch is reindexing, please try again soon!</p>
|
||||
</body>
|
||||
</html>
|
|
@ -13,9 +13,26 @@
|
|||
|
||||
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("hound::vhost_name") %>-access.log combined
|
||||
|
||||
<IfModule mod_proxy.c>
|
||||
RewriteEngine on
|
||||
RewriteEngine on
|
||||
|
||||
DocumentRoot <%= @docroot %>
|
||||
<Directory <%= @docroot %>>
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
Require all granted
|
||||
# Allow mod_rewrite rules
|
||||
AllowOverride FileInfo
|
||||
</Directory>
|
||||
|
||||
# Redirect to a 503 page if hound.reindexing file exists
|
||||
ErrorDocument 503 /503.html
|
||||
RewriteRule ^/503\.html$ - [L]
|
||||
RewriteCond %{ENV:REDIRECT_STATUS} !=503
|
||||
RewriteCond "<%= @docroot %>/hound.reindexing" -f
|
||||
RewriteRule ^(.*)$ /$1 [R=503,L]
|
||||
|
||||
<IfModule mod_proxy.c>
|
||||
RewriteRule ^/(.*)$ http://localhost:6080/$1 [P]
|
||||
ProxyPassReverse / http://localhost:6080/
|
||||
</IfModule>
|
||||
|
|
Loading…
Reference in New Issue