几秒后,部署在Heroku上的应用程序崩溃503

时间:2016-07-24 18:19:31

标签: ruby-on-rails heroku

我有一个带有ActionCable和BackgroundJob的应用程序在localhost上运行良好,但是在heroku上它只运行了几秒钟,然后应用程序将崩溃。这是heroku日志:

Jul 24 11:25:41 example app/web.1:  Started GET "/" for 188.175.27.65 at 2016-07-24 18:25:40 +0000 
Jul 24 11:25:41 no404 app/web.1:  Processing by WelcomeController#index as HTML 
Jul 24 11:25:41 no404 app/web.1:    Rendering welcome/index.html.erb within layouts/application 
Jul 24 11:25:41 no404 app/web.1:    Rendered links/_new.html.erb (13.0ms) 
Jul 24 11:25:41 no404 app/web.1:    Rendered pro_versions/_button_pro_version.html.erb (0.7ms) 
Jul 24 11:25:41 no404 app/web.1:    Rendered welcome/index.html.erb within layouts/application (17.0ms) 
Jul 24 11:25:41 no404 app/web.1:    Rendered layouts/_navbar.html.erb (0.6ms) 
Jul 24 11:25:41 no404 app/web.1:    Rendered layouts/_footer.html.erb (0.4ms) 
Jul 24 11:25:41 no404 app/web.1:  Completed 200 OK in 56ms (Views: 30.1ms | ActiveRecord: 0.0ms) 
Jul 24 11:25:41 no404 app/web.1:  Started GET "/cable" for 188.175.27.65 at 2016-07-24 18:25:41 +0000 
Jul 24 11:25:41 no404 app/web.1:  Started GET "/cable/" [WebSocket] for 188.175.27.65 at 2016-07-24 18:25:41 +0000 
Jul 24 11:25:41 no404 app/web.1:  Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket) 
Jul 24 11:25:41 no404 app/web.1:  /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): ENV["REDISTOGO_URL"] (URI::InvalidURIError) 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/uri/rfc3986_parser.rb:73:in `parse' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/uri/common.rb:227:in `parse' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/uri/common.rb:714:in `URI' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/redis-3.3.1/lib/redis/client.rb:404:in `_parse_options' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/redis-3.3.1/lib/redis/client.rb:81:in `initialize' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/redis-3.3.1/lib/redis.rb:51:in `new' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/redis-3.3.1/lib/redis.rb:51:in `initialize' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0/lib/action_cable/subscription_adapter/redis.rb:11:in `new' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0/lib/action_cable/subscription_adapter/redis.rb:11:in `block (2 levels) in <class:Redis>' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0/lib/action_cable/subscription_adapter/redis.rb:51:in `redis_connection' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0/lib/action_cable/subscription_adapter/redis.rb:36:in `redis_connection_for_subscriptions' 
Jul 24 11:25:41 no404 app/web.1:    from /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0/lib/action_cable/subscription_adapter/redis.rb:145:in `block in ensure_listener_running' 
Jul 24 11:25:41 no404 heroku/web.1:  Process exited with status 1 
Jul 24 11:25:42 no404 heroku/router:  at=info method=GET path="/cable" host=no404.herokuapp.com request_id=5aafa828-3669-4522-a1f2-78bbdeb6850d fwd="188.175.27.65" dyno=web.1 connect=0ms service=131ms status=101 bytes=174 
Jul 24 11:25:43 no404 heroku/router:  at=error code=H10 desc="App crashed" method=GET path="/cable" host=no404.herokuapp.com request_id=28a44de1-ec62-4976-bb48-76d1f901b350 fwd="188.175.27.65" dyno=web.1 connect=0ms service= status=503 bytes= 

2016-07-24T17:27:48.829717+00:00 app[worker.1]:   Delayed::Backend::ActiveRecord::Job Load (1.5ms)  UPDATE "delayed_jobs" SET locked_at = '2016-07-24 17:27:48.827444', locked_by = 'host:5bb7aa42-3417-4fbc-a053-fcc4f125058a pid:3' WHERE id IN (SELECT  "delayed_jobs"."id" FROM "delayed_jobs" WHERE ((run_at <= '2016-07-24 17:27:48.826731' AND (locked_at IS NULL OR locked_at < '2016-07-24 13:27:48.826815') OR locked_by = 'host:5bb7aa42-3417-4fbc-a053-fcc4f125058a pid:3') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) RETURNING *

我的Procfile

web: bundle exec puma -p $PORT 
worker: rake jobs:work

一些宝石:

gem 'delayed_job'
gem 'delayed_job_active_record' 
gem 'redis'
gem 'puma'
gem 'rails_12factor'

生产:

Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
  config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.log_level = :debug
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.log_formatter = ::Logger::Formatter.new
  config.active_record.dump_schema_after_migration = false

  config.action_cable.url = "wss://example.herokuapp.com/cable" 
  config.action_cable.allowed_request_origins = ['https://example.herokuapp.com', 'http://example.herokuapp.com']
  config.serve_static_assets = true

end

Redis.rb

REDIS = Redis.new(Rails.application.config_for("cable"))

我使用的是RedisToGo插件

0 个答案:

没有答案