django-compressor / django-compressor

Compresses linked and inline javascript or CSS into a single cached file.
https://django-compressor.readthedocs.io
Other
2.8k stars 600 forks source link

Multiple versions of compressed assets in a single manifesto file for zero downtime deploys #755

Open mitchelljkotler opened 8 years ago

mitchelljkotler commented 8 years ago

I run my offline compression on a CI build server, then push the assets and manifest to S3. The time between pushing to S3 and deploying the new code will throw offline generation errors, as the old assets are now gone from manifest.json. I would like a way to run compress on my build server, have it create a manifest.json with both the new and old (preferably just the current as to not get a giant manifest file), and upload that to S3. The current code will continue to work, as will the new code as soon as it deploys.

diox commented 8 years ago

Depending on how you deploy, you can change COMPRESS_OFFLINE_MANIFEST each time you deploy to alleviate this - old code would then use the old manifest.

thisjustin commented 7 years ago

@diox we tried this (setting COMPRESS_OFFLINE_MANIFEST = "manifest_<hash>.json" where the hash was something we generated once on deploy and stored in django settings) and it still didn't work - when compress ran it was still picking up the new manifest and of course the files weren't there because we upload static files to s3 and collectstatic runs after compress. Unless I'm missing something I think that workaround would only work if static files were all local.