Created
August 19, 2011 17:33
-
-
Save typeoneerror/1157423 to your computer and use it in GitHub Desktop.
spinning up heroku servers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :heroku do | |
desc "Create a Heroku app and install the necessary addons" | |
task :bootstrap, [:app, :domain] => [:create, :install_addons] do |t, args| | |
APP = args[:app] | |
DOMAIN = args[:domain] | |
puts "= Bootstrapping Heroku application #{APP}" | |
Rake::Task['heroku:create'].invoke(APP) | |
Rake::Task['heroku:install_addons'].invoke(APP, DOMAIN) | |
puts "= Finished building stack for #{APP}" | |
puts `heroku open --app #{APP}` | |
end | |
desc "Create a server instance and configure it for the app" | |
task :create, [:app] do |t, args| | |
APP = args[:app] | |
puts "= Creating Heroku application: heroku create #{APP}" | |
puts `heroku create #{APP}` | |
end | |
desc "Install Heroku Addons for the given app" | |
task :install_addons, [:app, :domain] do |t, args| | |
APP = args[:app] | |
puts "= Installing addons for Heroku application #{APP}" | |
puts `heroku addons:add amazon_rds --app #{APP}` | |
if args[:domain].present? | |
DOMAIN = args[:domain] | |
puts "= Installing custom domains" | |
puts `heroku addons:add custom_domains:basic --app #{APP}` | |
puts "= Configuring custom domains" | |
puts `heroku domains:add #{DOMAIN}.com --app #{APP}` | |
puts `heroku domains:add www.#{DOMAIN}.com --app #{APP}` | |
end | |
puts "= Installing custom hooks" | |
puts `heroku addons:add deployhooks:email \ | |
[email protected] \ | |
subject="#{APP} Deployed" \ | |
body="{{user}} deployed app" --app #{APP}` | |
puts "= Installing memcached" | |
puts `heroku addons:add memcache:5mb --app #{APP}` | |
puts "= Installing SSL piggyback" | |
puts `heroku addons:add ssl:piggyback --app #{APP}` | |
puts "= Finished addon installations for #{APP}" | |
puts `heroku apps:info --app #{APP}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment