0

首先让我说我对heroku/ruby/rails 很陌生。我正在阅读 Michael Hartl 的 Ruby on Rails 教程,当我使用“rails s”在本地服务器上部署我的应用程序时,一切正常。但是,当我将我的应用程序推送到 heroku 并使用“heroku open”部署它时,应用程序似乎跳过了所有资产。我验证了资产管道已启用,但我仍然无法让我的应用程序以任何格式部署在 heroku 上。

我一直在查看 heroku 日志,但似乎唯一的错误是 FATAL SignalException 但我不确定那指的是什么。另外,如果有人可以解释弃用警告是否严重,我将非常感激。

heroku 日志:

2013-08-20T23:23:14.690294+00:00 app[web.1]: [2013-08-20 23:23:14] FATAL SignalException: SIGTERM
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-08-20T23:23:14.690514+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
2013-08-20T23:23:14.690514+00:00 app[web.1]:    script/rails:6:in `require'
2013-08-20T23:23:14.690294+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
2013-08-20T23:23:14.690514+00:00 app[web.1]:    script/rails:6:in `<main>'
2013-08-20T23:23:14.690825+00:00 app[web.1]: [2013-08-20 23:23:14] INFO  going to shutdown ...
2013-08-20T23:23:14.691003+00:00 app[web.1]: [2013-08-20 23:23:14] INFO  WEBrick::HTTPServer#start done.
2013-08-20T23:23:14.691149+00:00 app[web.1]: Exiting
2013-08-20T23:23:16.134514+00:00 heroku[web.1]: Process exited with status 143
2013-08-20T23:23:17.437119+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 45415`
2013-08-20T23:23:20.063810+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-08-20T23:23:20.063810+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-08-20T23:23:20.892393+00:00 app[web.1]:         SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
2013-08-20T23:23:20.892393+00:00 app[web.1]:         This poses a security threat. It is strongly recommended that you
2013-08-20T23:23:20.892393+00:00 app[web.1]:         future versions will even invalidate your existing user cookies.
2013-08-20T23:23:20.892393+00:00 app[web.1]:         Called from: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
2013-08-20T23:23:20.892393+00:00 app[web.1]:         provide a secret to prevent exploits that may be possible from crafted
2013-08-20T23:23:20.892393+00:00 app[web.1]:         cookies. This will not be supported in future versions of Rack, and
2013-08-20T23:23:20.892393+00:00 app[web.1]: 
2013-08-20T23:23:21.462460+00:00 heroku[web.1]: State changed from starting to up
2013-08-20T23:23:21.255176+00:00 app[web.1]: [2013-08-20 23:23:21] INFO  WEBrick 1.3.1
2013-08-20T23:23:21.255176+00:00 app[web.1]: [2013-08-20 23:23:21] INFO  ruby 2.0.0 (2013-06-27) [x86_64-linux]
2013-08-20T23:23:21.255549+00:00 app[web.1]: [2013-08-20 23:23:21] INFO  WEBrick::HTTPServer#start: pid=2 port=45415
2013-08-20T23:23:26.146248+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-08-20T23:23:26.146248+00:00 app[web.1]: 
2013-08-20T23:23:26.146248+00:00 app[web.1]: 
2013-08-20T23:23:26.146248+00:00 app[web.1]: Started GET "/" for 69.254.153.186 at 2013-08-20 23:23:26 +0000
2013-08-20T23:23:26.146248+00:00 app[web.1]: => Booting WEBrick
2013-08-20T23:23:26.146248+00:00 app[web.1]: => Rails 3.2.3 application starting in production on http://0.0.0.0:45415
2013-08-20T23:23:26.146248+00:00 app[web.1]: => Call with -d to detach
2013-08-20T23:23:26.489483+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (2.2ms)
2013-08-20T23:23:26.481456+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-08-20T23:23:26.496375+00:00 app[web.1]:   Rendered layouts/_header.html.erb (1.3ms)
2013-08-20T23:23:26.494575+00:00 app[web.1]:   Rendered layouts/_shim.html.erb (0.3ms)
2013-08-20T23:23:26.497960+00:00 app[web.1]: Completed 200 OK in 16ms (Views: 15.8ms | ActiveRecord: 0.0ms)
2013-08-20T23:23:26.497774+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.9ms)
2013-08-20T23:23:26.670396+00:00 heroku[router]: at=info method=GET path=/assets/application-3428e82709d7645135002c8fadfafdc6.js host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=4ms service=20ms status=200 bytes=642
2013-08-20T23:23:26.693364+00:00 heroku[router]: at=info method=GET path=/assets/application-7270767b2a9e9fff880aa5de378ca791.css host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=2ms service=26ms status=200 bytes=0
2013-08-20T23:23:26.795663+00:00 heroku[router]: at=info method=GET path=/assets/rails-be8732dac73d845ac5b142c8fb5f9fb0.png host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=1ms service=9ms status=200 bytes=6646
2013-08-20T23:23:26.506094+00:00 heroku[router]: at=info method=GET path=/ host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=2ms service=380ms status=304 bytes=0
2013-08-21T00:29:30.830550+00:00 heroku[web.1]: Idling
2013-08-21T00:29:35.491771+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2013-08-21T00:29:36.117015+00:00 app[web.1]: [2013-08-21 00:29:36] FATAL SignalException: SIGTERM
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-08-21T00:29:36.117176+00:00 app[web.1]:    script/rails:6:in `<main>'
2013-08-21T00:29:36.117176+00:00 app[web.1]: [2013-08-21 00:29:36] INFO  going to shutdown ...
2013-08-21T00:29:36.117176+00:00 app[web.1]: [2013-08-21 00:29:36] INFO  WEBrick::HTTPServer#start done.
2013-08-21T00:29:36.117176+00:00 app[web.1]: Exiting
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
2013-08-21T00:29:36.117176+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
2013-08-21T00:29:36.117176+00:00 app[web.1]:    script/rails:6:in `require'
2013-08-21T00:29:36.117015+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
2013-08-21T00:29:37.526666+00:00 heroku[web.1]: State changed from up to down
2013-08-21T00:29:37.523783+00:00 heroku[web.1]: Process exited with status 143
2013-08-21T22:25:21.381126+00:00 heroku[web.1]: Unidling
2013-08-21T22:25:21.381126+00:00 heroku[web.1]: State changed from down to starting
2013-08-21T22:25:27.384489+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 5284`
2013-08-21T22:25:33.072380+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-08-21T22:25:33.072739+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-08-21T22:25:33.666165+00:00 app[web.1]:         SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
2013-08-21T22:25:33.666165+00:00 app[web.1]:         This poses a security threat. It is strongly recommended that you
2013-08-21T22:25:33.666165+00:00 app[web.1]:         provide a secret to prevent exploits that may be possible from crafted
2013-08-21T22:25:33.666165+00:00 app[web.1]:         cookies. This will not be supported in future versions of Rack, and
2013-08-21T22:25:33.666165+00:00 app[web.1]:         future versions will even invalidate your existing user cookies.
2013-08-21T22:25:33.666165+00:00 app[web.1]:         Called from: /app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
2013-08-21T22:25:33.666165+00:00 app[web.1]: 
2013-08-21T22:25:34.000370+00:00 app[web.1]: [2013-08-21 22:25:34] INFO  WEBrick::HTTPServer#start: pid=2 port=5284
2013-08-21T22:25:34.000010+00:00 app[web.1]: [2013-08-21 22:25:33] INFO  WEBrick 1.3.1
2013-08-21T22:25:34.000010+00:00 app[web.1]: [2013-08-21 22:25:33] INFO  ruby 2.0.0 (2013-06-27) [x86_64-linux]
2013-08-21T22:25:34.121184+00:00 heroku[web.1]: State changed from starting to up
2013-08-21T22:25:35.491396+00:00 app[web.1]: => Rails 3.2.3 application starting in production on http://0.0.0.0:5284
2013-08-21T22:25:35.491396+00:00 app[web.1]: => Call with -d to detach
2013-08-21T22:25:35.491396+00:00 app[web.1]: => Booting WEBrick
2013-08-21T22:25:35.491396+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-08-21T22:25:35.491396+00:00 app[web.1]: 
2013-08-21T22:25:35.491396+00:00 app[web.1]: 
2013-08-21T22:25:35.491396+00:00 app[web.1]: Started GET "/" for 69.254.153.186 at 2013-08-21 22:25:35 +0000
2013-08-21T22:25:35.800959+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-08-21T22:25:35.808774+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (2.0ms)
2013-08-21T22:25:35.813736+00:00 app[web.1]:   Rendered layouts/_shim.html.erb (0.3ms)
2013-08-21T22:25:35.815682+00:00 app[web.1]:   Rendered layouts/_header.html.erb (1.3ms)
2013-08-21T22:25:35.817164+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.9ms)
2013-08-21T22:25:35.817399+00:00 app[web.1]: Completed 200 OK in 16ms (Views: 15.7ms | ActiveRecord: 0.0ms)
2013-08-21T22:25:35.821307+00:00 heroku[router]: at=info method=GET path=/ host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=2ms service=345ms status=200 bytes=1862
2013-08-21T22:25:36.462464+00:00 heroku[router]: at=info method=GET path=/assets/application-3428e82709d7645135002c8fadfafdc6.js host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=2ms service=7ms status=304 bytes=0
2013-08-21T22:25:36.825347+00:00 heroku[router]: at=info method=GET path=/assets/rails-be8732dac73d845ac5b142c8fb5f9fb0.png host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=2ms service=15ms status=304 bytes=0
2013-08-21T22:25:36.172492+00:00 heroku[router]: at=info method=GET path=/assets/application-7270767b2a9e9fff880aa5de378ca791.css host=peaceful-sierra-3634.herokuapp.com fwd="69.254.153.186" dyno=web.1 connect=2ms service=8ms status=304 bytes=0
4

2 回答 2

1

不确定您遵循的过程,但heroku open不是部署您的应用程序,这只是在您的浏览器中打开 yourapp.herokuapp.com 。

要在 heroku 中部署应用程序,您必须:

  1. 创建应用程序:heroku create
  2. 使用 git,将您的代码推送到 heroku:git push heroku master(heroku 是您的远程仓库的名称,用于git remote -v确保您拥有 heroku)。这会将您的应用程序部署到 heroku、捆绑安装、创建数据库并预编译您的资产。
  3. 运行:(heroku run rake db:migrate你应该在 Gemfile 中使用 MySQL 或 Postgres,sqlite 会抛出错误)。
  4. 最后heroku open

看起来你忘记了第 3 步。

希望这可以帮助!

于 2013-08-21T23:20:05.593 回答
0

您是否可能错过了 5.4 中的步骤?

require File.expand_path('../boot', __FILE__)
.
.
.
 module SampleApp
  class Application < Rails::Application

    config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
 end
end
于 2013-08-21T23:18:55.560 回答