Merge "Use common log server implementation"

This commit is contained in:
Jenkins 2015-05-06 18:26:09 +00:00 committed by Gerrit Code Review
commit 518c54f841
5 changed files with 9 additions and 311 deletions

View File

@ -1,2 +0,0 @@
User-agent: *
Disallow: /

View File

@ -77,126 +77,15 @@ class openstack_project::static (
###########################################################
# Logs
apache::vhost { 'logs.openstack.org':
port => 80,
priority => '50',
docroot => '/srv/static/logs',
require => File['/srv/static/logs'],
template => 'openstack_project/logs.vhost.erb',
}
apache::vhost { 'logs-dev.openstack.org':
port => 80,
priority => '51',
docroot => '/srv/static/logs',
require => File['/srv/static/logs'],
template => 'openstack_project/logs-dev.vhost.erb',
}
file { '/srv/static/logs':
ensure => directory,
owner => 'jenkins',
group => 'jenkins',
require => User['jenkins'],
}
file { '/srv/static/logs/robots.txt':
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
source => 'puppet:///modules/openstack_project/disallow_robots.txt',
require => File['/srv/static/logs'],
}
package { 'keyring':
ensure => 'latest',
provider => 'pip',
}
vcsrepo { '/opt/os-loganalyze':
ensure => latest,
provider => git,
revision => 'master',
source => 'https://git.openstack.org/openstack-infra/os-loganalyze',
require => Package['keyring'],
}
exec { 'install_os-loganalyze':
command => 'python setup.py install',
cwd => '/opt/os-loganalyze',
path => '/bin:/usr/bin',
refreshonly => true,
subscribe => Vcsrepo['/opt/os-loganalyze'],
}
file { '/etc/os_loganalyze':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => Vcsrepo['/opt/os-loganalyze'],
}
file { '/etc/os_loganalyze/wsgi.conf':
ensure => present,
owner => 'root',
group => 'www-data',
mode => '0440',
content => template('openstack_project/os-loganalyze-wsgi.conf.erb'),
require => File['/etc/os_loganalyze'],
}
vcsrepo { '/opt/devstack-gate':
ensure => latest,
provider => git,
revision => 'master',
source => 'https://git.openstack.org/openstack-infra/devstack-gate',
}
file { '/srv/static/logs/help':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => File['/srv/static/logs'],
}
file { '/srv/static/logs/help/tempest-logs.html':
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
source => 'file:///opt/devstack-gate/help/tempest-logs.html',
require => [File['/srv/static/logs/help'], Vcsrepo['/opt/devstack-gate']],
}
file { '/srv/static/logs/help/tempest-overview.html':
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
source => 'file:///opt/devstack-gate/help/tempest-overview.html',
require => [File['/srv/static/logs/help'], Vcsrepo['/opt/devstack-gate']],
}
file { '/usr/local/sbin/log_archive_maintenance.sh':
ensure => present,
owner => 'root',
group => 'root',
mode => '0744',
source => 'puppet:///modules/openstack_project/log_archive_maintenance.sh',
}
cron { 'gziprmlogs':
user => 'root',
minute => '0',
hour => '7',
weekday => '6',
command => 'bash /usr/local/sbin/log_archive_maintenance.sh',
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
require => File['/usr/local/sbin/log_archive_maintenance.sh'],
class { 'openstackci::logserver':
jenkins_ssh_key => $openstack_project::jenkins_ssh_key,
domain => 'openstack.org',
swift_authurl => $swift_authurl,
swift_user => $swift_user,
swift_key => $swift_key,
swift_tenant_name => $swift_tenant_name,
swift_region_name => $swift_region_name,
swift_default_container => $swift_default_container,
}
###########################################################

View File

@ -1,88 +0,0 @@
# -*- apache -*-
# ************************************
# Managed by Puppet
# ************************************
NameVirtualHost <%= @vhost_name %>:<%= @port %>
<VirtualHost <%= @vhost_name %>:<%= @port %>>
ServerName <%= @srvname %>
<% if @serveraliases.is_a? Array -%>
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif @serveraliases != '' -%>
<%= " ServerAlias #{@serveraliases}" %>
<% end -%>
DocumentRoot <%= @docroot %>
# use Apache to compress the results afterwards, to save on the wire
# it's approx 18x savings of wire traffic to compress. We need to
# compress by content types that htmlify can produce
AddOutputFilterByType DEFLATE text/plain text/html
<FilesMatch \.html\.gz$>
ForceType text/html
AddDefaultCharset UTF-8
AddEncoding x-gzip gz
</FilesMatch>
<Directory <%= @docroot %>>
Options <%= @options %>
AllowOverride None
Order allow,deny
allow from all
Satisfy Any
</Directory>
<Directory /usr/local/lib/python2.7/dist-packages/os_loganalyze>
Allow from all
Satisfy Any
</Directory>
<Directory <%= @docroot %>/*/*/*/*/*-tempest-dsvm*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= @docroot %>/periodic*/*/*-tempest-dsvm*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= @docroot %>/*/*/*/*/*-tempest-dsvm*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
<Directory <%= @docroot %>/periodic*/*/*-tempest-dsvm*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
# old patterns, can be removed in July 2014
<Directory <%= @docroot %>/*/*/*/*/gate-tempest-devstack*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= @docroot %>/periodic/*/periodic-tempest-devstack*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= @docroot %>/*/*/*/*/gate-tempest-devstack*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
<Directory <%= @docroot %>/periodic/*/periodic-tempest-devstack*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
RewriteEngine On
# rewrite all txt.gz & html.gz files to map to our internal htmlify wsgi app
# PT, Pass-through: to come back around and get picked up by the WSGIScriptAlias
# NS, No-subrequest: on coming back through, mod-autoindex may have added index.html
# which would match the !-f condition. We therefore ensure the
# rewrite doesn't trigger by disallowing subrequests.
RewriteRule ^/(.*\.txt\.gz)$ /htmlify/$1 [QSA,L,PT,NS]
RewriteRule ^/(.*console\.html(\.gz)?)$ /htmlify/$1 [QSA,L,PT,NS]
# Check if the request exists as a file, directory or symbolic link
# If not, write the request to htmlify to see if we can fetch from swift
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !^/icon
RewriteRule ^/(.*)$ /htmlify/$1 [QSA,L,PT,NS]
WSGIScriptAlias /htmlify /usr/local/lib/python2.7/dist-packages/os_loganalyze/wsgi.py
ErrorLog /var/log/apache2/<%= @name %>_error.log
LogLevel warn
CustomLog /var/log/apache2/<%= @name %>_access.log combined
ServerSignature Off
</VirtualHost>

View File

@ -1,91 +0,0 @@
# -*- apache -*-
# ************************************
# Managed by Puppet
# ************************************
NameVirtualHost <%= vhost_name %>:<%= port %>
<VirtualHost <%= vhost_name %>:<%= port %>>
ServerName <%= srvname %>
<% if serveraliases.is_a? Array -%>
<% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif serveraliases != '' -%>
<%= " ServerAlias #{serveraliases}" %>
<% end -%>
DocumentRoot <%= docroot %>
# use Apache to compress the results afterwards, to save on the wire
# it's approx 18x savings of wire traffic to compress. We need to
# compress by content types that htmlify can produce
AddOutputFilterByType DEFLATE text/plain text/html
<FilesMatch \.html\.gz$>
ForceType text/html
AddDefaultCharset UTF-8
AddEncoding x-gzip gz
</FilesMatch>
<Directory <%= docroot %>>
Options <%= options %>
AllowOverride None
Order allow,deny
allow from all
Satisfy Any
</Directory>
<Directory /usr/local/lib/python2.7/dist-packages/os_loganalyze>
Allow from all
Satisfy Any
</Directory>
<Directory <%= docroot %>/*/*/*/*/*-tempest-dsvm*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= docroot %>/periodic*/*/*-tempest-dsvm*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= docroot %>/*/*/*/*/*-tempest-dsvm*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
<Directory <%= docroot %>/periodic*/*/*-tempest-dsvm*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
# old patterns, can be removed in July 2014
<Directory <%= docroot %>/*/*/*/*/gate-tempest-devstack*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= docroot %>/periodic/*/periodic-tempest-devstack*/*>
ReadmeName /help/tempest-overview.html
</Directory>
<Directory <%= docroot %>/*/*/*/*/gate-tempest-devstack*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
<Directory <%= docroot %>/periodic/*/periodic-tempest-devstack*/*/logs/>
ReadmeName /help/tempest-logs.html
</Directory>
RewriteEngine On
# rewrite txt.gz & console.html[.gz] files to map to our internal htmlify
# wsgi app
# PT, Pass-through: to come back around and get picked up by the
# WSGIScriptAlias
# NS, No-subrequest: on coming back through, mod-autoindex may have added
# index.html which would match the !-f condition. We
# therefore ensure the rewrite doesn't trigger by
# disallowing subrequests.
RewriteRule ^/(.*\.txt\.gz)$ /htmlify/$1 [QSA,L,PT,NS]
RewriteRule ^/(.*console\.html(\.gz)?)$ /htmlify/$1 [QSA,L,PT,NS]
# Check if the request exists as a file, directory or symbolic link
# If not, write the request to htmlify to see if we can fetch from swift
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !^/icon
RewriteRule ^/(.*)$ /htmlify/$1 [QSA,L,PT,NS]
WSGIScriptAlias /htmlify /usr/local/lib/python2.7/dist-packages/os_loganalyze/wsgi.py
ErrorLog /var/log/apache2/<%= name %>_error.log
LogLevel warn
CustomLog /var/log/apache2/<%= name %>_access.log combined
ServerSignature Off
</VirtualHost>

View File

@ -1,10 +0,0 @@
<% if swift_authurl != "" -%>
[swift]
authurl=<%= swift_authurl %>
user=<%= swift_user %>
password=<%= swift_key %>
tenant=<%= swift_tenant_name %>
region=<%= swift_region_name %>
chunk_size=64
container=<%= swift_default_container %>
<% end -%>