From b107426201126ff0d8ef64e45672cc13262f3dd4 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Thu, 21 Jan 2016 10:57:12 -0800 Subject: [PATCH] Added wheel hosting for AFS mirror slave This patch adds a vhost that exposes /afs/openstack.org/mirror/wheel to the internet under /wheel. It also adds appropriate rewrite rules. Change-Id: Id514a76f7759b663b2ea3a3ec4aa2dfe083d6666 --- modules/openstack_project/manifests/mirror.pp | 13 +++++++++++++ .../openstack_project/templates/mirror.vhost.erb | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/modules/openstack_project/manifests/mirror.pp b/modules/openstack_project/manifests/mirror.pp index b83b1c14f0..9f714958ad 100644 --- a/modules/openstack_project/manifests/mirror.pp +++ b/modules/openstack_project/manifests/mirror.pp @@ -6,6 +6,8 @@ class openstack_project::mirror ( $mirror_root = '/afs/.openstack.org/mirror' $pypi_root = "${mirror_root}/pypi" + $wheel_root = "${mirror_root}/wheel" + $www_base = '/var/www' $www_root = "${www_base}/mirror" @@ -37,6 +39,17 @@ class openstack_project::mirror ( ] } + # Create the symlink to wheel. + file { "${www_root}/wheel": + ensure => link, + target => "${wheel_root}", + owner => root, + group => root, + require => [ + File["${www_root}"], + ] + } + file { "${www_root}/robots.txt": ensure => present, owner => 'root', diff --git a/modules/openstack_project/templates/mirror.vhost.erb b/modules/openstack_project/templates/mirror.vhost.erb index 4604ef7fdf..f5c2117c28 100644 --- a/modules/openstack_project/templates/mirror.vhost.erb +++ b/modules/openstack_project/templates/mirror.vhost.erb @@ -34,6 +34,14 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> RewriteCond %{DOCUMENT_ROOT}/pypi/simple/$1/$1$2 -d RewriteRule ^/pypi/simple/([^/])([^/]*)(/.*)?$ /pypi/simple/$1/$1$2$3 [L] + # Wheel URL's are: + # /wheel/{distro}-{distro-version}/a/a/a-etc.whl + # /wheel/{distro}-{distro-version}/a/abcd/abcd-etc.whl + # /wheel/{distro}-{distro-version}/a/abcde/abcde-etc.whl + RewriteCond %{REQUEST_URI} ^/wheel/([^/]+)/([^/])([^/]*) + RewriteCond %{DOCUMENT_ROOT}/wheel/$1/$2/$2$3 -d + RewriteRule ^/wheel/([^/]+)/([^/])([^/]*)(/.*)?$ /wheel/$1/$2/$2$3$4 [L] + ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log LogLevel warn CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_access.log combined