diff --git a/playbooks/roles/ptgbot/tasks/main.yaml b/playbooks/roles/ptgbot/tasks/main.yaml index f17be21188..27a21dcbbd 100644 --- a/playbooks/roles/ptgbot/tasks/main.yaml +++ b/playbooks/roles/ptgbot/tasks/main.yaml @@ -63,6 +63,9 @@ state: present name: "{{ item }}" loop: + - cache + - cache_disk + - cache_socache - rewrite - proxy - proxy_http @@ -70,6 +73,14 @@ - headers - proxy_wstunnel +- name: Ensure apache cache dir + file: + state: directory + path: '/var/cache/apache2/proxy' + owner: root + group: root + mode: 0755 + - name: Copy apache config template: src: ptgbot.vhost.config.j2 diff --git a/playbooks/roles/ptgbot/templates/ptgbot.vhost.config.j2 b/playbooks/roles/ptgbot/templates/ptgbot.vhost.config.j2 index ed20d2376d..1cb17e4e5b 100644 --- a/playbooks/roles/ptgbot/templates/ptgbot.vhost.config.j2 +++ b/playbooks/roles/ptgbot/templates/ptgbot.vhost.config.j2 @@ -42,6 +42,18 @@ SSLCertificateKeyFile /etc/letsencrypt-certs/ptg.opendev.org/ptg.opendev.org.key SSLCertificateChainFile /etc/letsencrypt-certs/ptg.opendev.org/ca.cer + # Enable SHM backend + CacheSocache shmcb + # disk fallback + CacheRoot "/var/cache/apache2/proxy" + # required to match on rewrites + CacheQuickHandler off + # don't pass requests to backend + CacheIgnoreCacheControl On + + CacheEnable socache / + CacheEnable disk / + ProxyPass / http://localhost:8000/ retry=0 ProxyPassReverse / http://localhost:8000/