diff --git a/modules/openstack_project/manifests/mirror.pp b/modules/openstack_project/manifests/mirror.pp index 88daa4df0f..867ef6df5c 100644 --- a/modules/openstack_project/manifests/mirror.pp +++ b/modules/openstack_project/manifests/mirror.pp @@ -202,6 +202,14 @@ class openstack_project::mirror ( # Build VHost include ::httpd + file { '/opt/apache_cache': + ensure => directory, + owner => 'www-data', + group => 'www-data', + mode => '0755', + require => Class['httpd'] + } + if ! defined(Httpd::Mod['rewrite']) { httpd::mod { 'rewrite': ensure => present, @@ -214,6 +222,24 @@ class openstack_project::mirror ( } } + if ! defined(Httpd::Mod['cache']) { + httpd::mod { 'cache': + ensure => present, + } + } + + if ! defined(Httpd::Mod['cache_disk']) { + httpd::mod { 'cache_disk': + ensure => present, + } + } + + if ! defined(Httpd::Mod['proxy']) { + httpd::mod { 'proxy': + ensure => present, + } + } + ::httpd::vhost { $vhost_name: port => 80, priority => '50', diff --git a/modules/openstack_project/templates/mirror.vhost.erb b/modules/openstack_project/templates/mirror.vhost.erb index 9cbed20d33..ccbd83870a 100644 --- a/modules/openstack_project/templates/mirror.vhost.erb +++ b/modules/openstack_project/templates/mirror.vhost.erb @@ -81,4 +81,23 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> LogLevel warn CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_access.log combined ServerSignature Off + + # Caching reverse proxy for things that don't make sense in AFS + # + # General cache rules + CacheRoot "/opt/apache_cache" + CacheDirLevels 5 + CacheDirLength 3 + # Prevent thundering herds. + CacheLock on + CacheLockPath "/tmp/mod_cache-lock" + CacheLockMaxAge 5 + # 100MB + CacheMaxFileSize 104857600 + + # Per site caching reverse proxy rules + # Only cache specific backends, rely on afs cache otherwise. + CacheEnable disk "/rdo" + ProxyPass "/rdo" "https://trunk.rdoproject.org/" + ProxyPassReverse "/rdo" "https://trunk.rdoproject.org/"