Skip to content
Permalink
Browse files

added deploy rake task

added deploy and CI instructions to docs
  • Loading branch information...
croaky committed Oct 15, 2010
1 parent 0fe29ab commit ab0b37339ebb8361a4ac77723af4a0f5f2b3dbd9
Showing with 63 additions and 5 deletions.
  1. +28 −5 doc/README_FOR_APP
  2. +35 −0 lib/tasks/deploy.rake
@@ -16,14 +16,37 @@ Dependencies

Gems are managed by Bundler. Database is Postgres to match Heroku.

If you're on a Mac, install Postgres with Homebrew:
Mac:

brew install postgres

Then, go into System Preferences > Accounts and
create a new "postgres" user with password "postgres"
Ubuntu:

We don't set a username or password in development or test environments. Instead, create postgres database role (user) with the same handle as your unix username. To create the postgres user, try (your password will be prompted):
sudo apt-get install postgres

sudo -u postgres createuser --no-superuser --createdb --no-createrole --login --pwprompt --encrypted -h 127.0.0.1 -p 5432 $YOUR_UNIX_USERNAME$
This should install a postgres/postgres UNIX account.
Then, make sure the postgres/postgres user is set up for the database server.

su - postgres
psql
\password postgres

Our config/database.yml uses these postgres/postgres credentials.

Deploy
------

Deploy to Heroku, rake db:migrate, and notify Hoptoad of deploy:

rake deploy

Deploys to staging by default. When ready for production:

rake deploy:production

Continuous Integration
----------------------

http://ci.reliefhub.railsmachina.com

Commits to origin master (Github) will notify CI of the build.
@@ -0,0 +1,35 @@
require 'rake'

task :deploy => "deploy:staging"

namespace :deploy do
desc "Deploy to heroku staging"
task :staging => "heroku:dependencies" do
`git push heroku master --force`
`heroku rake db:migrate`
`heroku rake hoptoad:deploy TO=staging`
end

desc "Deploy to heroku production"
task :production => "heroku:dependencies" do
`git push production master --force`
`heroku rake db:migrate --remote production`
`heroku rake hoptoad:deploy TO=production --remote production`
end
end

namespace :heroku do
task :dependencies do
`heroku`
unless $?.success?
puts "Heroku gem is not installed. Try: sudo gem install heroku"
exit 1
end

`cd #{Rails.root} && ls .git/config`
unless $?.success?
puts "This doesn't appear to be a git repo. Try: git init"
exit 1
end
end
end

0 comments on commit ab0b373

Please sign in to comment.
You can’t perform that action at this time.