Support updated REST and HTML layout

The previous layout meant we couldn't really do apache offloading of
static content and instead were proxying them to the aiohttp server.

The new update moves api calls below /api. Update the rewrite rules to
deal with this. Also, update the document root to point to where we
deploy the zuul dashboard so that it's picked up by apache.

This also updates the apache config to work for non-whitelabeled deploys
as well.

Depends-On: https://review.openstack.org/556967
Change-Id: I6e662e7bc97de96969828801bcb18c5f354965c5
This commit is contained in:
Monty Taylor 2018-03-27 09:45:28 -05:00
parent fa66845b5b
commit b94e292457
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 19 additions and 12 deletions

View File

@ -105,9 +105,9 @@ class zuul::web (
# can query it easily should the need arise.
# If the status.json is unavailable for download, no new files are created.
if $ssl_cert_file_contents != '' {
$status = "https://${vhost_name}/status"
$status = "https://${vhost_name}/api/status"
} else {
$status = "http://${vhost_name}/status"
$status = "http://${vhost_name}/api/status"
}
cron { 'zuul_scheduler_status_backup':
user => 'root',
@ -178,11 +178,7 @@ class zuul::web (
}
$web_url = "http://${web_listen_address}:${web_listen_port}"
if ($tenant_name) {
$zuul_web_full_url = "${web_url}/${tenant_name}"
} else {
$zuul_web_full_url = $web_url
}
$websocket_url = "ws://${web_listen_address}:${web_listen_port}"
$zuul_web_root = '/opt/zuul-web'
$zuul_web_content_root = '/opt/zuul-web/content'
$zuul_web_src_root = '/opt/zuul-web/source'

View File

@ -39,16 +39,27 @@
RewriteRule ^/status - [F]
<% end -%>
RewriteRule ^/console-stream <%= @zuul_web_full_url.sub('http://', 'ws://') %>/console-stream [P]
RewriteRule ^/(.*)$ <%= @zuul_web_full_url %>/$1 [P]
RewriteRule ^/$ <%= @zuul_web_full_url %>/status.html [P]
<% if @tenant_name != '' -%>
RewriteRule ^/$ /status.html [L]
# Backwards compat for old status urls. Should be removed in a few weeks.
RewriteRule ^/status$ <%= @web_url %>/api/tenant/<%= @tenant_name %>/status [P]
RewriteRule ^/api/connection/(.*)$ <%= @web_url %>/api/connection/$1 [P]
RewriteRule ^/api/console-stream <%= @websocket_url %>/api/tenant/<%= @tenant_name %>/console-stream [P]
RewriteRule ^/api/(.*)$ <%= @web_url %>/api/tenant/<%= @tenant_name %>/$1 [P]
<% else -%>
RewriteRule ^/$ /tenants.html [L]
RewriteRule ^/t/(.*) /$1 [L]
RewriteRule ^/api/tenant/(.*)/console-stream <%= @websocket_url %>/api/tenant/$1/console-stream [P]
RewriteRule ^/api/(.*)$ <%= @web_url %>/api/$1 [P]
<% end -%>
AddOutputFilterByType DEFLATE application/json
<IfModule mod_cache.c>
CacheDefaultExpire 5
<IfModule mod_mem_cache.c>
CacheEnable mem /status
# TODO: Should we cache the rest of the API too?
CacheEnable mem /api/status
# 12MByte total cache size.
MCacheSize 12288
MCacheMaxObjectCount 10
@ -58,7 +69,7 @@
MCacheMaxStreamingBuffer 8388608
</IfModule>
<IfModule mod_cache_disk.c>
CacheEnable disk /status
CacheEnable disk /api/status
CacheRoot /var/cache/apache2/mod_cache_disk
</IfModule>
</IfModule>