I have a problem that I’m hoping others here have a solution to.
When I deploy my app (rolling), users will eventually hit a new server that says to serve “asset-2.js”. The request is then sent to the backend, but lands on an old server. The old server only has “asset-1.js”, so it 404s the request.
Ideally, I would like the user to always receive an asset if any server has it.
What I’ve Done
I thought maybe [[statics]] would help here. I am sure that it’s properly setup because I see the fly cache-hit information on the response. That would never come from my app, so I assume it’s the static server.
When I do the deploy, though, I still receive the 404. It’s almost like the static is not available until after the app server is live.
If it’s possible that I didn’t setup statics properly, I would love to understand how I can check that. The guest_path
reflects a real path available in my container.
Different Ideas
In the past, I solved this problems on a Rails app by publishing all assets to S3 on deploy. Then, I had a CDN in front of the bucket that pulled from S3. Because the assets were pushed before deploy, there is a 100% success rate. But, it’s quite a few moving parts and I’d like a simpler solution if possible.