0

I have a Rails 4 app running on the Ceder Stack of Heroku. I use conditional responses based on etag. I have an initialization script which changes the etag value so that each new release requires browser to renew cache:

# creates new seed for creation of etag in header
ENV["RAILS_CACHE_ID"] = Time.now.to_s 

This works fine in staging, but in production I am using multiple dynos and they can end up with different values.

Is there a variable I can use that will be unique for each release but identical across all dynos? The git version number perhaps? Thanks in advance for any insights.

laertiades
  • 1,992
  • 2
  • 19
  • 26
  • Would something like this work: http://stackoverflow.com/a/14899264/1807403 – Jonathan Bender Feb 23 '14 at 20:55
  • @JonathanBender- Thanks for response. I tried that and got: 2014-02-23T19:35:16.670333+00:00 app[web.1]: fatal: Not a git repository (or any of the parent directories): .git I looked for a way to reference the git binary directly but didn't come up with anything. Am I correct in assuming that any command in backticks is the same as when I enter it using: heroku run console? – laertiades Feb 23 '14 at 21:02
  • 1
    That would have been my assumption as well, though I've never done it. Another solution might be this: http://stackoverflow.com/a/14924922/1807403, which seems to be a little more heroku-specific. – Jonathan Bender Feb 23 '14 at 21:12

0 Answers0