Commit 8c275634d86a8b391b8687f8e7f0666b1650ef81

Authored by Nick Recobra
2 parents 391a1271 4cbc2436
Exists in master and in 1 other branch production

Merge branch 'master' of https://github.com/drewblas/errbit into drewblas-master

Conflicts:
	db/seeds.rb
README.md
... ... @@ -67,6 +67,29 @@ for you. Checkout [Hoptoad](http://hoptoadapp.com) from the guys over at
67 67  
68 68 cap deploy:setup deploy
69 69  
  70 +**Deploying to Heroku:**
  71 +
  72 + 1. Clone the repository
  73 +
  74 + git clone http://github.com/jdpace/errbit.git
  75 +
  76 + 2. Create & configure for Heroku
  77 +
  78 + gem install heroku
  79 + heroku create
  80 + heroku addons:add mongohq:free
  81 + heroku addons:add sendgrid:free
  82 + heroku config:add HEROKU=true
  83 + heroku config:add ERRBIT_HOST=some-hostname.example.com
  84 + heroku config:add ERRBIT_EMAIL_FROM=example@example.com
  85 + git push heroku master
  86 +
  87 + 3. Seed the DB (_NOTE_: No bootstrap task is used on Heroku!)
  88 +
  89 + heroku rake db:seed
  90 +
  91 + 4. Enjoy!
  92 +
70 93 TODO
71 94 ----
72 95  
... ...
config/initializers/_load_config.rb
1 1 require 'ostruct'
2 2  
3   -yaml = File.read(Rails.root.join('config','config.yml'))
4   -config = YAML.load(yaml)
  3 +if ENV['HEROKU']
  4 + Errbit::Config = OpenStruct.new
  5 + Errbit::Config.host = ENV['ERRBIT_HOST']
  6 + Errbit::Config.email_from = ENV['ERRBIT_EMAIL_FROM']
  7 + Errbit::Config.email_at_notices = [1,3,10] #ENV['ERRBIT_EMAIL_AT_NOTICES']
  8 +else
  9 + yaml = File.read(Rails.root.join('config','config.yml'))
  10 + config = YAML.load(yaml)
5 11  
6   -config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env)
  12 + config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env)
7 13  
8   -Errbit::Config = OpenStruct.new(config)
  14 + Errbit::Config = OpenStruct.new(config)
  15 +end
9 16  
10 17 # Set config specific values
11 18 ActionMailer::Base.default_url_options[:host] = Errbit::Config.host
12 19 \ No newline at end of file
... ...
config/initializers/mongo.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +if ENV['MONGOHQ_URL']
  2 + settings = URI.parse(ENV['MONGOHQ_URL'] || 'mongodb://localhost/sushi')
  3 + database_name = settings.path.gsub(/^\//, '')
  4 +
  5 + Mongoid.configure do |config|
  6 + config.master = Mongo::Connection.new(settings.host, settings.port).db(database_name)
  7 + config.master.authenticate(settings.user, settings.password) if settings.user
  8 + end
  9 +end
0 10 \ No newline at end of file
... ...
db/seeds.rb
... ... @@ -14,8 +14,8 @@ user = User.where(:email => admin_email).first || User.new({
14 14 :name => 'Errbit Admin',
15 15 :email => admin_email,
16 16 :password => admin_pass,
17   - :password_confirmation => admin_pass,
  17 + :password_confirmation => admin_pass
18 18 })
19 19  
20 20 user.admin = true
21   -user.save!
22 21 \ No newline at end of file
  22 +user.save!
... ...