bitovi / velocirender

Accelerated server-side rendering.
https://bitovi.github.io/velocirender/
MIT License
128 stars 5 forks source link

Asset Caching #15

Open matthewp opened 5 years ago

matthewp commented 5 years ago

Currently when rendering a remote address incremental will download and serve static assets from a cache. The cache lasts until the next time the server restarts. In this way it's still better than having to deploy to a server every time; here you only have to restart the server.

Ideally we could do better though. A few options:

This issue is to begin discussing how we can improve asset caching when rendering from remote URLs.

BigAB commented 5 years ago

It's a web server right?

What if we had it expose a configurable, secure API endpoint that when hit could do the whole "refresh the cache" thing, so that if my static deployment workflow had a webhook option, I could trigger the SSR service to rebuild the cache with it?

matthewp commented 5 years ago

Yeah that's a good idea too

justinbmeyer commented 5 years ago

Wouldn’t the endpoint just be hitting the server after a restart?

BigAB commented 5 years ago

We're talking about not having to restart the server. Just change the static assets and then tell the server to update it's cache

justinbmeyer commented 5 years ago

Is that a common need? Generally on a deploy, I will re-install and restart everything. The node process itself doesn’t take long to restart.

justinbmeyer commented 5 years ago

I guess if you are really trying to maximize uptime, it might be nice to never take down the process...

matthewp commented 5 years ago

It's a common feature for web servers to be reloadable without restarting the process. With Apache it is apache2 reload. On Nginx it is nginx -s reload.

The difference here is that @BigAB is suggesting exposing that as an API endpoint so that you can avoid having to deploy anything to the web server at all. How to do that securely I'm not sure though...