Deploy an existing rails 3.2 app to heroku
Assume that your project directory is
~/my_project. Using MySQL And manage you code with git. You want to deploying it to heroku and keeping working locally with MySQL. This is my solution:
Download and install heroku toolbelt.
After installed, you should got
heroku command in CLI now.
cd to your project directory:
Set up heroku app
Login to heroku with email and password:
You might be asked to generate SSH publich key at first time login
Create and rename an heroku app
heroku create heroku rename MY_PROJECT
Heroku provide 3 ways to use asset pipeline. I currently use “compiling assets locally”. It’s simple but less automatically.
Make sure your had set production environmnet correctly in local. Or you may encounter problems on running
rake … RAILS_ENV=production.
rake db:create RAILS_ENV=production RAILS_ENV=production bundle exec rake assets:precompile git add . git commit -m "precompile assets"
To keep local working with MySQL. I opened a branch for heroku depolyment called
git branch heroku git checkout heroku
Now run bundle install
Last, deploy to heroku
git push heroku heroku:master
If you are pushing local
masterbranch to heroku than you should use
git push heroku master
I like to keep heroku-related modifications to
heroku branch. So merge frequently:
# modifications don on master... git checkout heroku git merge master --no-ff git push heroku heroku:master