Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for staging environment #19

Open
gauravgupta123 opened this issue May 19, 2011 · 4 comments
Open

No support for staging environment #19

gauravgupta123 opened this issue May 19, 2011 · 4 comments

Comments

@gauravgupta123
Copy link
Contributor

A single assets.yml stores the configuration keys for the plugin, irrespective of the environment. This creates problems when the app is deployed to a staging environment, since it causes files to be replaced in the same S3 bucket used by the production environment.

Infact, I would like to turn Cloudfront off on staging and get the files from my own server, or directly from S3 (without the CDN layer)

@dhiemstra
Copy link

+1 we can't use jammit-s3 right now because we have a heroku staging, heroku testing and heroku development server.

@miloops
Copy link
Contributor

miloops commented Oct 4, 2011

I workaround this by doing this:

s3_bucket: <%= "bucket_#{ENV['STAGE']}" %>

then

$ STAGE=staging bundle exec jammit-s3

@iltempo
Copy link

iltempo commented Dec 13, 2011

Actually Jammit itself can handle multiple stage settings: https://github.com/documentcloud/jammit/blob/master/lib/jammit.rb#L74

Simply wrap stage specific settings using stage name in assets.yml:

embed_assets: off
compress_assets: on

production:
  s3_bucket: production-assets
  s3_access_key_id: PRODUCTION KEY
  s3_secret_access_key: SecretProductionAccessKey

staging:
  s3_bucket: staging-assets
  s3_access_key_id: STAGING KEY
  s3_secret_access_key: SecretStagingAccessKey

...

Don't forget to set the environment when calling Jammit S3

$ RAILS_ENV=staging bundle exec jammit-s3

Hope that helps.

@Xeus
Copy link

Xeus commented Jan 15, 2014

That definitely did help me. I was trying to use a separate assets_staging.yml file and it wasn't working out for me -- but these namespaces did the trick. Thanks @iltempo.

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

No branches or pull requests

5 participants