It is worthy to mention deployment script modifications for VERSION.txt in the documentation
As many would use ember-cli-deploy, VERSION.txt should go in separate step, e.g.
// ./config/deploy.js
let ENV = {
pipeline: {
alias: {
s3: { as: ['s3-version', 's3'] },
},
's3-version': {
bucket: '***',
region: '**',
filePattern: 'VERSION.txt',
cacheControl: 'max-age=0, no-cache',
expires: 1525781737
},
...
},
It is good idea to have the same bucket as index file.
I made these changes in my config/deploy.js to make it work well with the version file:
cloudfront: {
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET,
distribution: process.env.AWS_CLOUDFRONT_DISTRIBUTION,
objectPaths: ["/index.html", "/VERSION.txt*"],
},
gzip: {
ignorePattern: "VERSION.txt",
},
manifest: {
fileIgnorePattern: "VERSION.txt",
},
I think a section in the readme specific to ember-cli-deploy would be pretty useful since that's the most common deployment setup. Can probably include a short paragraph to explain what needs to be done in general for other solutions too.
Given https://github.com/sethwebster/ember-cli-new-version/blob/master/addon/components/new-version-notifier/component.js#L62 I don't think you need to worry about specific cache policies. They are going to be ignored anyway.
I'm not sure about the reason to not gzip either. Maybe something in your specific setup?
Mainly just curious as I just added this and I want to make sure I didn't miss anything in my deployment.
I stumbled on this as well.
To get this to work, i needed to include:
manifest: {
fileIgnorePattern: "VERSION.txt",
}
Without that, the VERSION.txt file is ignored when it comes time to upload to s3.
In addition, my CloudFront distro was caching the VERSION.txt even with the cache busting query param which is appended to the request.
In CloudFront I created a Behavior for that file to override the TTL.
None of that was hard, but it took some time to figure out. +1 for including some discussion in the docs.
@averydev I'm open to a section in the readme about deployment. Could you submit a PR for cloudfront/s3?