diff --git a/docker-compose.yml b/docker-compose.yml index e63df946..f511eec5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,6 @@ services: - SKYD_DISK_CACHE_SIZE=${SKYD_DISK_CACHE_SIZE:-53690000000} # 50GB - SKYD_DISK_CACHE_MIN_HITS=${SKYD_DISK_CACHE_MIN_HITS:-3} - SKYD_DISK_CACHE_HIT_PERIOD=${SKYD_DISK_CACHE_HIT_PERIOD:-3600} # 1h - env_file: - .env volumes: @@ -65,6 +64,8 @@ services: logging: *default-logging env_file: - .env + environment: + - SKYD_DISK_CACHE_ENABLED=${SKYD_DISK_CACHE_ENABLED:-false} volumes: - ./docker/data/nginx/cache:/data/nginx/cache - ./docker/data/nginx/blocker:/data/nginx/blocker diff --git a/docker/nginx/conf.d/include/proxy-cache-downloads b/docker/nginx/conf.d/include/proxy-cache-downloads index 8481ebb9..c7405857 100644 --- a/docker/nginx/conf.d/include/proxy-cache-downloads +++ b/docker/nginx/conf.d/include/proxy-cache-downloads @@ -11,4 +11,11 @@ proxy_cache_bypass $cookie_nocache $arg_nocache; # no cache - this will ignore cache on request (status MISS) # and does not store file in cache under no condition set_if_empty $nocache "0"; -proxy_no_cache $nocache; + +# map skyd env variable value to "1" for true and "0" for false (expected by proxy_no_cache) +set_by_lua_block $skyd_disk_cache_enabled { + return os.getenv("SKYD_DISK_CACHE_ENABLED") == "true" and "1" or "0" +} + +# disable cache when nocache is set or skyd cache is enabled +proxy_no_cache $nocache $skyd_disk_cache_enabled; diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index eb5494c9..5d7e5944 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -31,6 +31,7 @@ env SKYNET_SERVER_API; env PORTAL_MODULES; env ACCOUNTS_LIMIT_ACCESS; env SIA_API_PASSWORD; +env SKYD_DISK_CACHE_ENABLED; events { worker_connections 8192;