AssetSync / asset_sync

Synchronises Assets between Rails and S3
1.88k stars 346 forks source link

Invalidation #13

Closed Florian95 closed 13 years ago

Florian95 commented 13 years ago

Add the possibility of using invalidation, to update the CDN on CloudFront

Announce : http://aws.amazon.com/fr/about-aws/whats-new/2010/08/31/cloudfront-adds-invalidation-feature/

davidjrice commented 13 years ago

Hey @Florian95 what's your use case? Are you using assets that are referenced with the digest path? then assets will be automatically referencing the new versions with no invalidation required when you deploy a new version of your app.

Am guessing however that the assets you want to invalidate are nondigest versions of your assets?

How would you want this to work?

Florian95 commented 13 years ago

Hello,

I use : config.existing_remote_files = "delete" And when I run : $ heroku run rake assets:precompile

Its doesn't update my CSS for example. And when I delete manually, I want to force invalidation to refresh the cache of CDN, by an ARG passed for example...

Regards,

davidjrice commented 13 years ago

I wouldn't advise running delete in production. It's good to have those old versions around between releases.

It doesn't update your CSS ? are you sure about that ? can you check the S3 bucket itself.

I would check out your rails Production.rb and ensure the following are set...

# Generate digests for assets URLs
config.assets.digest = true

config.assets.precompile += %w( master.css )
davidjrice commented 13 years ago

@Florian95 did you have a chance to check this out

Does using config.assets.digest fix the issue for you?

There should be no cache invalidation required with using a digest as every time the file is updated, the digest is different and therefore the file is uploaded with a different name.

Florian95 commented 13 years ago

Hello,

Its work with config.assets.digest.

Thank you,

davidjrice commented 13 years ago

Saweet. No worries!

freerobby commented 12 years ago

@davidjrice I was wondering if you'd consider reopening this for a different use case.

As part of our Rails app, we deploy javascript and CSS assets whose paths cannot change because they are embedded by third parties to power widgets. Right now, we have to manually expire those files on the CDN so that they get requeried from the origin. It would be great if this functionality became integrated with asset_sync to automate that step on files where no digest can be used.