How to publish an application on Heroku

Introduction

Premise

Personal memorandum ruby 2.6.5 / Rails 6.0.3.4 / Mysql2

procedure

rails_12factor installation

Gemfile


group :production do
  gem 'rails_12factor'
end

bundle install => ** commit to master **

*** # Addendum *** ** This Gem installation doesn't seem to be needed in Rails 5 or later. ** ** ** It is not desirable to have a gem that seems to be out of maintenance already installed, so it seems better to uninstall unnecessary gems. ** **

Reference URL [Must-see for beginners] rails_12factor is not required to publish Rails app to Heroku

Create an app on Heroku

Terminal


%heroku create app name

App name cannot be used with _ (underscore)

Check if you have an app on Heroku

Terminal


% git config --list | grep heroku

Mysql settings

clearDB add-on

Terminal


% heroku addons:add cleardb

This changes the DB from Heroku's default DB (PostgreSQL) to Mysql

Support for Mysql2 (Gem)

Reset the URL

Terminal


% heroku_cleardb=`heroku config:get CLEARDB_DATABASE_URL`

Define variables above

Terminal


% heroku config:set DATABASE_URL=mysql2${heroku_cleardb:5}

URL setting is complete

Setting environment variables

Terminal


% heroku config:set RAILS_MASTER_KEY=`cat config/master.key`

↓ Confirmation method

Terminal


% heroku config

Push the app to Heroku

Terminal


% git push heroku master

Perform migration

Terminal


% heroku run rails db:migrate

Confirm release

Terminal


% heroku apps:info

Check for errors

Terminal


% heroku logs --tail --app app name

Heroku updates (if needed)

What to do when Warning: heroku update available appears

Terminal


% heroku update

in conclusion

The image is probably unusable, so you may need to set up Amazon S3

✔︎

Recommended Posts

How to publish an application on Heroku
How to create an application
How to deploy on heroku
How to create an application server on an EC2 instance on AWS
How to redo a deployment on Heroku
[Rails / Heroku / MySQL] How to reset the DB of Rails application on Heroku
How to publish an application using AWS (3) EC2 instance environment construction
How to save images on Heroku to S3 on AWS
Run an application made with Go on Heroku
Note how to rollback Mysql deployed on Heroku
[Rails MySQL] How to reset DB on heroku
How to post images on Heroku + CarrierWave + S3
How to install Ruby on an EC2 instance on AWS
How to connect to ClearDB from Sequel Pro on Heroku
[Ruby On Rails] How to reset DB in Heroku
[Heroku] How to solve when an error is displayed on git push heroku master
How to handle an instance
How to deploy a simple Java Servlet app on Heroku
How to deploy a Rails application on AWS (article summary)
How to check the database of apps deployed on Heroku
How to deploy jQuery on Rails
How to deploy Laravel on CentOS 7
[Java] How to update Java on Windows
How to install ImageMagick on Windows 10
How to use Ruby on Rails
How to deploy Bootstrap on Rails
How to run JavaFX on Docker
How to use Bio-Formats on Ubuntu 20.04
How to insert an external library
How to connect Heroku and Sequel
How to install MariaDB 10.4 on CentOS 8
Rails on Tiles (how to write)
How to install WildFly on Ubuntu 18.04
Deploy Rails on Docker to heroku
How to build vim on Ubuntu 20.04
How to install and use Composer on an ECS instance on Ubuntu 16.04
How to deploy an app that references a local jar to heroku
Upload multiple images to Cloudinary on Active Storage and publish to Heroku
How to build an Apache Flink application from scratch in 5 minutes
How to create a web server on an EC2 instance on AWS
How to make an application with ruby on rails (assuming that the environment has been built)
How to crop an image with libGDX
How to check Java installed on Mac
A memorandum on how to use Eclipse
How to use Apache Derby on Eclipse
[Ruby on Rails] How to use CarrierWave
How to blur an image (super easy)
How to detect microphone conflicts on Android
How to install Eclipse (Photon) on Mac
How to install production Metabase on Ubuntu
How to switch Java versions on Mac
How to install beta php8.0 on CentOS8
Deploy to Heroku [Ruby on Rails] Beginner
How to change the timezone on Ubuntu
How to define an inner class bean
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] How to use kaminari
How to install kafkacat on Amazon Linux2
How to publish a library in jCenter
How to write an RSpec controller test
How to add application version information to Sentry information