尝试在 heroku 上部署运动鞋,而我在 Procfile 中创建了一个工人:
sneakers: bundle exec rake sneakers:run
这是我的 senakers.rb 文件
require 'sneakers/metrics/newrelic_metrics'
Sneakers.configure heartbeat: 2,
exchange_type: :direct,
threads: 1,
workers: 1,
amqp: "amqp://#{ENV['RABBITMQ_USERNAME']}:#{ENV['RABBITMQ_PASSWORD']}@#{ENV['RABBITMQ_HOST']}:#{ENV['RABBITMQ_PORT']}/#{ENV['RABBITMQ_VHOST']}",
exchange: 'core.exchange',
durable: true,
daemonize: Rails.env.production?,
metrics: Sneakers::Metrics::NewrelicMetrics.new
# Sneakers.configure({})
Sneakers.logger.level = Logger::INFO
它总是以状态 0 退出,有什么办法让它继续工作吗?
这是日志
2018-07-02T14:26:14.483453+00:00 heroku[sneakers.1]: Starting process with command `bundle exec rake sneakers:run`
2018-07-02T14:26:15.193390+00:00 heroku[sneakers.1]: State changed from starting to up
2018-07-02T14:26:25.540455+00:00 app[sneakers.1]: 2018-07-02T14:26:25Z p-4 t-6into WARN: Loading runner configuration...
2018-07-02T14:26:25.541305+00:00 app[sneakers.1]: 2018-07-02T14:26:25Z p-4 t-6into INFO: New configuration: #<Sneakers::Configuration:0x000000000668a140 @hash={:error_reporters=>[#<Sneakers::ErrorReporter::DefaultLogger:0x00000000039c1b90>], :runner_config_file=>nil, :metrics=>#<Sneakers::Metrics::NewrelicMetrics:0x00000000061cfba0>, :daemonize=>true, :start_worker_delay=>0.2, :workers=>1, :log=>#<IO:<STDOUT>>, :pid_path=>"sneakers.pid", :amqp_heartbeat=>30, :timeout_job_after=>5, :prefetch=>10, :threads=>1, :share_threads=>false, :ack=>true, :heartbeat=>2, :hooks=>{}, :exchange=>"core.exchange", :exchange_options=>{:type=>:direct, :durable=>true, :auto_delete=>false, :arguments=>{}}, :queue_options=>{:durable=>true, :auto_delete=>false, :exclusive=>false, :arguments=>{}}, :amqp=>"amqp:/<redacted>@curious-scabious-53.bigwig.lshift.net:10614/HT-gpx7iVZkl", :vhost=>"HT-gpx7iVZkl", :handler=>Sneakers::Handlers::Oneshot, :logger=>#<ServerEngine::DaemonLogger:0x00000000061f2d08 @rotate_age=5, @rotate_size=1048576, @logdev_class=Logger::LogDevice, @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x00000000061f2b50 @datetime_format=nil>, @formatter=Sneakers::Support::ProductionFormatter, @logdev=#<IO:<STDOUT>>>, :worker_type=>"process", :worker_classes=>[ReceiverRequestsWorker, SystemUserWorker], :log_stdout=>false, :log_stderr=>false}>
2018-07-02T14:26:25.574366+00:00 app[sneakers.1]: 2018-07-02T14:26:25Z p-20 t-6into WARN: Loading runner configuration...
2018-07-02T14:26:25.575968+00:00 app[sneakers.1]: 2018-07-02T14:26:25Z p-20 t-6into INFO: New configuration: #<Sneakers::Configuration:0x00000000065663e0 @hash={:error_reporters=>[#<Sneakers::ErrorReporter::DefaultLogger:0x00000000039c1b90>], :runner_config_file=>nil, :metrics=>#<Sneakers::Metrics::NewrelicMetrics:0x00000000061cfba0>, :daemonize=>true, :start_worker_delay=>0.2, :workers=>1, :log=>#<IO:<STDOUT>>, :pid_path=>"sneakers.pid", :amqp_heartbeat=>30, :timeout_job_after=>5, :prefetch=>10, :threads=>1, :share_threads=>false, :ack=>true, :heartbeat=>2, :hooks=>{}, :exchange=>"core.exchange", :exchange_options=>{:type=>:direct, :durable=>true, :auto_delete=>false, :arguments=>{}}, :queue_options=>{:durable=>true, :auto_delete=>false, :exclusive=>false, :arguments=>{}}, :amqp=>"amqp:/<redacted>@curious-scabious-53.bigwig.lshift.net:10614/HT-gpx7iVZkl", :vhost=>"HT-gpx7iVZkl", :handler=>Sneakers::Handlers::Oneshot, :logger=>#<ServerEngine::DaemonLogger:0x00000000061f2d08 @rotate_age=5, @rotate_size=1048576, @logdev_class=Logger::LogDevice, @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x00000000061f2b50 @datetime_format=nil>, @formatter=Sneakers::Support::ProductionFormatter, @logdev=#<IO:<STDOUT>>>, :worker_type=>"process", :worker_classes=>[ReceiverRequestsWorker, SystemUserWorker], :log_stdout=>false, :log_stderr=>false}>
2018-07-02T14:26:25.582599+00:00 app[sneakers.1]: 2018-07-02T14:26:25Z p-20 t-6into WARN: Loading runner configuration...
2018-07-02T14:26:25.583203+00:00 app[sneakers.1]: 2018-07-02T14:26:25Z p-20 t-6into INFO: New configuration: #<Sneakers::Configuration:0x000000000655e730 @hash={:error_reporters=>[#<Sneakers::ErrorReporter::DefaultLogger:0x00000000039c1b90>], :runner_config_file=>nil, :metrics=>#<Sneakers::Metrics::NewrelicMetrics:0x00000000061cfba0>, :daemonize=>true, :start_worker_delay=>0.2, :workers=>1, :log=>#<IO:<STDOUT>>, :pid_path=>"sneakers.pid", :amqp_heartbeat=>30, :timeout_job_after=>5, :prefetch=>10, :threads=>1, :share_threads=>false, :ack=>true, :heartbeat=>2, :hooks=>{}, :exchange=>"core.exchange", :exchange_options=>{:type=>:direct, :durable=>true, :auto_delete=>false, :arguments=>{}}, :queue_options=>{:durable=>true, :auto_delete=>false, :exclusive=>false, :arguments=>{}}, :amqp=>"amqp:/<redacted>@curious-scabious-53.bigwig.lshift.net:10614/HT-gpx7iVZkl", :vhost=>"HT-gpx7iVZkl", :handler=>Sneakers::Handlers::Oneshot, :logger=>#<ServerEngine::DaemonLogger:0x00000000061f2d08 @rotate_age=5, @rotate_size=1048576, @logdev_class=Logger::LogDevice, @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x00000000061f2b50 @datetime_format=nil>, @formatter=Sneakers::Support::ProductionFormatter, @logdev=#<IO:<STDOUT>>>, :worker_type=>"process", :worker_classes=>[ReceiverRequestsWorker, SystemUserWorker], :log_stdout=>false, :log_stderr=>false}>
2018-07-02T14:26:26.430795+00:00 heroku[sneakers.1]: Process exited with status 0
2018-07-02T14:26:26.453618+00:00 heroku[sneakers.1]: State changed from up to crashed