Put staging stable registry behind varnish and redirect to external registry

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2017-01-14 18:27:57 +00:00
parent 34530570e5
commit a7d6b0052f
3 changed files with 19 additions and 0 deletions

View file

@ -550,6 +550,13 @@
website: registry.fedoraproject.org
destname: registry
proxyurl: http://localhost:10048
when: env == "production"
- role: httpd/reverseproxy
website: registry.fedoraproject.org
destname: registry
proxyurl: "{{ varnish_url }}"
when: env == "staging"
- role: httpd/reverseproxy
website: candidate-registry.fedoraproject.org

View file

@ -3,6 +3,10 @@ RequestHeader set X-Scheme https early
RequestHeader set X-Forwarded-Proto https early
ProxyPreserveHost On
{% if env == "staging" %}
RewriteRule ^/v2/([a-zA-Z]*)/blobs/([a-zA-Z]*) https://ourregistry/v2/$1/blobs/$2 [R]
{% endif %}
ProxyPass {{ localpath }} {{ proxyurl }}{{remotepath}}
ProxyPassReverse {{ localpath }} {{ proxyurl }}{{remotepath}}

View file

@ -140,6 +140,11 @@ backend koschei {
.port = "10040";
}
backend registry {
.host = "localhost";
.port = "10048";
}
acl purge {
"192.168.1.129"; // wiki01.vpn
@ -186,6 +191,9 @@ sub vcl_recv {
return(purge);
}
if (req.http.X-Forwarded-Server ~ "^registry.fedoraproject.org" || req.http.X-Forwarded-Server ~ "^registry.stg.fedoraproject.org") {
set req.backend_hint = registry;
}
if (req.url ~ "^/wiki/") {
set req.backend_hint = wiki;
}