March 01, 2015

Home » » » How To Deploy Rails Application On Heroku

How To Deploy Rails Application On Heroku

Posted by Unknown
0

Create a new web application

# rails new hello_app

Create an account on github if you don't have.

https://github.com

Create new project on github

https://github.com

signin and create a project.

Modified and upload your project on github.

Modified gem file look like this

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0.rc1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

group :development, :test do
  gem 'mysql2'
  gem 'web-console'
  gem 'spring'
end

group :test do
  gem 'minitest-reporters'
  gem 'mini_backtrace'
  gem 'guard-minitest'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

gem 'mocha', group: :test

Then run command

# cd hello_app
# bundle install --without production (Important !)

Running on localhost

# cd hello_app
# rails s
Open browser: http://localhost:3000 or http://:3000 If you don't have any code, only have config gemfile. Web application appear:

Upload project origin to github

# cd hello_app
# git init
# git remote add origin git@bitbucket.org:<username>/hello_app.git
# git add -A
or 
# git add 
# git commit -m "First commit, Initialize project."
# git push origin master
or 
# git push -u origin --all

Create a new brand

# git checkout master
# git checkout -b new-brand
Then, update code to new-brand.

Upload new-brand to github

# bundle install --without production
# git add -A
# git commit -m "Add new-brand"
# git push origin new-brand

Push web application to heroku

Create an account on heroku if you don't have

https://heroku.com

Login and create remote link, push app

# heroku login
# heroku create
# git push heroku master

Add other remote link

# git remote -v
# heroku git:remote -a <heroku appname>
Push new-brand on heroku
# git push heroku new-brand:master
Open web application
# heroku open

May you can!

# git push heroku master -f
# git push heroku new-brand:master -f





0 comments:

Post a Comment

Popular Posts

Labels

Archive

 

Blogroll

Recepies

Flickr Images

Copyright © 2014. Tutorials Blog - All Rights Reserved