【发布时间】:2018-01-24 13:09:11
【问题描述】:
我正在使用 Capistrano 3 部署我的 rails 应用程序,并从 Puma gem 中收到此错误:
bundler: failed to load command: puma (/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/bin/puma)
Errno::ENOENT: No such file or directory - connect(2) for home/ubuntu/GlucoMeDDC/shared/tmp/sockets/puma.sock
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:367:in `initialize'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:367:in `new'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:367:in `add_unix_listener'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:141:in `block in parse'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:88:in `each'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:88:in `parse'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/runner.rb:144:in `load_and_bind'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:397:in `run'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/launcher.rb:183:in `run'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/cli.rb:77:in `run'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/bin/puma:10:in `<top (required)>'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/bin/puma:22:in `load'
/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/bin/puma:22:in `<top (required)>'
puma stderr: Nothing written
我在这里寻找答案,但没有一个对我有帮助。
例如,如果我这样做 puma:config 它将起作用,但使用 DEFAULT Puma 配置,而不是从我的 puma.rb 文件中获取,即使我添加了 conf 指向给它。
这是我的 deploy.rb:
lock '3.10.1'
set :application, 'GlucoMeDDC'
set :repo_url, 'git@github.com:user/GlucoMeDDC.git' # Edit this to match your repository
set :branch, ENV['BRANCH'] if ENV['BRANCH']
set :user, 'ubuntu'
set :deploy_to, '/home/ubuntu/GlucoMeDDC'
set :pty, true
set :linked_files, %w{config/application.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
set :keep_releases, 5
append :rvm_map_bins, 'puma', 'pumactl'
set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.4.1' # Edit this if you are using MRI Ruby
# set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
set :puma_conf, "#{current_path}/config/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_access.log"
set :puma_error_log, "#{shared_path}/log/puma_error.log"
namespace :puma do
desc 'Create Directories for Puma Pids and Socket'
task :make_dirs do
on roles(:app) do
execute "mkdir #{shared_path}/tmp/sockets -p"
execute "mkdir #{shared_path}/tmp/pids -p"
end
end
before :start, :make_dirs
end
namespace :deploy do
desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke! 'puma:restart'
end
end
after :finishing, :compile_assets
after :finishing, :cleanup
after :finishing, :restart
end
# ps aux | grep puma # Get puma pid
# kill -s SIGUSR2 pid # Restart puma
# kill -s SIGTERM pid # Stop puma
任何提示我还能做什么?
【问题讨论】:
标签: ruby-on-rails capistrano puma capistrano3