I’ve been thinking of trying to conserve memory-heavy unicorn instances by configuring my external nginx (which I already have for serving 502 maintenance page and for correctly attributing IPv6 addresses) to also serve requests for images; with the intent of getting much of the value of moving them to S3 (or compatible object service) but still keeping the site self-contained on my server. (This wouldn’t move other site assets off of unicorns, but those are cached well from page to page, so that’s a much smaller overall cost in unicorns.)
Just like pointing external nginx at a socket in /var/discourse/shared I would serve
I don’t see mention here on meta that anyone has done this, though my search foo might be weak. Am I missing any reasons this would not work, or would work poorly in practice?
Oh. At least now the next person with this bright idea might find it when they search for it. Many thanks!
If you want to help your unicorns, one thing that actually helps is Enable a CDN for your Discourse, as it will cache the few assets that are served on unicorns like the stylesheets.
… well, I see the internal nginx is also already using
proxy_cache with a 7d validity for non-error requests:
# note x-accel-redirect can not be used with proxy_cache
proxy_cache_valid 200 301 302 7d;
proxy_cache_valid any 1m;
How does a CDN help with unicorns in that case? I see
stylesheets in that list.