[英]Puma: Status file not found
I am trying to deploy a Rails application with Capistrano. 我正在尝试使用Capistrano部署Rails应用程序。 I had an issue of bundler: command not found: pumactl
, which I seem to have resolved by adding the puma gem to my Gemfile outside of the :development
group. 我遇到了一个bundler: command not found: pumactl
问题bundler: command not found: pumactl
,我似乎已经解决了这一问题,方法是在:development
组之外将puma gem添加到我的Gemfile中。
Gemfile 的Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sass-rails', '~> 5.0'
gem 'semantic-ui-sass', github: 'doabit/semantic-ui-sass'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'mongoid'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'prawn-rails', '0.1.1'
gem 'fastimage', '1.6.6'
gem 'mini_magick', '4.0.4'
gem 'carrierwave', '0.10.0'
gem 'puma', '2.11.1'
group :development, :test do
gem 'capistrano', '3.3.5'
gem 'capistrano-rvm', '0.1.2'
gem 'capistrano-rails', '1.1.2'
gem 'capistrano-bundler', '1.1.4'
gem 'capistrano3-puma', '0.8.5'
gem 'web-console', '~> 2.0'
gem 'spring'
end
Now when I attempt to cap production deploy:initial --trace
(or cap production deploy --trace
), I get the following output: 现在,当我尝试cap production deploy:initial --trace
(或cap production deploy --trace
)时,得到以下输出:
...
INFO [7314ca0d] Running ~/.rvm/bin/rvm default do bundle exec pumactl -S /home/myuser/apps/myapp/shared/tmp/pids/puma.state restart as myuser@mydomain.com
DEBUG [7314ca0d] Command: cd /home/myuser/apps/myapp/releases/20150213082155 && ~/.rvm/bin/rvm default do bundle exec pumactl -S /home/myuser/apps/myapp/shared/tmp/pids/puma.state restart
DEBUG [7314ca0d] Status file not found: /home/myuser/apps/myapp/shared/tmp/pids/puma.state
DEBUG [7314ca0d]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as myuser@mydomain.com: Exception while executing as myuser@mydomain.com: Exception while executing as myuser@mydomain.com: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: Nothing written
...
I was attempting to follow this tutorial . 我试图遵循本教程 。
Capfile Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/puma'
require 'capistrano/rvm'
require 'capistrano/rails'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/bundler'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
config/deploy.rb 配置/ deploy.rb
lock '3.3.5'
set :user, 'myuser'
set :application, 'myapp'
set :repo_url, 'git@github.com:myuser/myapp-rails.git'
set :scm, :git
set :branch, 'master'
set :keep_releases, 2
set :format, :pretty
set :log_level, :debug
set :pty, true
set :use_sudo, false
set :stage, :production
set :deploy_via, :remote_cache
set :deploy_to, "/home/#{fetch(:user)}/apps/#{fetch(:application)}"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log, "#{release_path}/log/puma.access.log"
set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) }
set :puma_preload_app, true
set :puma_worker_timeout, nil
set :puma_init_active_record, false
## Linked Files & Directories (Default None):
# set :linked_files, %w{config/database.yml}
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
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 "Make sure local git is in sync with remote."
task :check_revision do
on roles(:app) do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
end
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
before :starting, :check_revision
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
Any suggestions? 有什么建议么?
This problem usually results from previously attempting to use a different gem capistrano-puma
as opposed to capistrano3-puma
. 此问题通常是由先前尝试使用与capistrano-puma
相对的另一种宝石capistrano3-puma
。 See this Github issue . 请参阅此Github问题 。
In my case, I had to gem uninstall capistrano-puma
even though it was not included in my Gemfile. 就我而言,即使我的Gemfile中未包含gem uninstall capistrano-puma
,我也必须将其gem uninstall capistrano-puma
。 Thanks to @seuros for the help. 感谢@seuros的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.