Skip to content

Instantly share code, notes, and snippets.

@timf
Created November 3, 2010 16:24
Show Gist options
  • Save timf/661299 to your computer and use it in GitHub Desktop.
Save timf/661299 to your computer and use it in GitHub Desktop.
node[:services].each do |service, service_spec|
service_config = "/home/#{node[:username]}/lcaarch/res/config/#{service}-ionservices.cfg"
template "#{service_config}" do
source "ionservices.cfg.erb"
owner "#{node[:username]}"
variables(:service_spec => service_spec)
end
logging_dir = "/home/#{node[:username]}/lcaarch/logs/#{service}"
directory "#{logging_dir}" do
owner "#{node[:username]}"
group "#{node[:username]}"
mode "0755"
end
logging_config = "#{logging_dir}/#{service}-logging.conf"
template "#{logging_config}" do
source "ionlogging.conf.erb"
owner "#{node[:username]}"
variables(:service_name => service)
end
bash "start-service" do
user node[:username]
environment({
"HOME" => "/home/#{node[:username]}",
"ION_ALTERNATE_LOGGING_CONF" => "#{logging_config}"
})
cwd "/home/#{node[:username]}/lcaarch"
code <<-EOH
if [ -f /opt/cei_environment ]; then
source /opt/cei_environment
fi
twistd --pidfile=#{service}-service.pid cc -n -h #{node[:capabilitycontainer][:broker]} --broker_heartbeat=#{node[:capabilitycontainer][:broker_heartbeat]} -a processes=#{service_config},sysname=#{node[:capabilitycontainer][:sysname]} #{node[:capabilitycontainer][:bootscript]}
EOH
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment