$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
$ heroku login
Enter your Heroku credentials.
Email: example@example.com
Password:
If not show below words, we need add keys to heroku.
Could not find an existing public key.
Would you like to generate one? [Yn]
Generating new SSH public key.
Uploading ssh public key /Users/adam/.ssh/id_rsa.pub
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/adam/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
$ heroku keys:add
Found existing public key: /Users/adam/.ssh/id_rsa.pub
Uploading SSH public key /Users/adam/.ssh/id_rsa.pub... done
$ sudo apt-get install postgresql-9.1
$ sudo apt-get install postgresql-server-dev-9.1
$ sudo su
$ su postgres
$ createuser
# Gemfile
group :production do
gem 'rails_12factor', group: :production
gem 'pg'
end
ruby "2.1.1" # for rails 4
[config/database.yml] remove “username: myapp”
# branch 'deploy' is only for heroku
$ git checkout -b deploy
$ heroku create app_name --addons heroku-postgresql
Creating sleepy-cliffs-1680... done, stack is cedar
http://sleepy-cliffs-1680.herokuapp.com/ | git@heroku.com:sleepy-cliffs-1680.git
Git remote heroku added
$ export RAILS_ENV=production
$ rake db:drop db:setup
$ rake assets:precompile
$ git commit -m 'deploy for heroku'
$ git push heroku deploy:master
# ensure we have one dyno
$ heroku ps:scale web=1
# check the state of the app’s dynos
$ heroku ps
=== web (1X): `bin/rails server -p $PORT -e $RAILS_ENV`
web.1: starting 2014/02/27 14:52:25 (~ 2m ago)
# visit the app in our browser
$ heroku open
Opening sleepy-cliffs-1680... done
$ git checkout deploy
$ git merge master
$ git push heroku deploy:master
$ heroku run rake db:migrate
https://devcenter.heroku.com/articles/getting-started-with-rails4#local-workstation-setup
https://github.com/19wu/19wu/wiki/%E9%83%A8%E7%BD%B2%E5%88%B0-heroku#toc-rails4