discourse/discourse — pull request #417 by nverba (2013-03-11 12:27:31+00:00)
Title: Basic Heroku integration

I've made some modifications to allow for a completely generic Heroku deploy and included a basic Heroku deploy doc.

The main changes are:

Modifying the way the redis.yml is called to allow parsing with ERB which is pretty common in Heroku.

Modified connection_management.rb to take into account Heroku creates its own database.yml file which does not include :host_names. If :host_names are not present it defaults to :host.

def self.current_hostname
config = ActiveRecord::Base.connection_pool.spec.config
config[:host_names].nil? ? config[:host] : config[:host_names].first
end

Included the redis password conditionally, only if it is defined in the redis.yml file, as suggested by @eviltrout

Included the scheduler.rake tasks file from @swrobel, as this has no impact on regular deployment and allows for Heroku users to easily implement the Heroku Scheduler instead of using a separate clock process.

@swrobel has done some great work implementing further optimisations to reduce costs to almost nothing https://github.com/swrobel/discourse-heroku. If this commit gets merged I'd suggest writing an advanced Heroku deployment section in the doc, detailing some of his techniques.

This commit should have no impact on current users, and does not require any changes to be made.

If we could find a way of incorporating the Sidekiq autoscaler into the main code base without affecting non Heroku users, this would be a great boost to the basic Heroku deployement. Reducing the monthly cost to a little over $10. Do you think this would be possible?