Deploy to Heroku [Ruby on Rails] Beginner

Development environment: macOS Catalina / GitHub / MySQL

1. Install Heroku CLI

command

% brew tap heroku/brew && brew install heroku

Check version

% heroku --version

Installation is complete when the version is output

Official site: https://devcenter.heroku.com/articles/heroku-cli

2. Log in

% heroku login --interactive
  Email:Enter each
  password:Enter each

: information_desk_person: Login successful if the registered email address is displayed after Logged in as

3. Introduction of Gem

Gemfile * Enter at the bottom

Gemfile


group :production do
   gem 'rails_12factor'
end

: information_desk_person: Don't forget to bundle install and reboot

: information_desk_person: Commit if managed by Git

4. Create an application on Heroku

% heroku create [Application name]
% git config --list | grep heroku

: information_desk_person: At this time, if anything other than "fatal: not in a git directory" is output, the creation is complete!

5. Commands that enable you to use MySQL

% heroku addons:add cleardb
% heroku_cleardb=`heroku config:get CLEARDB_DATABASE_URL`
% heroku config:set DATABASE_URL=mysql2${heroku_cleardb:5}

: information_desk_person: URL "mysql2" changes depending on Gem usage ** After that, set environment variables to manage private values. ** **

6. Command to confirm publication

% heroku apps:info

Reference: https://devcenter.heroku.com/articles/getting-started-with-rails6

Recommended Posts

Deploy to Heroku [Ruby on Rails] Beginner
Deploy Rails on Docker to heroku
Deploy to Ruby on Rails Elastic beanstalk (EB deploy)
How to deploy on heroku
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
[Ruby On Rails] How to reset DB in Heroku
Ruby on Rails Overview (Beginner Summary)
How to deploy jQuery on Rails
How to use Ruby on Rails
How to deploy Bootstrap on Rails
Deploy your Rails app on Heroku
Deploy to Ruby on Rails Elastic beanstalk (IAM permission change)
[Ruby on Rails] How to use CarrierWave
Deploy to heroku with Docker (Rails 6, MySQL)
Preparing to introduce jQuery to Ruby on Rails
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] How to use kaminari
[Ruby on Rails] Button to return to top
Steps to deploy to Heroku
Deploy RAILS on EC2
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
[Ruby on Rails] How to display error messages
How to add / remove Ruby on Rails columns
Introducing New Relic to Rails apps on Heroku
[Rails MySQL] How to reset DB on heroku
[Ruby on Rails] How to install Bootstrap in Rails
[Ruby on Rails] How to use session method
Method summary to update multiple columns [Ruby on Rails]
Ruby on rails learning record -2020.10.03
[Ruby on Rails] How to write enum in Japanese
Deploy Vapor Project to Heroku
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Ruby on Rails config configuration
[Ruby on Rails] How to change the column name
[Ruby on Rails] Change URL id to column name
Ruby on Rails basic learning ①
[Ruby on Rails] about has_secure_password
Ruby on rails learning record-2020.10.07 ②
Commentary on partial! --Ruby on Rails
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Ruby on rails learning record -2020.10.06
[Ruby on Rails] From MySQL construction to database change
(Ruby on Rails6) How to create models and tables
Ruby on Rails validation summary
Ruby on Rails Basic Memorandum
[Ruby on rails + Mysql] Data migration procedure memo when switching from heroku to AWS
From 0 to Ruby on Rails environment construction [macOS] (From Homebrew installation to Rails installation)
How to deploy a simple Java Servlet app on Heroku
<Dot installation> Introduction to Ruby on Rails5 Source code comparison
[Ruby on Rails] Elimination of Fat Controller-First, logic to model-
From Ruby on Rails error message display to Japanese localization
How to display a graph in Ruby on Rails (LazyHighChart)
[Ruby on Rails] Column restrictions when saving to DB (4 representatives)
Apply CSS to a specific View in Ruby on Rails
Beginner Ruby on Rails What I learned is being summarized