From f1723017d61be3adf853cc2848060ffcbc158617 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 17 Jul 2018 09:31:56 -0500 Subject: [PATCH] Add proxy cache for PyPI Investigate using apache proxy caching for PyPI instead of a full mirror. Make the /pypi path proxy directly to pypi.org upstream instead of to the rackspace AFS mirror. We have to use the substitute module (already enabled) to rewrite the embedded links in the html content returned, because instead of relative links to something under /pypi which get redirected, the CDN links are direct. Change-Id: Id68ff2914ba7fb588092cff113e8d1536f7d5a56 --- .../openstack_project/templates/mirror.vhost.erb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/openstack_project/templates/mirror.vhost.erb b/modules/openstack_project/templates/mirror.vhost.erb index ad30639b66..2f12837c9e 100644 --- a/modules/openstack_project/templates/mirror.vhost.erb +++ b/modules/openstack_project/templates/mirror.vhost.erb @@ -163,8 +163,19 @@ LogFormat "%h %l %u %t \"%r\" %>s %b %{cache-status}e \"%{Referer}i\" \"%{User-a # pypi CacheEnable disk "/pypi" - ProxyPass "/pypi/" "http://mirror.dfw.rax.openstack.org/pypi/" ttl=120 keepalive=On retry=0 - ProxyPassReverse "/pypi/" "http://mirror.dfw.rax.openstack.org/pypi/" + ProxyPass "/pypi/" "https://pypi.org/" ttl=120 keepalive=On retry=0 + ProxyPassReverse "/pypi/" "https://pypi.org/ + + # files.pythonhosted.org + CacheEnable disk "/pypifiles" + ProxyPass "/pypifiles/" "https://files.pythonhosted.org/" ttl=120 keepalive=On retry=0 + ProxyPassReverse "/pypifiles/" "https://files.pythonhosted.org/" + + # Rewrite the locations of the actual files + + SetOutputFilter SUBSTITUTE + Substitute "s|https://files.pythonhosted.org/|/pypifiles/|ni" + # images.linuxcontainers.org CacheEnable disk "/images.linuxcontainers" @@ -225,6 +236,7 @@ LogFormat "%h %l %u %t \"%r\" %>s %b %{cache-status}e \"%{Referer}i\" \"%{User-a CacheEnable disk "/alpine" ProxyPass "/alpine/" "http://dl-cdn.alpinelinux.org/alpine/" ttl=120 keepalive=On retry=0 ProxyPassReverse "/alpine/" "http://dl-cdn.alpinelinux.org/alpine/ + :8081>