bin/yohoushiからunicorn, serverengineを起動する直前まで
bin/yohoushi
|
v
lib/yohoushi/cli.rb
options[:config] = File.expand_path('config/yohoushi.god', ENV['RAILS_ROOT']) # yohoushi custom
require File.expand_path('vendor/extensions/god/cli/run', ENV['RAILS_ROOT']) # yohoushi custom
options = {
daemonize: false,
port: 17165,
syslog: true,
events: true,
config: "config/yohoushi.god",
}
God::CLI::Run.new(options)
#dispatch
#run_in_front
#default_run
#load_config
#load_god_file('config/yohoushi.god')
load 'config/yohoushi.god'
|
v
config/yohoushi.god
God.load "config/unicorn.god" https://github.com/mojombo/god/blob/master/lib/god.rb#L641
Kernel.load 'config/unicorn.god' https://github.com/mojombo/god/blob/master/lib/god.rb#L643
God.load "serverengine.god"
Kernel.load 'config/serverengine.god'
config/unicorn.god
God.watch # God配下へ登録され起動される
w.start = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} #{BIN_PATH}/unicorn -c #{RAILS_ROOT}/config/unicorn.conf -E #{RAILS_ENV} -D"
config/serverengine.god
God.watch
w.start = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} #{BIN_PATH}/serverengine start -p #{PID_DIR}/serverengine.pid -d"
bin/serverengine start -p tmp/serverengine.pid -d
|
v
lib/serverengine/cli.rb
ServerEngine::CLI.start(ARGV)
ServerEngine::CLI#initialize
@options = {
"config" => 'config/serverengine.conf',
"daemonize" => true,
"module_name" => "Worker",
"interval" => 60,
...# see all params in config/serverengine.conf
}
ServerEngine::CLI#start
load_enviroment(nil) # load rails
opts = {
daemonize: true,
interval: 60,
}
ServerEngine.create(nil, Worker, opts).run
|
v
app/worker/worker.rb
#initialize
@processor = Processor.new(logger, {daemonize:true, interval: 60})
#reload
#run
@processor.process
|
v
app/woroker/processor.rb
#initialize
@config = {daemonize:true, interval: 60}
#process
### 実際の処理
- GFからグラフを取得
- YohoushiのDBにグラフパス格納