【发布时间】:2015-11-08 06:22:04
【问题描述】:
这个 rails 应用程序的 puma/runit 服务一直在运行,直到我尝试通过 chef 将 Sidekiq 3.5.3 gem 部署到我的应用程序中
在我的配方中,我通过 ruby_build 配方安装了 2.0.0p576
which ruby #gives me /usr/bin/ruby
/usr/bin/ruby -v #return 2.0.0p576
模板/默认/sv-myapp-run.erb
echo "$(ruby -e 'print RUBY_VERSION')" >> check_ruby.txt #returns 2.0.0
exec chpst -u root:root bundle exec puma --config config/puma.rb
在 runit 服务的日志中,我在下面收到此消息
2015-11-04_06:23:50.99541 /var/lib/gems/1.9.1/gems/sidekiq-3.5.3/lib/sidekiq.rb:3:in `<top (required)>': Sidekiq 3.5.3 does not support Ruby 1.9. (RuntimeError)
由于这不会在本地发生 - 我被引导相信这与 Chef 以及我如何在主机上设置 Ruby 有关
我还尝试安装 rvm ,清除系统 ruby 并确认默认(全局和本地)为 > 2.0 - 这些都没有任何影响。
我注意到 /usr/local/bin/puma 中的声明是
#!/usr/bin/env ruby1.9.1
我将其编辑为 ruby - 然后重新启动服务但没有更改。有没有办法可以强制 Puma 在 ruby +>2.0 下运行?
ruby_build_ruby '2.0.0-p576'
link "/usr/bin/ruby" do
to "/usr/local/ruby/2.0.0-p576/bin/ruby"
end
gem_package 'bundler' do
options '--no-ri --no-rdoc'
end
include_recipe "runit"
deploy_revision("/opt/deploy") do
revision "develop"
repository "removed"
user "root"
action :deploy
shallow_clone true
keep_releases 3
rollback_on_error true # remove release if callbacks failed
migrate true
migration_command "rake db:migrate"
before_migrate do
execute "bundle install" do
command "bundle install"
cwd "#{release_path}"
user "root"
end
end
#restart_command "rails server -b 0.0.0.0"
# disable default behavior
symlink_before_migrate.clear
create_dirs_before_symlink.clear
purge_before_symlink.clear
symlinks.clear
end
Ubuntu 14.04,捆绑器 1.10.6
谢谢!
【问题讨论】:
标签: ruby-on-rails chef-infra sidekiq puma