class SyncWrap::BundledIyyovDaemon
Provision a source/bundle installed, Iyyov launched and monitored jruby daemon using a standard set of conventions. Can be used directly in the common case, or sub-classed as needed.
Two :sync_paths files are searched for deployment: a config.rb and a jobs.d/<name>.rb. If concrete or .erb variants of these are not found than an (empty) default/config.rb and a generic default/bundled_daemon.rb.erb are used. Again, these will work in the common case.
Attributes
instance[RW]
An optional secondary instance name, useful if running more than one of 'name' on a host. (Default: nil)
name[W]
The daemon process name. (Default: SyncWrap::SourceTree#remote_dir)
Public Class Methods
new( opts = {} )
click to toggle source
Calls superclass method
SyncWrap::ChangeKeyListener.new
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 51 def initialize( opts = {} ) @name = nil @instance = nil super end
Public Instance Methods
install()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 58 def install standard_install end
Protected Instance Methods
config_source()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 112 def config_source sconf = "var/#{name_instance}/config.rb" unless find_source( sconf ) sconf = "var/#{name}/config.rb" unless find_source( sconf ) sconf = 'var/iyyov/default/config.rb' end end sconf end
daemon_service_dir()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 89 def daemon_service_dir service_dir( name, instance ) end
exe_path()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 93 def exe_path File.join( daemon_service_dir, 'init', name ) end
job_source()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 101 def job_source sjob = "var/iyyov/jobs.d/#{name_instance}.rb" unless find_source( sjob ) sjob = "var/iyyov/jobs.d/#{name}.rb" unless find_source( sjob ) sjob = "var/iyyov/default/bundled_daemon.rb.erb" end end sjob end
name()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 41 def name @name || remote_dir end
name_instance()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 97 def name_instance [ name, instance ].compact.join( '-' ) end
rput_service_config()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 85 def rput_service_config rput( config_source, "#{daemon_service_dir}/config.rb", user: run_user ) end
standard_install()
click to toggle source
# File lib/syncwrap/components/bundled_iyyov_daemon.rb, line 64 def standard_install conf_changes = rput_service_config # The job_source may contain more than just this daemon # (i.e. additional tasks, etc.) Even if this is the # default/daemon.rb.erb, it might have just been changed to # that. So go ahead an rput in any case. job_changes = rput( job_source, "#{iyyov_run_dir}/jobs.d/#{name_instance}.rb", user: run_user ) job_changes += iyyov_install_jobs if ( change_key_changes? || !conf_changes.empty? || state[ :hashdot_updated ] || state[ :imaging ] ) rudo( "kill $(< #{daemon_service_dir}/#{name}.pid ) || true" ) end conf_changes + job_changes end