A dedicated CDN is not very practical, however here's how I can break this down.
There are the following types of resources:
Landing page. Pretty much the only "static" resource that is required to be served at 7jam.io itself.
Truly static resources. Room art images, samples, sfx, scripts, ... These can really be hosted anywhere at all.
App-managed resources. Uploaded graffiti falls into this category. You can't just willy-nilly serve it from anywhere because the application manages this content.
First idea was to make everything fully static by default, and just move the performance-critical websocket to some other server. But that's probably way more complex than just moving static resources to a different URL.
So here's the plan:
[x] serve landing pages from express. But I need to dynamically generate them, injecting some global javascript variables to specify the various new host prefixes.
[x] serve the identical material from nginx. fortunately there's already a path for this.
[x] continue serving static material as-is, for things like favicon et al
[x] use explicit URLs for everything, constructed from the new host prefixes.
[x] SFX
[x] Graffiti
[x] Samples (json + samples)
[x] Room art
[x] reverb impulses (radio + normal)
[x] metronome.mp3
And then i found https://www.jsdelivr.com/, which will ease the load for the static file loading. Only trick will be to request the correct version. Need to calculate the current git revision.
see also: https://expressjs.com/en/advanced/best-practice-performance.html#do-logging-correctly
A dedicated CDN is not very practical, however here's how I can break this down.
There are the following types of resources:
First idea was to make everything fully static by default, and just move the performance-critical websocket to some other server. But that's probably way more complex than just moving static resources to a different URL.
So here's the plan:
favicon
et alAnd then i found https://www.jsdelivr.com/, which will ease the load for the static file loading. Only trick will be to request the correct version. Need to calculate the current git revision.