enable stale cache usage for all scenarios

pull/105/head
Hisham 2021-08-04 16:37:39 +10:00
parent 47af7fa5d8
commit 44bdc7a089
5 changed files with 6 additions and 9 deletions

View File

@ -43,7 +43,6 @@ VOLUME /ca
# Add our configuration # Add our configuration
ADD nginx.conf /etc/nginx/nginx.conf ADD nginx.conf /etc/nginx/nginx.conf
ADD nginx.manifest.common.conf /etc/nginx/nginx.manifest.common.conf ADD nginx.manifest.common.conf /etc/nginx/nginx.manifest.common.conf
ADD nginx.manifest.stale.conf /etc/nginx/nginx.manifest.stale.conf
# Add our very hackish entrypoint and ca-building scripts, make them executable # Add our very hackish entrypoint and ca-building scripts, make them executable
ADD entrypoint.sh /entrypoint.sh ADD entrypoint.sh /entrypoint.sh

View File

@ -119,7 +119,7 @@ echo -n "" >/etc/nginx/nginx.manifest.caching.config.conf
location ~ ^/v2/(.*)/manifests/${MANIFEST_CACHE_PRIMARY_REGEX} { location ~ ^/v2/(.*)/manifests/${MANIFEST_CACHE_PRIMARY_REGEX} {
set \$docker_proxy_request_type "manifest-primary"; set \$docker_proxy_request_type "manifest-primary";
proxy_cache_valid ${MANIFEST_CACHE_PRIMARY_TIME}; proxy_cache_valid ${MANIFEST_CACHE_PRIMARY_TIME};
include "/etc/nginx/nginx.manifest.stale.conf"; include "/etc/nginx/nginx.manifest.common.conf";
} }
EOD EOD
@ -128,7 +128,7 @@ EOD
location ~ ^/v2/(.*)/manifests/${MANIFEST_CACHE_SECONDARY_REGEX} { location ~ ^/v2/(.*)/manifests/${MANIFEST_CACHE_SECONDARY_REGEX} {
set \$docker_proxy_request_type "manifest-secondary"; set \$docker_proxy_request_type "manifest-secondary";
proxy_cache_valid ${MANIFEST_CACHE_SECONDARY_TIME}; proxy_cache_valid ${MANIFEST_CACHE_SECONDARY_TIME};
include "/etc/nginx/nginx.manifest.stale.conf"; include "/etc/nginx/nginx.manifest.common.conf";
} }
EOD EOD
@ -137,7 +137,7 @@ EOD
location ~ ^/v2/(.*)/manifests/ { location ~ ^/v2/(.*)/manifests/ {
set \$docker_proxy_request_type "manifest-default"; set \$docker_proxy_request_type "manifest-default";
proxy_cache_valid ${MANIFEST_CACHE_DEFAULT_TIME}; proxy_cache_valid ${MANIFEST_CACHE_DEFAULT_TIME};
include "/etc/nginx/nginx.manifest.stale.conf"; include "/etc/nginx/nginx.manifest.common.conf";
} }
EOD EOD
@ -146,7 +146,7 @@ EOD
location ~ ^/v2/(.*)/manifests/ { location ~ ^/v2/(.*)/manifests/ {
set \$docker_proxy_request_type "manifest-default-disabled"; set \$docker_proxy_request_type "manifest-default-disabled";
proxy_cache_valid 0s; proxy_cache_valid 0s;
include "/etc/nginx/nginx.manifest.stale.conf"; include "/etc/nginx/nginx.manifest.common.conf";
} }
EOD EOD

View File

@ -282,7 +282,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
location ~ ^/v2/(.*)/blobs/ { location ~ ^/v2/(.*)/blobs/ {
set $docker_proxy_request_type "blob-mutable"; set $docker_proxy_request_type "blob-mutable";
proxy_cache_valid 0s; proxy_cache_valid 0s;
include "/etc/nginx/nginx.manifest.stale.conf"; include "/etc/nginx/nginx.manifest.common.conf";
} }
location @handle_redirects { location @handle_redirects {

View File

@ -4,5 +4,6 @@
proxy_pass https://$targetHost; proxy_pass https://$targetHost;
proxy_cache cache; proxy_cache cache;
proxy_cache_key $uri; proxy_cache_key $uri;
proxy_cache_use_stale error timeout http_500 http_502 http_504 http_429;
proxy_intercept_errors on; proxy_intercept_errors on;
error_page 301 302 307 = @handle_redirects; error_page 301 302 307 = @handle_redirects;

View File

@ -1,3 +0,0 @@
# Just like the common block, but adds proxy_cache_use_stale
include "/etc/nginx/nginx.manifest.common.conf";
proxy_cache_use_stale error timeout http_500 http_502 http_504 http_429;