move to elastic-recheck web console in share

this provides the changes needed to handle the new elastic-recheck
web console installed from the elastic-recheck package in the
share tree.

factor out bot code to elastic_recheck::bot

this change moves elastic_recheck bot starting code out into
a separate module, which lets us include all the elastic_recheck
base module into the static site config.

Change-Id: If53523754494a746c152c5d1384db5426b096fc1
This commit is contained in:
Sean Dague 2013-12-05 17:02:59 -05:00
parent 7a2168d572
commit b3af619900
6 changed files with 118 additions and 139 deletions

View File

@ -379,13 +379,13 @@ node 'summit.openstack.org' {
# A machine to serve static content.
node 'static.openstack.org' {
class { 'openstack_project::static':
sysadmins => hiera('sysadmins'),
reviewday_rsa_key_contents => hiera('reviewday_rsa_key_contents'),
reviewday_rsa_pubkey_contents => hiera('reviewday_rsa_pubkey_contents'),
reviewday_gerrit_ssh_key => hiera('gerrit_ssh_rsa_pubkey_contents'),
releasestatus_prvkey_contents => hiera('releasestatus_rsa_key_contents'),
releasestatus_pubkey_contents => hiera('releasestatus_rsa_pubkey_contents'),
releasestatus_gerrit_ssh_key => hiera('gerrit_ssh_rsa_pubkey_contents'),
sysadmins => hiera('sysadmins'),
reviewday_rsa_key_contents => hiera('reviewday_rsa_key_contents'),
reviewday_rsa_pubkey_contents => hiera('reviewday_rsa_pubkey_contents'),
reviewday_gerrit_ssh_key => hiera('gerrit_ssh_rsa_pubkey_contents'),
releasestatus_prvkey_contents => hiera('releasestatus_rsa_key_contents'),
releasestatus_pubkey_contents => hiera('releasestatus_rsa_pubkey_contents'),
releasestatus_gerrit_ssh_key => hiera('gerrit_ssh_rsa_pubkey_contents'),
}
}

View File

@ -0,0 +1,83 @@
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2013 Samsung Electronics
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Class to install and configure an instance of the elastic-recheck
# service.
#
class elastic_recheck::bot (
$gerrit_host,
$gerrit_ssh_private_key,
$gerrit_ssh_private_key_contents,
#not used today, will be used when elastic-recheck supports it.
$elasticsearch_url,
$recheck_bot_passwd,
$gerrit_user = 'elasticrecheck',
$recheck_bot_nick = 'openstackrecheck',
) {
include elastic_recheck
file { '/etc/elastic-recheck/elastic-recheck.conf':
ensure => present,
mode => '0640',
owner => 'recheck',
group => 'recheck',
content => template('elastic_recheck/elastic-recheck.conf.erb'),
require => Class['elastic_recheck'],
}
file { '/home/recheck':
ensure => directory,
mode => '0700',
owner => 'recheck',
group => 'recheck',
require => Class['elastic_recheck'],
}
file { '/home/recheck/.ssh':
ensure => directory,
mode => '0700',
owner => 'recheck',
group => 'recheck',
require => Class['elastic_recheck'],
}
file { $gerrit_ssh_private_key:
ensure => present,
mode => '0600',
owner => 'recheck',
group => 'recheck',
content => $gerrit_ssh_private_key_contents,
require => Class['elastic_recheck'],
}
file { '/etc/init.d/elastic-recheck':
ensure => present,
mode => '0755',
owner => 'root',
group => 'root',
source => 'puppet:///modules/elastic_recheck/elastic-recheck.init',
}
service { 'elastic-recheck':
ensure => running,
enable => true,
subscribe => File['/etc/elastic-recheck/elastic-recheck.conf'],
require => [
Class['elastic_recheck'],
File['/etc/init.d/elastic-recheck'],
File['/etc/elastic-recheck/elastic-recheck.conf'],
],
}
}

View File

@ -16,14 +16,6 @@
# service.
#
class elastic_recheck (
$gerrit_host,
$gerrit_ssh_private_key,
$gerrit_ssh_private_key_contents,
#not used today, will be used when elastic-recheck supports it.
$elasticsearch_url,
$recheck_bot_passwd,
$gerrit_user = 'elasticrecheck',
$recheck_bot_nick = 'openstackrecheck'
) {
group { 'recheck':
ensure => 'present',
@ -62,6 +54,14 @@ class elastic_recheck (
require => User['recheck'],
}
file { '/var/lib/elastic-recheck':
ensure => directory,
mode => '0755',
owner => 'recheck',
group => 'recheck',
require => User['recheck'],
}
file { '/var/log/elastic-recheck':
ensure => directory,
mode => '0755',
@ -78,15 +78,6 @@ class elastic_recheck (
require => User['recheck'],
}
file { '/etc/elastic-recheck/elastic-recheck.conf':
ensure => present,
mode => '0640',
owner => 'recheck',
group => 'recheck',
content => template('elastic_recheck/elastic-recheck.conf.erb'),
require => File['/etc/elastic-recheck'],
}
file { '/etc/elastic-recheck/logging.config':
ensure => present,
mode => '0640',
@ -105,17 +96,6 @@ class elastic_recheck (
require => File['/etc/elastic-recheck'],
}
# TODO(clarkb) put queries.yaml somewhere else.
file { '/etc/elastic-recheck/queries.yaml':
ensure => link,
target => '/opt/elastic-recheck/queries.yaml',
require => [
Vcsrepo['/opt/elastic-recheck'],
File['/etc/elastic-recheck'],
],
}
# Link in the queries directory for refactoring
file { '/etc/elastic-recheck/queries':
ensure => link,
target => '/opt/elastic-recheck/queries',
@ -124,49 +104,4 @@ class elastic_recheck (
File['/etc/elastic-recheck'],
],
}
file { '/home/recheck':
ensure => directory,
mode => '0700',
owner => 'recheck',
group => 'recheck',
require => User['recheck'],
}
file { '/home/recheck/.ssh':
ensure => directory,
mode => '0700',
owner => 'recheck',
group => 'recheck',
require => User['recheck'],
}
file { $gerrit_ssh_private_key:
ensure => present,
mode => '0600',
owner => 'recheck',
group => 'recheck',
content => $gerrit_ssh_private_key_contents,
require => User['recheck'],
}
file { '/etc/init.d/elastic-recheck':
ensure => present,
mode => '0755',
owner => 'root',
group => 'root',
source => 'puppet:///modules/elastic_recheck/elastic-recheck.init',
}
service { 'elastic-recheck':
ensure => running,
enable => true,
subscribe => File['/etc/elastic-recheck/elastic-recheck.conf'],
require => [
File['/etc/init.d/elastic-recheck'],
File['/etc/elastic-recheck/elastic-recheck.conf'],
File['/etc/elastic-recheck/queries.yaml'],
Exec['install_elastic-recheck'],
],
}
}

View File

@ -117,7 +117,7 @@ class openstack_project::logstash (
require => Service['jenkins-log-client'],
}
class { 'elastic_recheck':
class { 'elastic_recheck::bot':
gerrit_host => $gerrit_host,
gerrit_ssh_private_key => $gerrit_ssh_private_key,
gerrit_ssh_private_key_contents => $gerrit_ssh_private_key_contents,

View File

@ -8,7 +8,7 @@ class openstack_project::static (
$releasestatus_prvkey_contents = '',
$releasestatus_pubkey_contents = '',
$releasestatus_gerrit_ssh_key = '',
$er_state_dir = '/srv/static/status/elastic-recheck',
$er_state_dir = '/var/lib/elastic-recheck',
) {
class { 'openstack_project::server':
@ -307,61 +307,7 @@ class openstack_project::static (
###########################################################
# Status - elastic-recheck
group { 'recheck':
ensure => 'present',
}
user { 'recheck':
ensure => present,
home => '/home/recheck',
shell => '/bin/bash',
gid => 'recheck',
require => Group['recheck'],
}
file { '/home/recheck':
ensure => directory,
mode => '0700',
owner => 'recheck',
group => 'recheck',
require => User['recheck'],
}
vcsrepo { '/opt/elastic-recheck':
ensure => latest,
provider => git,
revision => 'master',
source => 'https://git.openstack.org/openstack-infra/elastic-recheck',
}
include pip
exec { 'install_elastic-recheck' :
command => 'pip install /opt/elastic-recheck',
path => '/usr/local/bin:/usr/bin:/bin/',
refreshonly => true,
subscribe => Vcsrepo['/opt/elastic-recheck'],
require => Class['pip'],
}
file { '/srv/static/status/elastic-recheck':
ensure => directory,
owner => 'recheck',
group => 'recheck',
require => User['recheck'],
}
file { '/srv/static/status/elastic-recheck/index.html':
ensure => present,
source => 'puppet:///modules/openstack_project/elastic-recheck/elastic-recheck.html',
require => File['/srv/static/status/elastic-recheck'],
}
file { '/srv/static/status/elastic-recheck/elastic-recheck.js':
ensure => present,
source => 'puppet:///modules/openstack_project/elastic-recheck/elastic-recheck.js',
require => File['/srv/static/status/elastic-recheck'],
}
include elastic_recheck
cron { 'elastic-recheck':
user => 'recheck',
@ -369,8 +315,7 @@ class openstack_project::static (
hour => '*',
command => "elastic-recheck-graph /opt/elastic-recheck/queries -o ${er_state_dir}/graph-new.json && mv ${er_state_dir}/graph-new.json ${er_state_dir}/graph.json",
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
require => [Vcsrepo['/opt/elastic-recheck'],
User['recheck']],
require => Class['elastic_recheck']
}
###########################################################

View File

@ -38,6 +38,22 @@ NameVirtualHost <%= vhost_name %>:<%= port %>
allow from all
</Directory>
# Sample elastic-recheck config file, adjust prefixes
# per your local configuration
Alias /elastic-recheck /usr/local/share/elastic-recheck
<Directory /usr/local/share/elastic-recheck>
Options FollowSymlinks
AllowOverride None
Require all granted
</Directory>
Alias /elastic-recheck/data /var/lib/elastic-recheck
<Directory /var/lib/elastic-recheck>
Options FollowSymlinks
AllowOverride None
Require all granted
</Directory>
ErrorLog /var/log/apache2/<%= name %>_error.log
LogLevel warn
CustomLog /var/log/apache2/<%= name %>_access.log combined