From 6bc23598d3d3a77651fac08ec0d3da42fecd0891 Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Mon, 27 Apr 2020 14:27:34 -0700
Subject: [PATCH] Improve zuul-web apache config

Compress css and javascript content as they can be quite large for zuul.

Also, cache status json results when using the non whitelabeled api
paths for zuul.opendev.org. This should improve performance for those
status files.

Change-Id: I7b965b27a88d5fda4d43be31c39989994334989c
---
 playbooks/roles/zuul-web/templates/openstack.vhost.j2 |  2 +-
 playbooks/roles/zuul-web/templates/zuul.vhost.j2      | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/playbooks/roles/zuul-web/templates/openstack.vhost.j2 b/playbooks/roles/zuul-web/templates/openstack.vhost.j2
index b3dba4ea8d..bb4b6039a6 100644
--- a/playbooks/roles/zuul-web/templates/openstack.vhost.j2
+++ b/playbooks/roles/zuul-web/templates/openstack.vhost.j2
@@ -48,7 +48,7 @@
   RewriteRule ^/api/(.*)$ http://127.0.0.1:9000/api/tenant/openstack/$1 [P,L]
   RewriteRule ^/(.*)$ http://127.0.0.1:9000/$1 [P,L]
 
-  AddOutputFilterByType DEFLATE application/json
+  AddOutputFilterByType DEFLATE application/json text/css text/javascript application/javascript
 
   <IfModule mod_cache.c>
     CacheDefaultExpire 5
diff --git a/playbooks/roles/zuul-web/templates/zuul.vhost.j2 b/playbooks/roles/zuul-web/templates/zuul.vhost.j2
index 60a9512b6e..8d142b8ef8 100644
--- a/playbooks/roles/zuul-web/templates/zuul.vhost.j2
+++ b/playbooks/roles/zuul-web/templates/zuul.vhost.j2
@@ -46,15 +46,15 @@
   RewriteRule ^/api/tenant/(.*)/console-stream ws://127.0.0.1:9000/api/tenant/$1/console-stream [P,L]
   RewriteRule ^/(.*)$ http://127.0.0.1:9000/$1 [P,L]
 
-  AddOutputFilterByType DEFLATE application/json
+  AddOutputFilterByType DEFLATE application/json text/css text/javascript application/javascript
 
   <IfModule mod_cache.c>
     CacheDefaultExpire 5
     <IfModule mod_mem_cache.c>
       # TODO: Should we cache the rest of the API too?
-      CacheEnable mem /api/status
-      # 12MByte total cache size.
-      MCacheSize 12288
+      CacheEnable mem /api/tenant/.*/status
+      # 80MB max cache size. 10 objects at 8MB max each.
+      MCacheSize 81920
       MCacheMaxObjectCount 10
       MCacheMinObjectSize 1
       # 8MByte max size per cache entry
@@ -62,7 +62,7 @@
       MCacheMaxStreamingBuffer 8388608
     </IfModule>
     <IfModule mod_cache_disk.c>
-      CacheEnable disk /api/status
+      CacheEnable disk /api/tenant/.*/status
       CacheRoot /var/cache/apache2/mod_cache_disk
       CacheMaxFileSize 10000000
     </IfModule>