我正在尝试在Heroku上运行我的应用程序。我已经做了一个耙子数据库:迁移并确认了所有依赖项。我还添加了设计密钥。此外,我已将 Nodejs 和 Ruby 添加到我的构建包中。
构建成功了! 然而,当我打开应用程序时,它给了我一个 503 错误。
我试图分析日志,但无法准确找到可能导致此问题的原因。这是日志,请帮忙!-
> -----> Ruby app detected
> -----> Compiling Ruby/Rails
> -----> Using Ruby version: ruby-2.4.1
> -----> Installing dependencies using bundler 1.15.2
> Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
> Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you
> upgrade to the latest version of Bundler by running `gem install
> bundler`.
> Fetching gem metadata from https://rubygems.org/.........
> Fetching version metadata from https://rubygems.org/..
> Fetching dependency metadata from https://rubygems.org/.
> Using rake 12.3.1
> Using concurrent-ruby 1.0.5
> Using minitest 5.11.3
> Using thread_safe 0.3.6
> Using builder 3.2.3
> Using erubi 1.7.1
> Using mini_portile2 2.3.0
> Using crass 1.0.4
> Using rack 2.0.5
> Using nio4r 2.3.1
> Using websocket-extensions 0.1.3
> Using mini_mime 1.0.0
> Using arel 9.0.0
> Using mimemagic 0.3.2
> Using execjs 2.7.0
> Using aws-eventstream 1.0.0
> Using aws-partitions 1.90.0
> Using aws-sigv4 1.0.2
> Using jmespath 1.4.0
> Using bcrypt 3.1.12
> Using msgpack 1.2.4
> Using rb-fsevent 0.10.3
> Using ffi 1.9.23
> Using bundler 1.15.2
> Using climate_control 0.2.0
> Using cocoon 1.2.11
> Using coffee-script-source 1.12.2
> Using method_source 0.9.0
> Using thor 0.20.0
> Using orm_adapter 0.5.0
> Using temple 0.8.0
> Using tilt 2.0.8
> Using multi_json 1.13.1
> Using mime-types-data 3.2016.0521
> Using pg 1.0.0
> Using puma 3.11.4
> Using rails_serve_static_assets 0.0.5
> Using rails_stdout_logging 0.0.5
> Using tlsmail 0.0.1
> Using turbolinks-source 5.1.0
> Using tzinfo 1.2.5
> Using i18n 1.0.1
> Using nokogiri 1.8.2
> Using rack-test 1.0.0
> Using warden 1.2.7
> Using sprockets 3.7.1
> Using mail 2.7.0
> Using marcel 0.3.2
> Using autoprefixer-rails 8.5.2
> Using uglifier 4.1.11
> Using websocket-driver 0.7.0
> Using bootsnap 1.3.0
> Using rb-inotify 0.9.10
> Using terrapin 0.6.0
> Using coffee-script 2.4.1
> Using aws-sdk-core 3.21.2
> Using mime-types 3.1
> Using rails_12factor 0.0.3
> Using turbolinks 5.1.1
> Using activesupport 5.2.0
> Using haml 5.0.4
> Using loofah 2.2.2
> Using aws-sdk-kms 1.5.0
> Using sass-listen 4.0.0
> Using rails-dom-testing 2.0.3
> Using globalid 0.4.1
> Using activemodel 5.2.0
> Using jbuilder 2.7.0
> Using aws-sdk-s3 1.13.0
> Using activejob 5.2.0
> Using activerecord 5.2.0
> Using paperclip 6.0.0
> Using rails-html-sanitizer 1.0.4
> Using sass 3.5.6
> Using actionview 5.2.0
> Using bootstrap-sass 3.3.7
> Using actionpack 5.2.0
> Using actioncable 5.2.0
> Using actionmailer 5.2.0
> Using activestorage 5.2.0
> Using railties 5.2.0
> Using sprockets-rails 3.2.1
> Using simple_form 4.0.1
> Using coffee-rails 4.2.2
> Using responders 2.4.0
> Using jquery-rails 4.3.3
> Using rails 5.2.0
> Using sass-rails 5.0.7
> Using devise 4.4.3
> Bundle complete! 29 Gemfile dependencies, 89 gems now installed.
> Gems in the groups development and test were not installed.
> Bundled gems are installed into ./vendor/bundle.
> Bundle completed (3.48s)
> Cleaning up the bundler cache.
> Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you
> upgrade to the latest version of Bundler by running `gem install
> bundler`.
> The latest bundler is 1.16.2, but you are currently running 1.15.2.
> To update, run `gem install bundler`
> -----> Installing node-v8.10.0-linux-x64
> -----> Detecting rake tasks
> -----> Preparing app for Rails asset pipeline
> Running: rake assets:precompile
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/smtp.rb:806:
> warning: already initialized constant Net::SMTPSession
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/smtp.rb:806:
> warning: previous definition of SMTPSession was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:687:
> warning: already initialized constant Net::POP
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:687:
> warning: previous definition of POP was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:688:
> warning: already initialized constant Net::POPSession
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:688:
> warning: previous definition of POPSession was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:689:
> warning: already initialized constant Net::POP3Session
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:689:
> warning: previous definition of POP3Session was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:702:
> warning: already initialized constant Net::APOPSession
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:702:
> warning: previous definition of APOPSession was here
> Yarn executable was not detected in the system.
> Download Yarn at https://yarnpkg.com/en/docs/install
> Asset precompilation completed (1.67s)
> Cleaning assets
> Running: rake assets:clean
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/smtp.rb:806:
> warning: already initialized constant Net::SMTPSession
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/smtp.rb:806:
> warning: previous definition of SMTPSession was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:687:
> warning: already initialized constant Net::POP
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:687:
> warning: previous definition of POP was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:688:
> warning: already initialized constant Net::POPSession
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:688:
> warning: previous definition of POPSession was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:689:
> warning: already initialized constant Net::POP3Session
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:689:
> warning: previous definition of POP3Session was here
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:702:
> warning: already initialized constant Net::APOPSession
> /tmp/build_f381a7cc4444b081c9f6475d04f8ebb1/vendor/bundle/ruby/2.4.0/gems/tlsmail-0.0.1/lib/net/pop.rb:702:
> warning: previous definition of APOPSession was here
> ###### WARNING:
> We detected that some binary dependencies required to
> use all the preview features of Active Storage are not
> present on this system.
>
> For more information please see:
> https://devcenter.heroku.com/articles/active-storage-on-heroku
>
> ###### WARNING:
> No Procfile detected, using the default web server.
> We recommend explicitly declaring how to boot your server process via a Procfile.
> https://devcenter.heroku.com/articles/ruby-default-web-server
> -----> Discovering process types
> Procfile declares types -> (none)
> Default types for buildpack -> console, rake, web, worker
> -----> Compressing...
> Done: 51.9M
根据提供的描述,如果您也可以共享 heroku 日志会更好,但同时如描述的 503 状态代码。
503 错误表示"服务不可用"。
当 HTTP 请求在 Heroku 路由网格和您的应用程序之间超时时,Heroku 会返回 503 错误, 包括应用程序无法启动时。
此超时限制设置为 30 秒,如 Heroku 所述,并在日志中显示如下。
请找到以下链接以更好地了解上述说明:
http://artsy.github.io/blog/2012/11/15/how-to-monitor-503s-and-timeout-on-heroku/
检查您的页面加载和查询是否在 30 秒内。
对于查询监视,请使用"项目符号 gem",以便可以将其最小化。
希望对您有所帮助!!
从应用程序右上角的更多选项运行控制台。打开控制台 您可以在那里看到这种控制台,在那里看到输入轨道控制台。Heroku Run Rails 控制台
然后,您将看到应用程序的完整日志,并且您将找到导致应用程序进入503状态的正确问题。我的问题是适配器错别字