2012-05-28 4 views
2

하나님 께서 resque를 다시 시작하게하는 방법을 알아내는 데 어려움이 있습니다.God resque start가 "서버를 사용할 수 없습니다."라고 말합니다.

우분투 10.04.3 LTS Linode 슬라이스에 레일 3.2.2 스택이 있습니다. 실행 시스템 Ruby 1.9.3-p194 (RVM 없음). 위의

CONF_DIR=/etc/god 
GOD_BIN=/var/www/myapp.com/shared/bundle/ruby/1.9.1/bin/god 
RUBY_BIN=/usr/local/bin/ruby 
RETVAL=0 

# Go no further if config directory is missing. 
[ -d "$CONF_DIR" ] || exit 0 

case "$1" in 
    start) 
     # Create pid directory 
     $RUBY_BIN $GOD_BIN -c $CONF_DIR/master.conf 
     RETVAL=$? 
    ;; 
    stop) 
     $RUBY_BIN $GOD_BIN terminate 
     RETVAL=$? 
    ;; 
    restart) 
     $RUBY_BIN $GOD_BIN terminate 
     $RUBY_BIN $GOD_BIN -c $CONF_DIR/master.conf 
     RETVAL=$? 
    ;; 
    status) 
     $RUBY_BIN $GOD_BIN status 
     RETVAL=$? 
    ;; 
    *) 
     echo "Usage: god {start|stop|restart|status}" 
     exit 1 
    ;; 
esac 

exit $RETVAL 

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 

에서

포함 /etc/init.d/god-service에서 하나님있는 init.d 서비스가있다 deploy.rb 나는 재 장전 할 수있다. 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) 

I 시스템 보석에 god를 설치하고 god-service에서 가리키는 시도 :

GOD_BIN=/usr/local/bin/god 

그러나 god start rescue은 동일한 오류를 제공합니다. 그래서 그 아마 권한 문제는, 내 생각, 아마도있는 init.d 서비스가 root 하나님 소유하고 있다는 사실과 관련이 실행

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

을 :

그러나, 나는 수행하여 서비스를 시작할 수 있습니다 번들에서 사용자 deploy에 의해

이 문제를 해결하는 가장 좋은 방법은 무엇입니까?

+0

을 내가 같은 문제에 봉착했습니다. 당신이 그것을 해결할 수 있었습니까? – haider

+0

나는 불행히도, 지금은 하나님없이 서비스를 실행하고 있습니다. 기회가 생기면 Bluepill을 살펴볼 것입니다. –

+0

같은 문제는 누구나 해결책을 찾았습니까? – Rubytastic

답변

-2

이것은 구성 파일의 문제입니다.이 파일을 모두 확인해보세요.이 파일을 포함하면이 오류가 발생하지 않습니다. 나는 내 것을 확인하고 나중에 몇 가지 오류를 수정하여 완벽하게 작동했습니다!

+1

정확히 바뀌 었습니까? –

+0

@Rubytastic 당신은 당신의 대답을 정교하게 해석 할 수 있습니까? –

+0

구성 파일의 구문에 오류가 있어야한다는 구문 만 확인하면됩니다. 제 경우에는이 문제가 해결되었습니다. 이후 신에서 전환. – Rubytastic

관련 문제