Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Invalidating Cloudfront Cache #34

Open
iMerica opened this issue Jul 19, 2018 · 3 comments
Open

Invalidating Cloudfront Cache #34

iMerica opened this issue Jul 19, 2018 · 3 comments

Comments

@iMerica
Copy link

iMerica commented Jul 19, 2018

Hi,

Thanks for building this - really liking it so far!

I've set up Scotty to continually deploy on every git commit using Gitlab. The command is executing successfully, but my assets are never fresh :-(.

Can you point me in the right direction? Is there a built-in solution to this problem, or should I write my own solution using S3 client libraries?

Thanks in advance,

Michael

@stojanovic
Copy link
Owner

Hey, it's not doing that at all in version 1 :(
That's one of the things v2 will do, but I don't have enough time to finish it. In the meantime, I can share my script for deployment with cache invalidation, in case it helps. It's a smaller version of scotty and it's not a nice CLI command, just a node.js script.

@ghost
Copy link

ghost commented Nov 21, 2018

@stojanovic Hi, I am interested in that script, can you please share it? Thanks!

@tomekand1
Copy link

here is a fix for scotty on windows, as I dig in to code, to get scotty working on my machine,
Some of that problems occur because outdated packages, and changes in es7

  1. install NCU "npm i npm-check-updates -g" it has to be global install
  2. Go to C: drive, then select "View" => Options => new window will open, select "View" again and select "Show hidden files, folders and drivers.
  3. Open that path in your terminal "C:\Users\username\AppData\Roaming\npm\node_modules\scottyjs"
  4. Run command ncu in your terminal that will check for newest dependencies for scotty.
  5. Run ncu -u <= to update packages, then run "npm install"
  6. Open scotty in VS code, go to "lib/upload-file.js"
  7. On line 23 change ContentType: mime.lookup(fileName),to ContentType: mime.getType (fileName), also in //create-bucket.js, delete-bucket.js, delete-object.js, empty-bucket.js, set-aswebsite.js, set-expiration-dats.js, upload-file.js, upload.js// move this line of code "const s3 = new AWS.S3()" inside function, then inside set-cd.js move "const cloudFront = new AWS.CloudFront()" inside "function setCdn()"
  8. Next step is just for aesthetic reasons, but I thing is worth, as it is nice to have a clean code in spec/support/jasmine-runner.js change first line to /* global jasmine */  this will avoid EsLint errors.
  9. Now u can add " -- profile dev/test/prod " to your build command in projects package.jason
    Enjoy fixed Scotty.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants