ruby-on-rails - 将 Rails 4 App 部署到 Heroku redis 时出错

标签 ruby-on-rails ruby heroku redis

我在 heroku 中部署我的 Rails 应用程序已经有一年的时间了,没有任何问题,但最近当我尝试推送该应用程序时它崩溃了。我使用 heroku local 对其进行了测试,它可以工作,但在 heroku 上却不行。

我没有对 conf 文件进行任何更改它只是突然在 heroku 上不起作用

Starting process with command `bundle exec puma -C config/puma.rb`
[4] Puma starting in cluster mode...
[4] * Version 3.11.0 (ruby 2.3.1-p112), codename: Love Song
[4] * Min threads: 2, max threads: 2
[4] * Environment: production
[4] * Process workers: 1
[4] * Preloading application
[4] ! Unable to load application: Redis::CannotConnectError: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)
bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.3.0/bin/puma)
Redis::CannotConnectError: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:344:in `rescue in establish_connection'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:329:in `establish_connection'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:98:in `connect'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:363:in `ensure_connected'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:219:in `block in process'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:304:in `logging'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:218:in `process'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis/client.rb:118:in `call'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis.rb:1423:in `block in smembers'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis.rb:45:in `block in synchronize'
   /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis.rb:45:in `synchronize'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-4.0.1/lib/redis.rb:1422:in `smembers'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-namespace-1.6.0/lib/redis/namespace.rb:442:in `call_with_namespace'
   /app/vendor/bundle/ruby/2.3.0/gems/redis-namespace-1.6.0/lib/redis/namespace.rb:328:in `method_missing'
   /app/vendor/bundle/ruby/2.3.0/gems/resque-1.27.4/lib/resque/data_store.rb:236:in `worker_ids'
   /app/vendor/bundle/ruby/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:72:in `all'
   /app/vendor/bundle/ruby/2.3.0/gems/resque-1.27.4/lib/resque.rb:464:in `workers'
   /app/config/application.rb:44:in `<class:Application>'
   /app/config/application.rb:13:in `<module:Truckbu>'
   /app/config/application.rb:12:in `<top (required)>'
   /app/config/environment.rb:2:in `require'
   /app/config/environment.rb:2:in `<top (required)>'
   config.ru:3:in `require'
   config.ru:3:in `block in <main>'
   /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/builder.rb:55:in `instance_eval'
   /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/builder.rb:55:in `initialize'
   config.ru:in `new'
   config.ru:in `<main>'
   /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/builder.rb:49:in `eval'
   /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/builder.rb:49:in `new_from_string'
   /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/builder.rb:40:in `parse_file'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/lib/puma/configuration.rb:318:in `load_rackup'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/lib/puma/configuration.rb:243:in `app'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/lib/puma/runner.rb:138:in `load_and_bind'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/lib/puma/cluster.rb:397:in `run'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/lib/puma/launcher.rb:183:in `run'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/lib/puma/cli.rb:77:in `run'
   /app/vendor/bundle/ruby/2.3.0/gems/puma-3.11.0/bin/puma:10:in `<top (required)>'
  /app/vendor/bundle/ruby/2.3.0/bin/puma:23:in `load'
  /app/vendor/bundle/ruby/2.3.0/bin/puma:23:in `<top (required)>'
 State changed from starting to crashed
 Process exited with status 1

像往常一样在 ENV 中设置 redis url。

最佳答案

我终于找到了问题所在,项目配置为使用 Redis 3.3.5。他们更新了 gem,然后更改了配置。我通过在 Gemfile 中设置适用于当前配置的 gem 版本解决了这个问题。

关于ruby-on-rails - 将 Rails 4 App 部署到 Heroku redis 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47596081/

相关文章:

css - 在部署我的 Ruby on Rails 应用程序时丢失图标

ruby-on-rails - Ruby on Rails使用命令行 ``计算图像的md5

ruby - 为什么在使用 google API 对 google Big Query 运行查询时出现 NoMethodError?

node.js - 由于硬编码端口号,无法将 node.js 应用程序部署到 heroku

ruby-on-rails - 通过 HTTP POST 更新

css - 标签显示在复选框下方

ruby - 克隆数组获得与原始数组相同的值

ruby - 如何为 WordPress 多站点编写 h2o webserver mruby 处理程序?

heroku - 如何以编程方式访问当前的Heroku发行版本?

ruby-on-rails - rails Assets :precompile during slug for s3 error: Fog provider and directory can't be blank when env are set