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