
ARA is going to bundle a WSGI middleware that allows an operator to route an URL (by default ^.*/ara-report) to the ARA web application. This URL is expected to contain an 'ansible.sqlite' database that would have been uploaded as part of log collection. There are no static files generated as part of this process. The web application reads directly from the database. It is meant to avoid having to generate a static report for each job which does not scale very well for the amount of jobs we are running. For more details, see this code review in ARA [1]. [1]: https://review.openstack.org/#/c/511992/ Change-Id: I3b10c93b4902a9b45e23c227863e472697f662ef
117 lines
4.1 KiB
Plaintext
117 lines
4.1 KiB
Plaintext
# -*- 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 application/x-font-ttf image/svg+xml
|
|
|
|
<FilesMatch \.html\.gz$>
|
|
ForceType text/html
|
|
AddDefaultCharset UTF-8
|
|
AddEncoding x-gzip gz
|
|
</FilesMatch>
|
|
<FilesMatch \.css\.gz$>
|
|
ForceType text/css
|
|
AddDefaultCharset UTF-8
|
|
AddEncoding x-gzip gz
|
|
</FilesMatch>
|
|
<FilesMatch \.js\.gz$>
|
|
ForceType text/javascript
|
|
AddDefaultCharset UTF-8
|
|
AddEncoding x-gzip gz
|
|
</FilesMatch>
|
|
<FilesMatch \.ttf\.gz$>
|
|
ForceType application/x-font-ttf
|
|
AddEncoding x-gzip gz
|
|
</FilesMatch>
|
|
<FilesMatch \.svg\.gz$>
|
|
ForceType image/svg+xml
|
|
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>
|
|
|
|
<% @readmes.each do |pattern, helpfile| -%>
|
|
<Directory <%= @docroot %><%= pattern %>>
|
|
ReadmeName <%= helpfile %>
|
|
</Directory>
|
|
<% end -%>
|
|
|
|
RewriteEngine On
|
|
<% if @ara_middleware -%>
|
|
<Directory "/usr/local/bin">
|
|
<Files "ara-wsgi-sqlite">
|
|
Allow from all
|
|
Satisfy Any
|
|
</Files>
|
|
</Directory>
|
|
# Redirect .*/<%= @ara_middleware_database_directory %> to the ARA sqlite wsgi middleware
|
|
# This middleware automatically loads the ARA web application with the
|
|
# database located at .*/<%= @ara_middleware_database_directory %>/ansible.sqlite.
|
|
SetEnv ARA_WSGI_TMPDIR_MAX_AGE <%= @ara_middleware_tmpdir_max_age %>
|
|
SetEnv ARA_WSGI_LOG_ROOT <%= @docroot %>
|
|
SetEnv ARA_WSGI_DATABASE_DIRECTORY <%= @ara_middleware_database_directory %>
|
|
|
|
WSGIScriptAliasMatch ^.*/<%= @ara_middleware_database_directory %> /usr/local/bin/ara-wsgi-sqlite
|
|
|
|
# Everything beyond this point is rewritten to htmlify.
|
|
# Make sure we don't do that for dynamic ARA reports.
|
|
RewriteCond %{REQUEST_URI} ^.*/<%= @ara_middleware_database_directory %> [NC]
|
|
RewriteRule .* - [L]
|
|
<% end -%>
|
|
|
|
# If the specified file does not exist, look if there is a gzipped version
|
|
# If there is, serve that one instead
|
|
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
|
|
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.gz -f
|
|
RewriteRule ^/(.*)$ %{REQUEST_URI}.gz
|
|
|
|
# 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>
|