tender
Ruby CoffeeScript JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db
doc
lib
log
public
script
test
vendor
.gitignore
Gemfile
Gemfile.lock
README.rdoc
Rakefile
config.ru
tender.sublime-project
tender.sublime-workspace

README.rdoc

Welcome to Rails

# config/jobs.rb with Rails require File.expand_path(“../environment”, __FILE__)

job “city.fetch_name” do |args|

City.find(args["id"]).fetch_name

end

run with: god -c config/god.rb RAILS_ROOT = File.expand_path(“../..”, __FILE__)

God.watch do |w|

w.name = "anycity-worker"
w.interval = 30.seconds
w.env = {"RAILS_ENV" => "production"}
w.start = "/usr/bin/stalk #{RAILS_ROOT}/config/jobs.rb"
w.log = "#{RAILS_ROOT}/log/stalker.log"

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

w.restart_if do |restart|
  restart.condition(:memory_usage) do |c|
    c.above = 50.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
end

w.lifecycle do |on|
  on.condition(:flapping) do |c|
    c.to_state = [:start, :restart]
    c.times = 5
    c.within = 5.minute
    c.transition = :unmonitored
    c.retry_in = 10.minutes
    c.retry_times = 5
    c.retry_within = 2.hours
  end
end

end