Heroku上的Ruby守护进程 [英] Ruby daemons on Heroku
问题描述
我试图在Heroku上执行ruby daemon framework-less 应用程序,但在尝试执行worker之后崩溃:
heroku [worker.1]:状态从崩溃转变为开始
heroku [worker.1]:使用命令`bundle exec rake twitter:start`启动进程
heroku [worker.1]:状态从开始改为
heroku [worker.1]:进程退出状态为0
heroku [worker.1]:状态从up改为崩溃
该应用程序基本上通过一堆API收集数据,并将其保存在远程MongoHQ实例中。
rake任务是:
$ $ $ $ $ $ $ $ dir_path = File.expand_path('../ ',__FILE__)
命名空间:twitter do
desc'启动Twitter守护进程'
任务:开始执行
exec#{dir_path} / bin / autana start
结束
...
结束
Procfile非常简单: 执行守护进程的代码如下: 有什么想法? 所以,这是一个MongoDB错误。数据没有正确关联。进入控制台并更改文档后,所有内容均按预期工作。 I'm trying to execute a ruby daemon framework-less app on Heroku, but it crash after trying to execute the worker: The app basically collects data, through a bunch of APIs, and saves it on a remote MongoHQ instance. The rake tasks are: The Procfile is very simple: The code that executes the daemon is the following: Any ideas? So, it was a MongoDB error. Data was not properly associated. After entering the console, and changed the document, everything worked as expected. 这篇关于Heroku上的Ruby守护进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! worker:bundle exec rake twitter:start $ c
$ b
#!/ usr / bin / env ruby
require'daemons'
require File.expand_path('../../ lib / autana',__FILE__)
damons.run_proc('autana',multiple:true,no_pidfiles:true)做
client = Autana :: Client :: Twitter.new
client.collect
end
heroku[worker.1]: State changed from crashed to starting
heroku[worker.1]: Starting process with command `bundle exec rake twitter:start`
heroku[worker.1]: State changed from starting to up
heroku[worker.1]: Process exited with status 0
heroku[worker.1]: State changed from up to crashed
dir_path = File.expand_path('../', __FILE__)
namespace :twitter do
desc 'Start Twitter daemon'
task :start do
exec "#{dir_path}/bin/autana start"
end
...
end
worker: bundle exec rake twitter:start
#!/usr/bin/env ruby
require 'daemons'
require File.expand_path('../../lib/autana', __FILE__)
Daemons.run_proc('autana', multiple: true, no_pidfiles: true) do
client = Autana::Client::Twitter.new
client.collect
end