Deploy A Rails App
Step 1: Use git
Type this in the terminal:git initExpected result:Initialized empty Git repository in c:/Sites/railsbridge/test_app/.git/Type this in the terminal:git add -AType this in the terminal:git commit -m "initial commit"Expected result:a lot of lines like create mode 100644 GemfileType this in the terminal:git logExpected result:(Your git name and "initial commit" message.)
Step 2: Deploy your app to Heroku
Step 2.1: Create a Heroku application from this local Rails application.Type this in the terminal:heroku createExpected result:Enter your Heroku credentials. Email: email@example.com Password: Uploading ssh public key /Users/smei/.ssh/id_rsa.pub Creating floating-winter-18... done, stack is cedar http://floating-winter-18.heroku.com/ | firstname.lastname@example.org:floating-winter-18.git Git remote heroku addedType this in the terminal:git remote showExpected result:heroku
Step 2.2: Prepare your rails app for deploying to Herokugem 'sqlite3'group :development, :test do gem 'sqlite3' end group :production do gem 'pg' endType this in the terminal:gem install bundlerApproximate expected result:Successfully installed bundler-1.14.3 1 gem installedThe greyed-out text may differ and is not important.Type this in the terminal:bundle install --without production
Step 2.3: Set the root routeRails.application.routes.draw doroot 'drinks#index'
Step 2.4: Add the changes to gitType this in the terminal:git add .Type this in the terminal:git commit -m "Updates for heroku deployment"
Step 2.5: Deploy (push) to herokuType this in the terminal:git push heroku masterExpected result:The authenticity of host 'heroku.com (188.8.131.52)' can't be established. RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'heroku.com,184.108.40.206' (RSA) to the list of known hosts. Counting objects: 60, done. Compressing objects: 100% (54/54), done. Writing objects: 100% (60/60), 79.03 KiB, done. Total 60 (delta 10), reused 0 (delta 0) -----> Heroku receiving push -----> Rails app detected Compiled slug size is 080K -----> Launching...... done App deployed to Heroku To email@example.com:floating-winter-18.git * [new branch] master -> masterType this in the terminal:heroku run rails db:migrateExpected result:Migrating to CreateDrinks (20160706063236) == 20160706063236 CreateDrinks: migrating ===================================== -- create_table(:drinks) -> 0.0084s == 20160706063236 CreateDrinks: migrated (0.0085s) ============================
Step 2.6: Visit your new application