Amazon S3 & Transmit - cdig/docs GitHub Wiki
Versioning
Every time you update something on S3 (using Transmit), you will need to append and increment a version number like this: my-quizzer-image.1.png
, my-quizzer-image.2.png
, and so forth for each new revision you publish.
- Always use a
.
as the separator. - Always use a number for the version.
- After you upload a new version and switch all references to it, you should delete the old version.
- Things in
/short-lived/
do not need to be versioned. That folder is only cached for 10 minutes (thus, short-lived). - You can burn through a lot of numbers if you're doing a lot of versions — that's fine.
- Existing assets are fine without version numbers, but all future assets going up to S3 should adopt this pattern.
- If you accidentally forget to update the version number, and just replace the existing file, you'll just see the old file until the server-side cache expires (up to 1 year later).
Motivation
All our stuff in S3 is aggressively cached, both in users' browsers and on content delivery servers around the world. So when you update something, we need to somehow tell all those caches to use the new thing rather than the old thing.
We could tell everything "Hey, this file has changed, dump your cache" — but that is super complex and it costs money every time we do it.
The best approach is to just treat each new version as an entirely new asset, by giving it a new file name. SVGA and cd-module do this for you when you run cdig deploy
. Rails does it for me when I deploy the site. But Transmit doesn't do this automatically — so, we'll just have to do it ourselves.