前提・実現したいこと
rails初心者です。
dockerを利用してrailsアプリを作っております。
herokuを用いてアプリをデプロイしようとすると、ブラウザ上に"Application error"と表示されてしまいます。
ログを確認すると以下のようなエラーメッセージが表示されました。
何か解決策がございましたらご教示いただければ幸いです。
発生している問題・エラーメッセージ
$ heroku logs --app [アプリ名] 2019-09-30T23:43:14.054493+00:00 app[web.1]: Switch to inspect mode. 2019-09-30T23:43:14.055164+00:00 app[web.1]: 2019-10-01T05:35:08.034102+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-01T05:35:30.193878+00:00 heroku[web.1]: Starting process with command `irb` 2019-10-01T05:35:31.976920+00:00 heroku[web.1]: State changed from starting to crashed 2019-10-01T05:35:31.956474+00:00 heroku[web.1]: Process exited with status 0 2019-10-01T05:35:31.910952+00:00 app[web.1]: Switch to inspect mode. 2019-10-01T05:35:31.912231+00:00 app[web.1]: 2019-10-01T11:45:51.993996+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-01T11:46:17.507386+00:00 heroku[web.1]: Starting process with command `irb` 2019-10-01T11:46:19.878889+00:00 heroku[web.1]: State changed from starting to crashed 2019-10-01T11:46:19.800326+00:00 app[web.1]: Switch to inspect mode. 2019-10-01T11:46:19.801029+00:00 app[web.1]: 2019-10-01T11:46:19.859627+00:00 heroku[web.1]: Process exited with status 0 2019-10-01T17:30:13.947163+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-01T17:30:45.215959+00:00 heroku[web.1]: Starting process with command `irb` 2019-10-01T17:30:47.797104+00:00 heroku[web.1]: State changed from starting to crashed 2019-10-01T17:30:47.776362+00:00 heroku[web.1]: Process exited with status 0 2019-10-01T17:30:47.687102+00:00 app[web.1]: Switch to inspect mode. 2019-10-01T17:30:47.688597+00:00 app[web.1]: 2019-10-01T23:14:36.401737+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-01T23:14:59.874930+00:00 heroku[web.1]: Starting process with command `irb` 2019-10-01T23:15:02.043300+00:00 heroku[web.1]: State changed from starting to crashed 2019-10-01T23:15:01.967131+00:00 app[web.1]: Switch to inspect mode. 2019-10-01T23:15:01.968428+00:00 app[web.1]: 2019-10-01T23:15:02.021668+00:00 heroku[web.1]: Process exited with status 0 2019-10-02T00:45:32.378153+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dry-meadow-71504.herokuapp.com request_id=d6a4485a-5669-4749-ba9f-6fbb747d8e37 fwd="148.67.231.161" dyno= connect= service= status=503 bytes= protocol=https 2019-10-02T00:45:34.661532+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dry-meadow-71504.herokuapp.com request_id=b0ae5a04-96b0-4e89-bd3b-3ce7d52e9baf fwd="148.67.231.161" dyno= connect= service= status=503 bytes= protocol=https 2019-10-02T00:54:19.584857+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dry-meadow-71504.herokuapp.com request_id=8ec15430-eb7b-4e76-a6d1-b5376c2b5e17 fwd="148.67.231.161" dyno= connect= service= status=503 bytes= protocol=https 2019-10-02T00:54:21.279366+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dry-meadow-71504.herokuapp.com request_id=f45267f0-ba83-41a3-82c6-0c333a70520c fwd="148.67.231.161" dyno= connect= service= status=503 bytes= protocol=https 2019-10-02T01:00:22.664172+00:00 app[api]: Release v16 created by user aaaaaaaaaa@gmail.com 2019-10-02T01:00:22.664172+00:00 app[api]: Deployed web (3d7ba4098d79) by user aaaaaaaaaa@gmail.com 2019-10-02T01:00:23.358023+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-02T01:00:51.227119+00:00 heroku[web.1]: Starting process with command `irb` 2019-10-02T01:00:53.268324+00:00 heroku[web.1]: State changed from starting to crashed 2019-10-02T01:00:53.304976+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-02T01:00:53.190892+00:00 app[web.1]: Switch to inspect mode. 2019-10-02T01:00:53.192015+00:00 app[web.1]: 2019-10-02T01:00:53.243156+00:00 heroku[web.1]: Process exited with status 0 2019-10-02T01:01:15.306675+00:00 heroku[web.1]: Starting process with command `irb` 2019-10-02T01:01:16.943192+00:00 heroku[web.1]: State changed from starting to crashed 2019-10-02T01:01:16.914450+00:00 heroku[web.1]: Process exited with status 0 2019-10-02T01:01:16.869553+00:00 app[web.1]: Switch to inspect mode. 2019-10-02T01:01:16.870221+00:00 app[web.1]: .... $ heroku run rails console --app [アプリ名] 特に何もエラーは表示されず
該当のソースコード
Dockerfile
1FROM ruby:2.5.0 2#RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs 3RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ 4 && apt-get install -y nodejs 5RUN mkdir /myapp 6WORKDIR /myapp 7COPY Gemfile /myapp/Gemfile 8COPY Gemfile.lock /myapp/Gemfile.lock 9RUN bundle install 10COPY . /myapp 11
dockercomposeyml
1version: '3' 2services: 3 db: 4 image: postgres 5 volumes: 6 - datavol:/var/lib/postgresql/data 7 web: 8 build: . 9 command: /bin/sh -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" 10 volumes: 11 - .:/myapp 12 - bundle_path:/bundle # gemをcacheするために追加 13 environment: 14 - BUNDLE_PATH=/bundle # gemをcacheするために追加 15 ports: 16 - "3000:3000" 17 depends_on: 18 - db 19volumes: 20 bundle_path: # gemをcacheするために追加 21 datavol: 22 23
試した手順
$ heroku login $ heroku container:login $ heroku container:push web -a [アプリ名] $ heroku container:release web -a [アプリ名] $ heroku addons:create heroku-postgresql:hobby-dev -a [アプリ名] $ heroku run rake db:migrate -a [アプリ名] $ git push heroku master $ heroku open -a [アプリ名]
あなたの回答
tips
プレビュー