2

I'd like to use heroku_san to deploy multiple environments to heroku. I'm using dragonfly for image handling and S3 for storage. Usually you can add your key and secret for the storage using heroku config:add S3_KEY=… S3_SECRET=… directly.

So I've added these details to the heroku.yml file used by heroku_san:

staging:
  app: app-staging
  config: &default
    BUNDLE_WITHOUT: "development:test"
    S3_KEY: XXXXXXXXXXXXXXXXXX 
    S3_SECRET: XXXXXXXXXXXXXXXXXX
    S3_BUCKET: app-staging

but when deploying I'm still getting:

rake aborted!
ENV variable 'S3_KEY' needs to be set - use
    heroku config:add S3_KEY=XXXXXXXXX

What am I missing here? Is there a better way then storing this information in a YML file?

JoshDM
  • 4,939
  • 7
  • 43
  • 72
polarblau
  • 17,649
  • 7
  • 63
  • 84

3 Answers3

2

There's no need to run heroku config:add manually. Just run heroku_san's config task:

$ rake all heroku:config

Repeat this whenever you update the heroku.yml file.

I was confused about this too, since it's strangely absent from heroku_san's documentation, but the option does appear in the list of rake tasks:

$ rake -T

and in the heroku_san code: https://github.com/fastestforward/heroku_san/blob/master/lib/heroku_san/tasks.rb

jhiro009
  • 576
  • 4
  • 13
1

A simple solution/work-around:

heroku config:add S3_KEY=XXX S3_SECRET=XXX --app app-staging

Any better ideas?

polarblau
  • 17,649
  • 7
  • 63
  • 84
0

I think you need to run the command rake all heroku:rack_env. This command will then set the environment configurations for you based on your heroku_san YAML configuration.

Jessie Dedecker
  • 6,719
  • 1
  • 17
  • 12
  • Looks promising. Gotta give that a try. Cheers! – polarblau Jul 15 '11 at 10:08
  • Thanks. Will you let me know if it works/didn't work for you? Cheers! – Jessie Dedecker Jul 21 '11 at 06:53
  • Sure thing. Might take a bit, though. – polarblau Jul 21 '11 at 07:02
  • heroku:rack_env only sets the RACK_ENV environment variable. – jhiro009 Aug 17 '11 at 00:56
  • @jhiro009 According to their [documentation](http://devcenter.heroku.com/articles/config-vars#rack_env_and_rails_env), "... On the Aspen and Bamboo stacks, RAILS_ENV will automatically mirror whatever is in RACK_ENV." – ezkl Aug 26 '11 at 23:51
  • True: if you only need to set RAILS_ENV, and you're using the right stack, heroku:rack_env will get the job done. But my point was that it won't set everything in heroku.yml. I'd rather keep my configuration data in one file, only need one command (heroku:config), and not have to change my approach for a new stack (i.e. cedar). – jhiro009 Aug 27 '11 at 09:33