Browse Source

Remove the upstream pypi reverse proxy

Trying to reverse proxy upstream pypi has not turned out to
be very stable, or very useful. We've had many, many reports
of stability issues and the additional complexity for offline
and proxy usage is just not worth it.

Given we already have a mechanism in place to handle using
upstream pypi if the repo server is not there yet, disabling
this should just result in that mechanism kicking in and all
will be well again.

Once the repo is built, the reverse proxy to pypiserver will
then be exclusively used and the upstream pypi proxy is not
necessary anyway.

Depends-On: https://review.openstack.org/584393
Change-Id: Ie407c6a346de6b46c8f4d30caea8664a7f6bd341
changes/85/584385/3
Jesse Pretorius 11 months ago
parent
commit
dab934bdb9

+ 0
- 9
defaults/main.yml View File

@@ -99,12 +99,3 @@ repo_pypiserver_start_options: >-
99 99
 # config override var for systemd init file
100 100
 repo_pypiserver_init_overrides: {}
101 101
 
102
-# nginx host:port for pypi reverse proxy
103
-repo_nginx_pypi_upstream: "pypi.python.org:443"
104
-
105
-# Set the options for the nginx proxy_cache_path directive.
106
-# The proxy cache is used for data downloaded from pypi.
107
-# The default is set to cache up to 1G worth of packages
108
-# for up to 1 month
109
-repo_nginx_proxy_cache_path: >-
110
-  /var/lib/nginx/pypi levels=1:2 keys_zone=pypi:16m inactive=1M max_size=1G

+ 10
- 0
releasenotes/notes/pypi-cache-removed-c03a9a0658c9d89f.yaml View File

@@ -0,0 +1,10 @@
1
+---
2
+deprecations:
3
+  - |
4
+    The repo server's reverse proxy for pypi has now been removed,
5
+    leaving only the pypiserver to serve packages already on the
6
+    repo server. The attempt to reverse proxy upstream pypi turned
7
+    out to be very unstable with increased complexity for deployers
8
+    using proxies or offline installs. With this, the variables
9
+    ``repo_nginx_pypi_upstream`` and ``repo_nginx_proxy_cache_path``
10
+    have also been removed.

+ 0
- 7
templates/nginx-pypi.conf.j2 View File

@@ -1,12 +1,5 @@
1 1
 # {{ ansible_managed }}
2 2
 
3
-proxy_cache_path {{ repo_nginx_proxy_cache_path }};
4
-
5 3
 upstream pypiserver {
6 4
     server localhost:{{ repo_pypiserver_port }};
7 5
 }
8
-
9
-upstream pypi {
10
-    server {{ repo_nginx_pypi_upstream }};
11
-    keepalive 16;
12
-}

+ 6
- 38
templates/openstack-slushee.vhost.j2 View File

@@ -6,50 +6,18 @@ server {
6 6
     access_log /var/log/nginx/{{ repo_server_name }}.access.log gzip buffer=32k;
7 7
     error_log /var/log/nginx/{{ repo_server_name }}.error.log notice;
8 8
 
9
-    # Allow cached content to be used even when the upstream source is not available.
10
-    proxy_cache pypi;
11
-    proxy_cache_key $uri;
12
-    proxy_cache_lock on;
13
-    proxy_cache_revalidate on;
14
-    proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
15
-
16
-    proxy_http_version 1.1;
17
-    proxy_set_header Host $host:$server_port;
18
-    proxy_set_header Connection "";
19
-    proxy_set_header Accept-Encoding "";
20
-
21
-    # Rewrite any http redirects to use relative to proxy
22
-    proxy_redirect ~https?://pypi.python.org(.*) $1;
23
-
24
-    # Fallback mechanism from:
25
-    # http://linuxplayer.org/2013/06/nginx-try-files-on-multiple-named-location-or-server
26
-    location @pypi {
27
-        proxy_set_header Host pypi.python.org;
28
-        {% if repo_nginx_pypi_upstream | match('.*:443$') %}
29
-        proxy_pass https://pypi;
30
-        {% else %}
31
-        proxy_pass http://pypi;
32
-        {% endif %}
33
-    }
34
-
35 9
     location /simple {
36
-        proxy_intercept_errors on;
10
+        proxy_set_header  Host $host:$server_port;
11
+        proxy_set_header  X-Forwarded-Proto $scheme;
12
+        proxy_set_header  X-Real-IP $remote_addr;
37 13
         proxy_pass http://pypiserver;
38
-        error_page 404 = @pypi;
39 14
     }
40 15
 
41 16
     location /packages {
42
-        proxy_intercept_errors on;
17
+        proxy_set_header  Host $host:$server_port;
18
+        proxy_set_header  X-Forwarded-Proto $scheme;
19
+        proxy_set_header  X-Real-IP $remote_addr;
43 20
         proxy_pass http://pypiserver;
44
-        error_page 404 = @pypi;
45
-    }
46
-
47
-    location /+f {
48
-        {% if repo_nginx_pypi_upstream | match('.*:443$') %}
49
-        proxy_pass https://pypi;
50
-        {% else %}
51
-        proxy_pass http://pypi;
52
-        {% endif %}
53 21
     }
54 22
 
55 23
     location / {

Loading…
Cancel
Save