2013-02-07 5 views
0

나는 God을 처음 사용합니다. 난 God을 사용하여 내 레일 어플리케이션이 실행되는 프로세스 인 unicorn을 모니터하려고합니다.하나님을 사용하여 레일을 유니콘으로 모니터하지만 권한 오류

여기 나의 하나님 파일입니다 :

rails_env = ENV["RAILS_ENV"] 
APP_ROOT = '/home/deployer/deploy/myproject' 
RAILS_ROOT = "#{APP_ROOT}/current" 

God.watch do |w| 
    w.name = "myproject" 
    w.interval = 30.seconds 
    w.dir = RAILS_ROOT 

    w.start = "cd #{RAILS_ROOT} && bundle exec unicorn_rails -E #{rails_env} -C#{RAILS_ROOT}/config/unicorn.rb -D" 
    w.stop = "kill -s QUIT `cat #{RAILS_ROOT}/tmp/pids/unicorn.pid`" 
    w.restart = "kill -s USR2 `cat #{RAILS_ROOT}/tmp/pids/unicorn.pid`" 

    w.start_grace = 20.seconds 
    w.restart_grace = 20.seconds 
    w.pid_file = "#{RAILS_ROOT}/tmp/pids/unicorn.pid" 
    w.log = "#{RAILS_ROOT}/log/unicorn.god.log" 

    w.uid = 'deployer' 
    w.gid = 'staff' 

    w.behavior(:clean_pid_file) 

    w.start_if do |start| 
    start.condition(:process_running) do |c| 
     c.interval = 5.seconds 
     c.running = false 
    end 
    end 

    w.restart_if do |restart| 
    restart.condition(:memory_usage) do |c| 
     c.above = 300.megabytes 
     c.times = [3, 5] # 3 out of 5 intervals 
    end 

    restart.condition(:cpu_usage) do |c| 
     c.above = 50.percent 
     c.times = 5 
end 

끝 끝

하지만 설정 파일이 god -c config/unicorn.god -D으로 유효한 경우 I는 테스트 할-실행을 건조 할 때, 다음과 같은 에러가 발생합니다

$ god -c config/unicorn.god -D 
I [2013-02-07 23:51:23] INFO: Loading config/unicorn.god 
I [2013-02-07 23:51:23] INFO: Syslog enabled. 
I [2013-02-07 23:51:23] INFO: Using pid file directory: /home/deployer/.god/pids 
E [2013-02-07 23:51:23] ERROR: PID file directory '/home/deployer/deploy/myproject/current/tmp/pids' is not writable by deployer 
E [2013-02-07 23:51:23] ERROR: Log directory '/home/deployer/deploy/myproject/current/log' is not writable by deployer 
E [2013-02-07 23:51:23] ERROR: Task 'myproject' is not valid (see above) 

실제로 사용자와 함께이 두 개의 dir에게 허가가 있습니다 deployer :

~/deploy/myproject/current$ ls -l 
lrwxrwxrwx 1 deployer staff 42 Feb 7 23:24 log -> /home/deployer/deploy/myproject/shared/log 

~/deploy/myproject/current/tmp$ ls -l 
lrwxrwxrwx 1 deployer staff 43 Feb 7 23:24 pids -> /home/deployer/deploy/myproject/shared/pids 

및 신 프로세스는 deployer에서 실행되는 : 왜 그

$ ps -ef | grep god 
deployer 381  1 5 00:20 pts/0 00:00:00 /usr/local/rvm/gems/[email protected]/bin/god 

입니까?

+0

해결책을 찾으셨습니까? 나도 똑같은 문제가있어. – Arkan

답변

1

비슷한 문제가있었습니다. w.gid 행을 삭제하면 정상적으로 작동하기 시작했습니다.