-
-
Notifications
You must be signed in to change notification settings - Fork 19
Description
There's currently some parameters available to the end user to change some values, but let's go a little deeper without the management overhead.
The NGINX upstream images support this feature, could we do it here?
Rough idea
Currently encountering a scenario where I would like to tweak the NGINX configurations selectively without having to maintain a massive configuration. Just wanted to bring light to the idea that there are possible avenues to accomplish this ask.
Example implementation and justification.
Something that users might want to frequently modify is the proxy_cache_valid arguments for particular HTTP responses. Memory caching is significantly faster than disk caching, and there might be circumstances for users that assign allocations to their containers with large heap sizes.
This allows NGINX under the hood to utilize some of that extra space to return data faster, especially when your stored medium of choice might be some kind of rotational disk-based RAID.
4 GB to preload some kind of small game for a hundred people over a 10G connection? Sounds perfect.
Example NGINX specification:
# Cache all contents in memory for 10 minutes.
proxy_cache_valid 200 10m;
A user could just simply specify something like the following in their .env to take advantage of this:
# Could default to 0m for no cache.
NGINX_PROXY_CACHE_VALID_SUCCESS="200 10m"
Could be templated out using envsubst, in the same manner that the official NGINX docker image uses:
(Example server config)
server {
location / {
proxy_cache_valid $NGINX_PROXY_CACHE_VALID_SUCCESS;
}
}