mozilla-services / screenshots

Firefox Screenshots: the best way to take screenshots on the web.
https://screenshots.firefox.com
Mozilla Public License 2.0
620 stars 128 forks source link

Old code is cached on deployment #4203

Closed ianb closed 6 years ago

ianb commented 6 years ago

On our last deploy, references to the new code (with the ?rev=... cachebust) still served up old code, until the CDN was flushed (which I think just means an nginx restart). That shouldn't happen!

/cc @oremj

oremj commented 6 years ago

This is happening, because there is a brief period of time where both versions are attached to the ELB. Nginx is configured to make a request to the site origin and cache that response: https://github.com/mozilla-services/cloudops-deployment/blob/master/projects/screenshots/puppet/modules/screenshots/templates/http_screenshots.conf.erb#L103

To fix temporarily, I could change site_origin to localhost and it would alleviate the problem, but the issue would return once we move over to Cloudfront.

Would it work to just flush the cache after each deploy, as part of the deploy pipeline? That way there would only be a minute or so where both versions of the code are being served.

ghost commented 6 years ago

@oremj I think that would work. Let's do it!

oremj commented 6 years ago

Opened an issue in our deployment repo to address this.

ghost commented 6 years ago

ok thanks. please let us know when it is closed