質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

261閲覧

Railsチュートリアル11章にてherokuがApplicationエラーとなる

Naruhub

総合スコア6

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/02/15 10:30

編集2020/02/17 11:03

Railsチュートリアル11章にてherokuがApplicationエラーとなる

RailsチュートリアルにてユーザーのActivate機能とパスワードリセット機能を設定するために
HerokuにアップロードしたのですがApplicationエラーが解消されません。
どなたかお分かりになられる方がいましたらご教授ください。

発生している問題・エラーメッセージ

heroku logs --tailコマンド一部

2020-02-15T09:59:58.917184+00:00 heroku[run.4406]: State changed from up to complete 2020-02-15T09:59:58.900694+00:00 heroku[run.4406]: Process exited with status 0 2020-02-15T09:59:59.478678+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=hello-2020.herokuapp.com request_id=9b8438ef-51ad-4dc6-a2b4-5ece1bdfa9fb fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:00:00.116092+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hello-2020.herokuapp.com request_id=670e37b5-cd0b-45db-911d-71f375928468 fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:00:00.986112+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=hello-2020.herokuapp.com request_id=7042d843-1128-437d-bf9a-17833abdbb02 fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:00:01.518260+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=hello-2020.herokuapp.com request_id=b5ccb5da-8e78-4a42-9bb0-25708a67a94a fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:00:02.154969+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hello-2020.herokuapp.com request_id=6a6c762f-fe59-42c9-845e-8d20c7493762 fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:00:03.244009+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=hello-2020.herokuapp.com request_id=65c663f5-962e-4572-957a-0e3f18afcb09 fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:00:03.922639+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hello-2020.herokuapp.com request_id=6105e56a-eb07-43bf-9c99-7cf5d5df49de fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:17:48.194815+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=hello-2020.herokuapp.com request_id=03693292-1b9f-49dc-9c23-63dedeb660d4 fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:17:49.501323+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hello-2020.herokuapp.com request_id=77073b4f-a6a9-4a4e-b004-5555fc5d53a0 fwd="14.10.142.64" dyno= connect= service= status=503 bytes= protocol=https 2020-02-15T10:19:13.656135+00:00 heroku[web.1]: State changed from crashed to starting 2020-02-15T10:19:16.665403+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 2020-02-15T10:19:19.476509+00:00 app[web.1]: [4] Puma starting in cluster mode... 2020-02-15T10:19:19.476535+00:00 app[web.1]: [4] * Version 3.12.2 (ruby 2.6.5-p114), codename: Llamas in Pajamas 2020-02-15T10:19:19.476536+00:00 app[web.1]: [4] * Min threads: 5, max threads: 5 2020-02-15T10:19:19.476536+00:00 app[web.1]: [4] * Environment: production 2020-02-15T10:19:19.476536+00:00 app[web.1]: [4] * Process workers: 2 2020-02-15T10:19:19.476537+00:00 app[web.1]: [4] * Preloading application 2020-02-15T10:19:22.270236+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:48444 2020-02-15T10:19:22.270528+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.6.0/bin/puma) 2020-02-15T10:19:22.270561+00:00 app[web.1]: Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 48444 2020-02-15T10:19:22.270562+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/binder.rb:273:in `initialize' 2020-02-15T10:19:22.270562+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/binder.rb:273:in `new' 2020-02-15T10:19:22.270563+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/binder.rb:273:in `add_tcp_listener' 2020-02-15T10:19:22.270563+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/binder.rb:106:in `block in parse' 2020-02-15T10:19:22.270563+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/binder.rb:90:in `each' 2020-02-15T10:19:22.270563+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/binder.rb:90:in `parse' 2020-02-15T10:19:22.270564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/runner.rb:153:in `load_and_bind' 2020-02-15T10:19:22.270564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cluster.rb:412:in `run' 2020-02-15T10:19:22.270564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/launcher.rb:186:in `run' 2020-02-15T10:19:22.270564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/lib/puma/cli.rb:80:in `run' 2020-02-15T10:19:22.270564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-3.12.2/bin/puma:10:in `<top (required)>' 2020-02-15T10:19:22.270565+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/bin/puma:23:in `load' 2020-02-15T10:19:22.270565+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/bin/puma:23:in `<top (required)>' 2020-02-15T10:19:22.366275+00:00 heroku[web.1]: State changed from starting to crashed 2020-02-15T10:19:22.342984+00:00 heroku[web.1]: Process exited with status 1

該当のソースコード

Procfile

1web: bundle exec puma -C config/puma.rb

puma

1 2threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 3threads threads_count, threads_count 4 5port ENV.fetch("PORT") { 3000 } 6 7environment ENV.fetch("RAILS_ENV") { "development" } 8 9 10workers Integer(ENV['WEB_CONCURRENCY'] || 2) 11threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5) 12threads threads_count, threads_count 13 14preload_app! 15 16rackup DefaultRackup 17port ENV['PORT'] || 3000 18environment ENV['RACK_ENV'] || 'development' 19 20on_worker_boot do 21 ActiveRecord::Base.establish_connection 22end 23 24# Allow puma to be restarted by `rails restart` command. 25plugin :tmp_restart

Gemfile

1source 'https://rubygems.org' 2ruby '2.6.5' 3 4git_source(:github) do |repo_name| 5 repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 6 "https://github.com/#{repo_name}.git" 7end 8 9 10# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 11# gem 'ruby', '2.5.7' 12gem 'rails', '~> 5.1.6' 13gem 'bcrypt', '3.1.12' 14gem 'faker', '1.7.3' 15gem 'will_paginate', '3.1.6' 16gem 'bootstrap-will_paginate', '1.0.0' 17gem 'bootstrap-sass', '3.3.7' 18 19# Use Puma as the app server 20gem 'puma', '~> 3.7' 21# Use SCSS for stylesheets 22gem 'sass-rails', '~> 5.0' 23# Use Uglifier as compressor for JavaScript assets 24gem 'uglifier', '>= 1.3.0' 25# See https://github.com/rails/execjs#readme for more supported runtimes 26# gem 'therubyracer', platforms: :ruby 27 28# Use CoffeeScript for .coffee assets and views 29gem 'coffee-rails', '~> 4.2' 30 31gem 'jquery-rails', '4.3.1' 32# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 33gem 'turbolinks', '~> 5' 34# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 35gem 'jbuilder', '~> 2.5' 36# Use Redis adapter to run Action Cable in production 37# gem 'redis', '~> 4.0' 38# Use ActiveModel has_secure_password 39# gem 'bcrypt', '~> 3.1.7' 40 41# Use Capistrano for deployment 42# gem 'capistrano-rails', group: :development 43 44group :development, :test do 45 gem 'sqlite3', '1.3.13' 46 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 47 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 48 # Adds support for Capybara system testing and selenium driver 49 gem 'capybara', '~> 2.13' 50 gem 'selenium-webdriver' 51end 52 53group :test do 54 gem 'rails-controller-testing', '1.0.2' 55 gem 'minitest' 56 gem 'minitest-reporters', '1.1.14' 57 gem 'guard', '2.13.0' 58 gem 'guard-minitest', '2.4.4' 59end 60 61group :development do 62 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 63 gem 'web-console', '>= 3.3.0' 64 gem 'listen', '>= 3.0.5', '< 3.2' 65 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 66 # gem 'spring' 67 # gem 'spring-watcher-listen', '~> 2.0.0' 68end 69 70group :production do 71 gem 'pg', '0.20.0' 72end 73 74# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 75gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 76

試したこと

Rubyのバージョンを変える
参考ページ

プロセスを消してみる
参考ページ

宜しければトラブルシュートの方法を教えてください!

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2020/02/17 11:24

そのチュートリアル、よくherokuで動かないで未解決のママだから、チュートリアルの作者に見直してもらったほうがいいのでは
guest

回答1

0

自己解決

解決しました!
変更点

puma

1workers Integer(ENV['WEB_CONCURRENCY'] || 2) 2threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5) 3threads threads_count, threads_count 4 5preload_app! 6 7rackup DefaultRackup 8port 3001 || 3000 9environment ENV['RACK_ENV'] || 'development' 10 11 12on_worker_boot do

config/puma.rbのportを3001に指定してあげたこと
ログで出ていたのですが
何度もアプリケーションを立ち上げているようで
それぞれport番号も異なった状態で
Address already in use - bind(2) for "0.0.0.0" port xxxxxxと出ていました。

log

1~~~ 2 32020-02-18T00:33:15.841683+00:00 app[web.1]: [4] Puma starting in cluster mode... 42020-02-18T00:33:15.841755+00:00 app[web.1]: [4] * Version 3.12.2 (ruby 2.6.5-p114), codename: Llamas in Pajamas 52020-02-18T00:33:15.841791+00:00 app[web.1]: [4] * Min threads: 5, max threads: 5 62020-02-18T00:33:15.841830+00:00 app[web.1]: [4] * Environment: production 72020-02-18T00:33:15.841865+00:00 app[web.1]: [4] * Process workers: 2 82020-02-18T00:33:15.841903+00:00 app[web.1]: [4] * Preloading application 92020-02-18T00:33:21.080247+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:48374 102020-02-18T00:33:21.080573+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.6.0/bin/puma) 112020-02-18T00:33:21.080709+00:00 app[web.1]: Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 48374 12 13~~~ 14 152020-02-18T01:46:06.078909+00:00 app[web.1]: [4] Puma starting in cluster mode... 162020-02-18T01:46:06.078934+00:00 app[web.1]: [4] * Version 3.12.2 (ruby 2.6.5-p114), codename: Llamas in Pajamas 172020-02-18T01:46:06.078934+00:00 app[web.1]: [4] * Min threads: 5, max threads: 5 182020-02-18T01:46:06.079001+00:00 app[web.1]: [4] * Environment: production 192020-02-18T01:46:06.079026+00:00 app[web.1]: [4] * Process workers: 2 202020-02-18T01:46:06.079054+00:00 app[web.1]: [4] * Preloading application 212020-02-18T01:46:09.731436+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:33645 222020-02-18T01:46:09.731783+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.6.0/bin/puma) 232020-02-18T01:46:09.731817+00:00 app[web.1]: Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 33645 24 25~~~ 26

結論
rackupの設定のデフォルトが悪さして、port指定に失敗してたようです。
間違えていたらご指摘ください!????

投稿2020/02/18 02:36

Naruhub

総合スコア6

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問