From f27298869cae7c856ecbd7c6cfe0273978adf3a7 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 29 Mar 2017 13:42:29 -0700 Subject: [PATCH] Use caching reverse proxy for rdo repos We can't sanely mirror the rdo packages beacuse they are constantly updating. Instead put a caching reverse proxy in front of the repos in each region on our existing mirror servers. This should allow us to get region local data that is "hot" and hopefully improve reliability to the rdo repos. Change-Id: I6ab810f7b6788459da1cee00baf6b053f31843cf --- modules/openstack_project/manifests/mirror.pp | 26 +++++++++++++++++++ .../templates/mirror.vhost.erb | 19 ++++++++++++++ 2 files changed, 45 insertions(+) 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/"