795bf1c971
This provides a script to resync the hound configuration for codesearch. It checks if the config needs updating, and if so, puts the new config file in place, takes the reindex lock from I9d28201bca75b624e07cbba14c870151094fc7ae and restarts the service, waiting until it sees it is up. puppet is currently disabled on this host because updates are tied to project-config changes; since restarting takes the service down this is obviously not great. Change-Id: Iaebf50836607da447dcf1765ec01d0121537b0da Depends-On: I9d28201bca75b624e07cbba14c870151094fc7ae
60 lines
1.4 KiB
Puppet
60 lines
1.4 KiB
Puppet
# Class to configure hound on a node.
|
|
class openstack_project::codesearch (
|
|
$project_config_repo,
|
|
) {
|
|
|
|
class { 'project_config':
|
|
url => $project_config_repo,
|
|
}
|
|
|
|
class { 'hound':
|
|
manage_config => false,
|
|
}
|
|
|
|
include ::jeepyb
|
|
include ::logrotate
|
|
include ::pip
|
|
|
|
file { '/home/hound/config.json':
|
|
ensure => 'present',
|
|
}
|
|
|
|
file { '/usr/local/bin/resync-hound-config':
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0755',
|
|
source => 'puppet:///modules/openstack_project/resync-hound-config.sh',
|
|
}
|
|
|
|
# Note: we could trigger this from project-config changes, but it
|
|
# does bring the service down for several minutes if something
|
|
# changes. Once a day should be enough.
|
|
cron { 'hound':
|
|
user => root,
|
|
hour => '4',
|
|
command => 'flock -n /var/run/hound/sync.lock resync-hound-config 2>&1 >> /var/log/hound.sync.log',
|
|
environment => [
|
|
'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
|
|
"PROJECTS_YAML=${::project_config::jeepyb_project_file}",
|
|
],
|
|
require => [
|
|
File['/usr/local/bin/resync-hound-config'],
|
|
File['/home/hound/config.json'],
|
|
],
|
|
}
|
|
|
|
logrotate::file { 'hound-sync':
|
|
log => '/var/log/hound.sync.log',
|
|
options => [
|
|
'compress',
|
|
'copytruncate',
|
|
'missingok',
|
|
'rotate 7',
|
|
'daily',
|
|
'notifempty',
|
|
],
|
|
}
|
|
|
|
}
|