Rails on Heroku
I pushed bookmarks-rails project to Heroku yesterday. Thanks to tutorial i don’t have too many troblem during upload to Heroku. Some parts of doc are out of dated and here i write down the steps for reference myself in the future.
- install heroku toolbelt from heroku
- heroku doesn’t support sqllite3, modify sqllite3 to postgres sql
1 2 3 4 5 6
thin as production webserver
1 2 3
bundle install --without production
- In Rails 3.x precompile your assets file, you have to add
config/application.rb. Rails 4 ignore this.
rake assets:precompile RAILS_ENV=production
config.serve_static_assets = truein your
production.rbbecause we use rails to serve static assets
git commit -am "your commit message"because only commited source code will be pushed to heroku.
heroku create appnameto create your app on heroku. It requires you input your account,password and your ssh public key(id_rsa).
git push heroku master. You will see your app running on http://appname.herokuapp.com. Heroku will modify your production datbase connection in database.yml when push to heroku. You don’t need to put the production setting your database.yml.
heroku run rake db:migrateto create db on heroku
If you use Twitter Bootstrap, you have to comment out favicon related codes in your application.html.erb. Or you will fail to push to heroku.
1 2 3 4 5
If you modify the app name on Heroku web site, you should remove your remote branch and re-add.
1 2 3