Error deploying rails5 + Mysql to heroku with Docker-compose

udemy here https://www.udemy.com/course/rails-kj/ Learning

[SNS bulletin board app] (https://github.com/kkoji/rails-lecture/tree/current_user_method) I am allowed to make.

Rails 5 series Ruby 2.4.5 mysql2

Finally I'm trying to deploy to heroku

Until you deploy Rails on Docker on Heroku I'm stuck trying to use MySQL on Heroku Refer to, try

As a flow, Add clearDB as an add-on Set in config (change to mysql2) heroku CLI login Log in to heroku container heroku create~~ heroku container:push web heroku container:release web heroku run rails db:migrate heroku open heroku run rails assets:precompile heroku config:add RAILS_ENV=production (I don't understand the asset pipeline)

However, I got an Application error on heroku open and at heroku logs --tail

2020-08-31T00:05:17.338031+00:00 app[api]: Deployed web (09d5e5e0baba) by user [email protected]
2020-08-31T00:05:17.338031+00:00 app[api]: Release v14 created by user [email protected]
2020-08-31T00:05:17.566831+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-31T00:05:33.102257+00:00 app[api]: Starting process with command `rails db:migrate` by user [email protected]
2020-08-31T00:05:41.271963+00:00 heroku[web.1]: Starting process with command `irb`
2020-08-31T00:05:44.759411+00:00 app[web.1]: Switch to inspect mode.
2020-08-31T00:05:44.760171+00:00 app[web.1]: 
2020-08-31T00:05:44.815317+00:00 heroku[web.1]: Process exited with status 0
2020-08-31T00:05:44.849695+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-31T00:05:44.852418+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-31T00:05:52.851790+00:00 heroku[run.7980]: State changed from starting to up
2020-08-31T00:05:52.856447+00:00 heroku[run.7980]: Awaiting client
2020-08-31T00:05:52.891424+00:00 heroku[run.7980]: Starting process with command `rails db:migrate`
2020-08-31T00:05:59.894902+00:00 heroku[run.7980]: Process exited with status 0
2020-08-31T00:05:59.927380+00:00 heroku[run.7980]: State changed from up to complete
2020-08-31T00:06:05.419295+00:00 heroku[web.1]: Starting process with command `irb`
2020-08-31T00:06:08.786074+00:00 app[web.1]: Switch to inspect mode.
2020-08-31T00:06:08.786799+00:00 app[web.1]: 
2020-08-31T00:06:08.879555+00:00 heroku[web.1]: Process exited with status 0
2020-08-31T00:06:08.991140+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-31T00:09:58.194158+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-temple-79557.herokuapp.com request_id=432296e9-7359-4456-bbc2-b885e514a27d fwd="111.97.175.96" dyno= connect= service= status=503 bytes= protocol=https
2020-08-31T00:09:59.223351+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-temple-79557.herokuapp.com request_id=12c8e692-769d-45a7-9967-ce77256746eb fwd="111.97.175.96" dyno= connect= service= status=503 bytes= protocol=https

It came out.

further, heroku run rails console c

Running via Spring preloader in process 18
WARNING: Spring is running in production. To fix this make sure the spring gem is only present in `development` and `test` groups in your Gemfile and make sure you always use `bundle install --without development test` in production
Loading production environment (Rails 5.0.7.2)

for that reason, Change bundle install with Dockerfile

FROM ruby:2.4.5
RUN apt-get update -qq && apt-get install -y build-essential nodejs
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install --without development test
COPY . /app

I rewrote it, but it didn't heal.

Hmmm weak ...

Below Docker-compose.yml

Docker-compose.yml


version: '3'
services:
  web:
    build: .
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    volumes:
      - .:/app
    ports:
      - 3000:3000
    depends_on:
      - db
    tty: true
    stdin_open: true
  db:
    image: mysql:5.7
    volumes:
      - db-volume:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
volumes:
  db-volume:

Recommended Posts

Error deploying rails5 + Mysql to heroku with Docker-compose
Deploy to heroku with Docker (Rails 6, MySQL)
DB error on deploying with Heroku
Deploy heroku with Rails6 (Cloud9 + Ubuntu) + MySQL
When deploying to Heroku, OpenApp causes an error
rails heroku error log
[Rails MySQL] How to reset DB on heroku
How to make batch processing with Rails + Heroku configuration
Error encountered with notes when deploying docker on rails
I started MySQL 5.7 with docker-compose and tried to connect
Environment construction of Rails5 + MySQL8.0 + top-level volumes with docker-compose
Connect to MySQL 8 with Java
Docker-compose deploying Neo4j with APOC
exited with code 1 error resolution with docker-compose up in rails environment
[rails] heroku deployment error ActionView :: Template :: Error (Mysql2 :: Error: Table --- doesn't exist):
Rails + MySQL environment construction with Docker
Rails new fails to install mysql
[Rails] How to speed up docker-compose
mysql2 fails to install with bundle install
How to get along with Rails
Deploy Rails on Docker to heroku
Introducing React to Rails with react-rails
Rails DB PostgreSQL changed to MySQL
Update MySQL from 5.7 to 8.0 with Docker
[Rails / RSpec] How to deal with element has zero size error
[Rails / Heroku / MySQL] How to reset the DB of Rails application on Heroku
Redirect to your own domain with rack-rewrite on Heroku x Rails
Create Rails 6 + MySQL environment with Docker compose
[Rails] How to use rails console with docker
Try running MySql and Blazor with docker-compose
Error when trying to use heroku command
How to use MySQL in Rails tutorial
Deploy to Heroku [Ruby on Rails] Beginner
Try deploying Rails app to EC2-Part 2 (Deploy)-
[rails s error] md5.bundle and mysql installation error
Dealing with Mysql2 :: Error: Incorrect string value error
How to monitor nginx with docker-compose with datadog
rails test fails with database reference error
Ruby on Rails ✕ Docker ✕ MySQL Introducing Docker and docker-compose to apps under development
Let's make an error screen with Rails
[Rails / Heroku] Error resolution procedure after push
How to build Rails 6 environment with Docker
Downgrade an existing app created with rails 5.2.4 to 5.1.6
The road to Japaneseizing Rails devise error messages
[Rails] Error resolution when generating tokens with PAYJP
Rails6 [API mode] + MySQL5.7 environment construction with Docker
Introducing New Relic to Rails apps on Heroku
Error with bundle install after upgrading to Catalina
Try deploying Rails application to EC2-Part 2 (Server construction)-
error code 400 appears when deploying with release: perform
Deploy Rails to ECS Fargate with AWS Copilot
One way to redirect_to with parameters in rails
Note how to rollback Mysql deployed on Heroku
I want to play with Firestore from Rails
[Rails] How to easily implement numbers with pull-down
How to build API with GraphQL and Rails
Rails beginners tried to get started with RSpec
I made a LINE bot with Rails + heroku
[Rails] How to build an environment with Docker
[Rails] How to get success and error messages
Try to summarize the common layout with rails