Trying to start prosody with god but it fails, how to solve?

128 views
Skip to first unread message

rubybox

unread,
Sep 6, 2012, 3:24:04 AM9/6/12
to god...@googlegroups.com

Hi everyone im trying to make both elasticsearch and prosody be monitored with God both fail to start.
Resuting in 

I [2012-09-06 09:22:18]  INFO: Loading elasticsearch.god
I [2012-09-06 09:22:18]  INFO: Syslog enabled.
I [2012-09-06 09:22:18]  INFO: Using pid file directory: /var/run/god
I [2012-09-06 09:22:18]  INFO: Started on drbunix:///tmp/god.17165.sock
I [2012-09-06 09:22:18]  INFO: elasticsearch move 'unmonitored' to 'init'
I [2012-09-06 09:22:18]  INFO: elasticsearch moved 'unmonitored' to 'init'
I [2012-09-06 09:22:18]  INFO: elasticsearch [trigger] process is not running (ProcessRunning)
I [2012-09-06 09:22:18]  INFO: elasticsearch move 'init' to 'start'
I [2012-09-06 09:22:18]  INFO: elasticsearch start: service elasticsearch start
I [2012-09-06 09:22:28]  INFO: elasticsearch moved 'init' to 'start'
I [2012-09-06 09:22:28]  INFO: elasticsearch [ok] process is not running (ProcessRunning)
I [2012-09-06 09:22:28]  INFO: elasticsearch [ok] tries within bounds [1/5] (Tries)
ETC


This is my prosody.god.rb file the rails root env is just path to my rails app wich is included in my app but could be easily removed.
What am I missing here that it won't start?

God.watch do |w|

  w.name = "prosody"
  w.interval = 30.seconds
  w.start = "service prosody start"
  w.stop = "service prosody stop"
  w.restart = "#{w.stop} && #{w.start}"
  w.start_grace = 10.seconds
  w.restart_grace = 10.seconds
  # w.log = File.join(ENV['RAILS_ROOT'], 'log', 'cumulus.log')

  # 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


Chris Cosby

unread,
Sep 6, 2012, 9:45:47 AM9/6/12
to god...@googlegroups.com
The process you're trying to start is the "service" command, which exits as soon as the real daemon starts, so God doesn't have a job to do. If you want to monitor something started by service, you'll need to add w.pid_file to point to the same place that your daemon pid file is written to watch that pid. I haven't tried it, but it should JustWork.



--
You received this message because you are subscribed to the Google Groups "god.rb" group.
To view this discussion on the web visit https://groups.google.com/d/msg/god-rb/-/SkEHYGzfoBIJ.
To post to this group, send email to god...@googlegroups.com.
To unsubscribe from this group, send email to god-rb+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/god-rb?hl=en.



--
chris -at- microcozm -dot- net
== If you wish to make an apple pie from scratch, you must first invent the universe. - Carl Sagan
=== My crypto keys: http://www.microcozm.net/~ccosby/keys/

Donovan Bray

unread,
Sep 13, 2012, 1:26:27 AM9/13/12
to god...@googlegroups.com
you may not want to use upstart scripts if you want god  to watch it for the reasons Chris gave you. Look at the upstart script and move the commands to start and stop it to the god config instead of using the upstart script. On the other hand if you just add 'respawn' to the upstart script if it isn't already there and don't watch it with god the only thing you are missing is the notification of the events.

On my systems, I use upstart to watch and respawn god, and I use god to watch and restart everything else because we like the campfire and email notifications when something is acting wonky.

if you paste the upstart script most likely: /etc/init/prosody.conf

we may be able to advise how to convert it to a native god config.

rubybox

unread,
Sep 17, 2012, 2:52:03 PM9/17/12
to god...@googlegroups.com, donn...@donovanbray.com
Thx guys have to look into this, is on my todo for very soon
Reply all
Reply to author
Forward
0 new messages