disable nginx cache when skyd cache is enabled

This commit is contained in:
Karol Wypchlo 2022-02-10 14:50:36 +01:00
parent ed20ed5e24
commit b827616fab
No known key found for this signature in database
GPG Key ID: B515DE9EEBE241E1
3 changed files with 11 additions and 2 deletions

View File

@ -29,7 +29,6 @@ services:
- SKYD_DISK_CACHE_SIZE=${SKYD_DISK_CACHE_SIZE:-53690000000} # 50GB - SKYD_DISK_CACHE_SIZE=${SKYD_DISK_CACHE_SIZE:-53690000000} # 50GB
- SKYD_DISK_CACHE_MIN_HITS=${SKYD_DISK_CACHE_MIN_HITS:-3} - SKYD_DISK_CACHE_MIN_HITS=${SKYD_DISK_CACHE_MIN_HITS:-3}
- SKYD_DISK_CACHE_HIT_PERIOD=${SKYD_DISK_CACHE_HIT_PERIOD:-3600} # 1h - SKYD_DISK_CACHE_HIT_PERIOD=${SKYD_DISK_CACHE_HIT_PERIOD:-3600} # 1h
env_file: env_file:
- .env - .env
volumes: volumes:
@ -65,6 +64,8 @@ services:
logging: *default-logging logging: *default-logging
env_file: env_file:
- .env - .env
environment:
- SKYD_DISK_CACHE_ENABLED=${SKYD_DISK_CACHE_ENABLED:-false}
volumes: volumes:
- ./docker/data/nginx/cache:/data/nginx/cache - ./docker/data/nginx/cache:/data/nginx/cache
- ./docker/data/nginx/blocker:/data/nginx/blocker - ./docker/data/nginx/blocker:/data/nginx/blocker

View File

@ -11,4 +11,11 @@ proxy_cache_bypass $cookie_nocache $arg_nocache;
# no cache - this will ignore cache on request (status MISS) # no cache - this will ignore cache on request (status MISS)
# and does not store file in cache under no condition # and does not store file in cache under no condition
set_if_empty $nocache "0"; 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;

View File

@ -31,6 +31,7 @@ env SKYNET_SERVER_API;
env PORTAL_MODULES; env PORTAL_MODULES;
env ACCOUNTS_LIMIT_ACCESS; env ACCOUNTS_LIMIT_ACCESS;
env SIA_API_PASSWORD; env SIA_API_PASSWORD;
env SKYD_DISK_CACHE_ENABLED;
events { events {
worker_connections 8192; worker_connections 8192;