Fork me on GitHub
#boot
<
2018-03-24
>
vikeri08:03:17

@dominicm thanks, I'm serving site from s3 though, through cloud front. So I can't really work with the server settings. So I was more thinking of appending a timestamp to the file or something like that.

juhoteperi08:03:01

@vikeri I think s3/cloudfront handles last-modified timestampts by default

juhoteperi08:03:01

But cloudfront is usually configured to cache quite aggressively. E.g. confetti uses Cloudfront invalidation API to remove the files from cloudfront cache so they get loaded from S3.

juhoteperi08:03:43

Timestamps don't help if cloudfront won't even check if the timestamp is changed in s3.

juhoteperi08:03:48

Cloudfront default cache TTL is 24 hours.

vikeri08:03:36

@juhoteperi ok! Yeah true. I really like the concept of confetti but I'd like to manage our infrastructure in terraform. So maybe I'll just add a call to the AWS CLI that invalidates the cache.

martinklepsch06:03:15

I’m also slowly moving towards a mindset of handling resource creation with terraform and turning Confetti into a “bootstrapping tool” for a terraform setup and utilities for syncing. (I think sync-bucket and the underlying s3-deploy library are pretty good.)

martinklepsch06:03:38

Haven’t gotten around implementing that yet though 😄

juhoteperi08:03:41

Best approach would be to invalidate html files when they change, and use content addressable uris for JS and other resources. And then update the html to point to new JS file each time.

juhoteperi08:03:08

Currently I use invalidation for all files as I haven't had time to configure content addressable uris for static resources.

juhoteperi08:03:51

It is also possible to configure Cloudfront cache TTL to 0 sec, and then it would ask S3 for each request if the file has changed, but obviously that isn't very optimal

juhoteperi08:03:16

@vikeri Btw. I don't really use confetti much, only the sync-bucket task, I created the s3/cloudfront from aws console and then just configured the keys.

vikeri08:03:42

@juhoteperi Ok, yeah I still like to use the cache. I'll look into content addressable uris.