From 8aab93a4d647e19b7ef2932f95911d99f11e9398 Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Wed, 29 Apr 2020 17:12:27 -0700
Subject: [PATCH] Cache static zuul resources in apache

We are running zuul-web out of a container now which is forcing all http
requests through to cherrypy (eg we no longer serve static resources
from apache directly). Alleviate some of the pressure on cherrypy by
caching static resources in apache.

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

diff --git a/playbooks/roles/zuul-web/templates/openstack.vhost.j2 b/playbooks/roles/zuul-web/templates/openstack.vhost.j2
index bb4b6039a6..328d1a38cb 100644
--- a/playbooks/roles/zuul-web/templates/openstack.vhost.j2
+++ b/playbooks/roles/zuul-web/templates/openstack.vhost.j2
@@ -55,8 +55,9 @@
     <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 /static/.*
+      # 80MB max cache size. 10 objects at 8MB max each.
+      MCacheSize 81920
       MCacheMaxObjectCount 10
       MCacheMinObjectSize 1
       # 8MByte max size per cache entry
@@ -65,6 +66,7 @@
     </IfModule>
     <IfModule mod_cache_disk.c>
       CacheEnable disk /api/status
+      CacheEnable disk /static/.*
       CacheRoot /var/cache/apache2/mod_cache_disk
       CacheMaxFileSize 10000000
     </IfModule>
diff --git a/playbooks/roles/zuul-web/templates/zuul.vhost.j2 b/playbooks/roles/zuul-web/templates/zuul.vhost.j2
index 8d142b8ef8..a633022127 100644
--- a/playbooks/roles/zuul-web/templates/zuul.vhost.j2
+++ b/playbooks/roles/zuul-web/templates/zuul.vhost.j2
@@ -53,6 +53,7 @@
     <IfModule mod_mem_cache.c>
       # TODO: Should we cache the rest of the API too?
       CacheEnable mem /api/tenant/.*/status
+      CacheEnable mem /static/.*
       # 80MB max cache size. 10 objects at 8MB max each.
       MCacheSize 81920
       MCacheMaxObjectCount 10
@@ -63,6 +64,7 @@
     </IfModule>
     <IfModule mod_cache_disk.c>
       CacheEnable disk /api/tenant/.*/status
+      CacheEnable disk /static/.*
       CacheRoot /var/cache/apache2/mod_cache_disk
       CacheMaxFileSize 10000000
     </IfModule>