Welcome Guest | Login

Any word on using God ? Like maybe a local copy ?

from earlier threadhttp://www.hostingrails.com/forums/rails_coding_thread/616

I have been old that I should get God running asap and not rely on cron or bash, that god is key to a sites survival. So I am back here wondering what sort of action I should take, or if progress has been made in configuring God on hosting rails

One note is where it is writing to as a whole for it's pid files, as there is a separate config to denote where it writes to
God.pid_file_directory = '/home/tom/pids'

God.watch do |w|
 # watch with no pid_file attribute set
end

So maybe that would help in keeping it local, till then I am trying start it and run it from my vendors/plugin dir.

2007-10-22 04:25 PM

We've mixed results running GOD on  our shared servers and we're advising customers to stick to cron for now. We're looking into a global solution and thanks for your understanding and patience until we're able to come up with one.

2007-10-22 05:58 PM

This is a late reply but more of a headache now. The cron is not doing the job. The rate that client uploads to the site crashes the site far to fast now and it seems the cron does not pick up the mess.

here is the old script I found here and followed to the t. It would work in simulation testing but when I leave it to the real heavy duty world I come back the next day to a dead server and lots of angry people.

As a customer I need to know what other options I have besides cron if not God ?

Old script
#!/usr/local/bin/ruby
require "net/smtp"

username = "name"
application = "app"
rails_dir = "/home/#{username}/#{application}/"
ruby = "/usr/local/bin/ruby"
mongrel = "/usr/local/bin/mongrel_rails"
number_of_mongrels = 7
mongrel_port = ***
#number_of_runningdruby = 1

to_email = "fake@gmail.com"
from_email = "fake@gmail.com"
email_subject = "Mongrel Server Status"

def send_email(from, to, subject, message)
 msg = <<END_OF_MESSAGE
From: #{from}
To: #{to}
Subject: #{subject}

#{message}
END_OF_MESSAGE

      Net::SMTP.start('localhost') do |smtp|
              smtp.send_message msg, from, to
      end
end

# restart mongrel. need to chdir to app folder first
def restart_mongrels
 
end

Dir.chdir(rails_dir)

f = IO.popen("ps -edf | grep #{username} | grep '#{mongrel}' | grep -cv grep")
g = IO.popen("ps -edf | grep #{username} | grep 'upload' | grep -cv grep")

number_of_processes = f.readline.chomp.to_i
number_of_druby = g.readline.chomp.to_i

if number_of_processes == number_of_mongrels then
 # everything is OK
 message = Time.new.gmtime.to_s + "> #{number_of_mongrels} mongrels are running as expected."
 puts message   # print as well as email message
 #send_email(from_email, to_email, email_subject, message)
 
else
 puts Time.new.gmtime.to_s + " > Mongrels are not running.."  
 
 # kill existing mongrels (if any) then remove logs
 system("killall -usr1 mongrel_rails &> /dev/null")   # do not want to see output from this command
 system("rm log/mongrel.*.pid")
   
 # start new mongrel processes
 for number in  (0..number_of_mongrels-1)
   port_number = mongrel_port + number
   system("#{ruby} #{mongrel} restart -d -e production -p #{port_number} -P log/mongrel.#{port_number}.pid -c #{rails_dir} --user #{username} --group #{username}")
   puts "..started mongrel instance on port #{port_number}"
 end
 
 message = Time.new.gmtime.to_s + "> Mongrel was not running. It has now been started."
 puts message
 send_email(from_email, to_email, email_subject, message)
 restart_mongrels
 
 # if restarted, send restarted message
#  send_email(from_email, to_email, email_subject, message)
end









2007-10-31 06:46 AM

The cron should work.  What are you seeing in your mongrel log when it fails?  the solution is likely to move long-running tasks away from Mongrel to backgroundRB processes..are you already doing this?

Furthermore, we have been investigating a number of daemon monitoring options and once they are fully tested in shared environments we'll be implementing them.  

2007-10-31 07:28 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!