Uploading rails project to web using Git, Bitbucket and Heroku


Tutorial Title: Uploading rails project to web using Github and Heroku

Course: Web Engineering

Instructor: Muhammad Samim


Note: Copy and paste commands in terminal after dollar sign ($)




1. Installing gedit plugins
  • Press Ctrl + Alt + t to open terminal
  • $ sudo apt-get install gedit-plugins
2. Making some changes in gedit to make it more programmers friendly
  • Type gedit in terminal
  • Maximize gedit
  • Click on "Edit"
  • After clicking on "Edit" click on "Preferences"
  • Check "Display line number"
  • Check "Display right margin at column and set it 80
  • Check "Highlight current line"
  • Check "Highlight matching brackets"
  • Click on "Editor tab"
  • Set Tab width: 2 spaces
  • Check "Enable automatic indentation"
  • Click on "Plugins tab"
  • Check "Bracket Completion"
  • Check "Embeded Terminal"
  • Check "File Browser Panel"
  • Check "Multi Edit"
  • Check "Code Comment"
  • Check "Find in Files"
3. Installing Git
  • $ sudo apt-get update
  • $ sudo apt-get install git-core
4. Configuring git (You should have account of github if you don't have then visit https://github.com/ and make an account)
  • git config --global user.name "YOUR USER NAME"
  • git config --global user.email "YOUREMAIL"
     6. go to your project folder > Right click > Open terminal and make sure that your home page is made by you to be displayed on the first screen on heroku if not then follow the steps.
    • rails generate controller Welcome index
    • go to your app directory/app/config/routes
    • now add root 'welcome#index' and save
    • now go to your app directory app/view/welcome/index.html.erb
    • and replace code with
    • <h1> Uploading project on Heroku </h1>
    • and save it
      7. Adding rails project to git ( You must be in project directory)
      • $ git init
      8. Adding all file and changes to git
      • $ git add .
      9. Committing changes files to server
      • $ git commit -m 'initial commit'
      10. Uploading rails project to github.com
      • Go to link https://github.com/
      • Sign in
      • Click on sign + right up 
      • Click on "New repository"
      • Type Repository name
      • Click on "Create"
      • Click on Create repository
      11. Type the following commands (You must be in rails project directory)
      • $ git remote add origin http://github.com/yourUserName/YouRepository.git
      • $ git push -u origin master
      •    Type your user name of github
      •    Type your password 
      •    Enter
      12. Application has been uploaded to GitHub now.
            To check the changes and updates
      • $ git status
      • $ git add -A
      • $ git push origin master
      13. Adding and uploading rails project to Heroku

      14. Add gem file in Gemfile of your project
      • app directory/app/Gemfile
      • copy and paste the following gemfile in the end of line.
      • gem 'rails_12factor', group: :production
      • open your terminal and type $ bundle install
      • Check your ruby version by typing command $ ruby -v
      • your version on terminal after command must be like  ruby 2.3.1 you need to type it like ruby "2.3.1" in your Gemfile of your project
         and save
      15. Deploying your project on Heroku
      16. To use Heroku commands we will install toolbelt. Open your terminal and type the command
      • $ wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
      17. Login your heruko account by your terminal
      • $ heroku login
      • Enter your email
      • Enter your password
      • $ heroku create
      •  
      18. Verifying if remote was added to your project
      • $ git config --list | grep heroku
      19. Deploying the project
      • $ git push heroku master
      20. Migrating your database from your computer to Heroku server
      •  $ heroku run rake db:migrate
      21. Confirming if one dyno is run the web process (Optional)
      • $ heroku ps:scale web=1
      • $ heroku ps
      22. Opening uploaded project online on Heroku
      • $ open heroku
       

      SHARE

      Muhammad Samim

      • Image
      • Image
      • Image
      • Image
      • Image
        Blogger Comment
        Facebook Comment

      0 comments:

      Post a Comment