2012-05-28 26 views
2

我无法弄清楚如何让上帝重新启动resque。上帝resque开始给“服务器不可用”

我在Ubuntu 10.04.3 LTS Linode切片上安装了Rails 3.2.2堆栈。它的运行系统是Ruby 1.9.3-p194(没有RVM)。

有在/etc/init.d/god-service包含神的init.d服务:

​​

master.conf在上面包含:

load "/var/www/myapp.com/current/config/resque.god" 

resque.god在上面包含:

APP_ROOT = "/var/www/myapp.com/current" 
God.log_file = "/var/www/myapp.com/shared/log/god.log" 


God.watch do |w| 
    w.name = 'resque' 
    w.interval = 30.seconds 
    w.dir = File.expand_path(File.join(File.dirname(__FILE__),'..')) 
    w.start = "RAILS_ENV=production bundle exec rake resque:work QUEUE=*" 
    w.uid = "deploy" 
    w.gid = "deploy" 

    w.start_grace = 10.seconds 
    w.log = File.expand_path(File.join(File.dirname(__FILE__), '..','log','resque-worker.log')) 

    # restart if memory gets too high 
    w.transition(:up, :restart) do |on| 
    on.condition(:memory_usage) do |c| 
     c.above = 200.megabytes 
     c.times = 2 
    end 
    end 

    # determine the state on startup 
    w.transition(:init, { true => :up, false => :start }) do |on| 
    on.condition(:process_running) do |c| 
     c.running = true 
    end 
    end 

    # determine when process has finished starting 
    w.transition([:start, :restart], :up) do |on| 
    on.condition(:process_running) do |c| 
     c.running = true 
     c.interval = 5.seconds 
    end 

    # failsafe 
    on.condition(:tries) do |c| 
     c.times = 5 
     c.transition = :start 
     c.interval = 5.seconds 
    end 
    end 

    # start if process is not running 
    w.transition(:up, :start) do |on| 
    on.condition(:process_running) do |c| 
     c.running = false 
    end 
    end 
end 

deploy.rb我有一个reload tas K:

task :reload_god_config do 
    run "god stop resque" 
    run "god load #{File.join(deploy_to, 'current', 'config', 'resque.god')}" 
    run "god start resque" 
end 

的问题是我是否部署或手动运行god (stop|start|restart|status) resque,我得到错误信息:

The server is not available (or you do not have permissions to access it) 

我尝试安装god系统宝石和指向它在god-service

GOD_BIN=/usr/local/bin/god 

但是god start rescue给出了相同的错误。

sudo /etc/init.d/god-service start 

所以它可能是一个权限问题,我认为,可能与该init.d中服务由root神拥有的事实运行:

不过,我可以做启动服务来自deploy用户的捆绑包。

解决此问题的最佳方法是什么?

+0

我有同样的问题。你能解决它吗? – haider

+0

不幸的是,我现在只是在没有上帝的情况下运行我的服务。当我有机会时,我会看看Bluepill。 –

+0

同样的问题任何人都找到了解决方案? – Rubytastic

回答

-2

好吧,这是你的配置文件的问题,检查他们所有的人+包括失败的地方扔给你这个错误。我检查了我的并修复了一些错误,之后它完美地工作了!

+1

你改变了什么? –

+0

@Rubytastic你能阐述一下你的答案吗? –

+0

只需检查语法,在配置文件的语法中必须有错误,那就是我的意思。在我的情况下,这解决了这个问题。自从从神切换。 – Rubytastic