Skip to content
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:

brew install postgres

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

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 -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
\password postgres

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


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

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`

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`

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

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

0 comments on commit ab0b373

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