From 20e6ffb579e8872f9fc3f66b4f82c52716461796 Mon Sep 17 00:00:00 2001 From: Ramy Asselin Date: Tue, 24 Mar 2015 15:49:19 -0700 Subject: [PATCH] Use common log server implementation Depends-On: Ib8476df83b7c5491158fa3cab588213be60fa2ab Change-Id: I390f6ea8aaace276d211d55a0e17f25dd6ae26b5 --- .../files/disallow_robots.txt | 2 - modules/openstack_project/manifests/static.pp | 129 ++---------------- .../templates/logs-dev.vhost.erb | 88 ------------ .../templates/logs.vhost.erb | 91 ------------ .../templates/os-loganalyze-wsgi.conf.erb | 10 -- 5 files changed, 9 insertions(+), 311 deletions(-) delete mode 100644 modules/openstack_project/files/disallow_robots.txt delete mode 100644 modules/openstack_project/templates/logs-dev.vhost.erb delete mode 100644 modules/openstack_project/templates/logs.vhost.erb delete mode 100644 modules/openstack_project/templates/os-loganalyze-wsgi.conf.erb diff --git a/modules/openstack_project/files/disallow_robots.txt b/modules/openstack_project/files/disallow_robots.txt deleted file mode 100644 index 1f53798bb4..0000000000 --- a/modules/openstack_project/files/disallow_robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / diff --git a/modules/openstack_project/manifests/static.pp b/modules/openstack_project/manifests/static.pp index 826ba2aee9..4b65cd344d 100644 --- a/modules/openstack_project/manifests/static.pp +++ b/modules/openstack_project/manifests/static.pp @@ -80,126 +80,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, } ########################################################### diff --git a/modules/openstack_project/templates/logs-dev.vhost.erb b/modules/openstack_project/templates/logs-dev.vhost.erb deleted file mode 100644 index 48d6e1b136..0000000000 --- a/modules/openstack_project/templates/logs-dev.vhost.erb +++ /dev/null @@ -1,88 +0,0 @@ -# -*- apache -*- -# ************************************ -# Managed by Puppet -# ************************************ - -NameVirtualHost <%= @vhost_name %>:<%= @port %> -:<%= @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 - - - ForceType text/html - AddDefaultCharset UTF-8 - AddEncoding x-gzip gz - - > - Options <%= @options %> - AllowOverride None - Order allow,deny - allow from all - Satisfy Any - - - Allow from all - Satisfy Any - - - /*/*/*/*/*-tempest-dsvm*/*> - ReadmeName /help/tempest-overview.html - - /periodic*/*/*-tempest-dsvm*/*> - ReadmeName /help/tempest-overview.html - - /*/*/*/*/*-tempest-dsvm*/*/logs/> - ReadmeName /help/tempest-logs.html - - /periodic*/*/*-tempest-dsvm*/*/logs/> - ReadmeName /help/tempest-logs.html - - - # old patterns, can be removed in July 2014 - /*/*/*/*/gate-tempest-devstack*/*> - ReadmeName /help/tempest-overview.html - - /periodic/*/periodic-tempest-devstack*/*> - ReadmeName /help/tempest-overview.html - - /*/*/*/*/gate-tempest-devstack*/*/logs/> - ReadmeName /help/tempest-logs.html - - /periodic/*/periodic-tempest-devstack*/*/logs/> - ReadmeName /help/tempest-logs.html - - - 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 - diff --git a/modules/openstack_project/templates/logs.vhost.erb b/modules/openstack_project/templates/logs.vhost.erb deleted file mode 100644 index 1bec5be358..0000000000 --- a/modules/openstack_project/templates/logs.vhost.erb +++ /dev/null @@ -1,91 +0,0 @@ -# -*- apache -*- -# ************************************ -# Managed by Puppet -# ************************************ - -NameVirtualHost <%= vhost_name %>:<%= port %> -:<%= 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 - - - ForceType text/html - AddDefaultCharset UTF-8 - AddEncoding x-gzip gz - - > - Options <%= options %> - AllowOverride None - Order allow,deny - allow from all - Satisfy Any - - - Allow from all - Satisfy Any - - - /*/*/*/*/*-tempest-dsvm*/*> - ReadmeName /help/tempest-overview.html - - /periodic*/*/*-tempest-dsvm*/*> - ReadmeName /help/tempest-overview.html - - /*/*/*/*/*-tempest-dsvm*/*/logs/> - ReadmeName /help/tempest-logs.html - - /periodic*/*/*-tempest-dsvm*/*/logs/> - ReadmeName /help/tempest-logs.html - - - # old patterns, can be removed in July 2014 - /*/*/*/*/gate-tempest-devstack*/*> - ReadmeName /help/tempest-overview.html - - /periodic/*/periodic-tempest-devstack*/*> - ReadmeName /help/tempest-overview.html - - /*/*/*/*/gate-tempest-devstack*/*/logs/> - ReadmeName /help/tempest-logs.html - - /periodic/*/periodic-tempest-devstack*/*/logs/> - ReadmeName /help/tempest-logs.html - - - 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 - diff --git a/modules/openstack_project/templates/os-loganalyze-wsgi.conf.erb b/modules/openstack_project/templates/os-loganalyze-wsgi.conf.erb deleted file mode 100644 index a91767081e..0000000000 --- a/modules/openstack_project/templates/os-loganalyze-wsgi.conf.erb +++ /dev/null @@ -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 -%>