I can't get runit to work with chef and puma, it might be a runit issue but I'm not sure
-
19-10-2022 - |
Question
Here is the runit script:
#!/bin/sh
cd <%= @options[:release_path] %>
exec 2>&1
exec chpst -u <%= @options[:owner] %>:<%= @options[:group] %> <%= @options[:puma_command] %> -C config/puma.rb
Here is the runit log script:
#!/bin/sh
exec chpst -u root:root svlogd -tt <%= @options[:log_dir] %>
Here is how I'm populating those variables in chef:
deploy_path = "/home/#{node[:myapp][:user]}/#{cookbook_name}"
shared_path = "#{deploy_path}/shared"
rvm_context = '/usr/local/rvm/bin/rvm 2.1.0 do'
deploy_revision 'path/to/my/service' do
restart_command do
runit_service 'puma' do
options(
:release_path => "#{deploy_path}/current",
:owner => 'foo',
:group => 'foo',
:puma_command => "#{rvm_context} bundle exec puma",
:log_dir => "#{shared_path}/log"
)
end
end
end
Chef completes the run successfully but the service is not started.
If I run this command manually then I get a timeout error.
chef@cheftests:/etc/sv/puma$ sudo sv start puma
timeout: down: puma: 0s, normally up, want up
If I run the exact command that the puma_command
populates the runit script with then puma successfully starts, at this point it's completely bypassing runit but I know for sure the puma script is in working order.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow