无法停止进程,在tmp / pids / thin.8080.pid中找不到PID(Thin :: PidFileNotFound)

时间:2016-02-10 18:39:20

标签: ruby-on-rails linux git capistrano capistrano3

我正从我的私人git存储库安装应用程序。我安装了所有依赖项,我正在使用Capistrano。我能够在我的本地机器上成功运行应用程序。我使用rails -v 3.2.14和ruby -v ruby​​ 1.9.3p362和linux服务器

当我正在运行时cap production deploy我收到错误

...... .... sftp upload complete * executing "cd /var/www/vhosts/..../apps/login/current && bundle exec thin -C /var/www/vhosts/....../apps/login/current/thin.yml -O restart" servers: ["......net"] [root@emerge126.mysitehosting.net] executing command ** [out :: root@........net] Stopping server on 127.0.0.1:8080 ... ** [out :: root@........net] /var/www/vhosts/......./apps/.../shared/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/daemonizing.rb:131:in 'send_signal': Can't stop process, no PID found in tmp/pids/thin.8080.pid (Thin::PidFileNotFound)

我的 deploy.rb 文件需要

'bundler/capistrano'
require 'capistrano/ext/multistage'
require 'capistrano-thin'

set :stages, ["staging", "production"]
set :default_stage, "production"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :ssh_options, {
 config: false
}

set :application, "myapp"
set :repository,  "https://........git"
set :scm, :git
set :deploy_via, :remote_cache
set :branch, 'master'
set :deploy_to, "/var/www/vhosts/......../apps/#{application}"


 set :keep_releases, 5
 set :use_sudo, false

 set :thin_servers, 1
 set :thin_port, 8081

 namespace :deploy do
    namespace :db do
      desc "Seed the database"
      task :seed, :roles => :db do
      # on_rollback { deploy.db.restore }
      run_remote_rake('db:seed')
      end
   end


  task :symlink_configs do
   run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
   run "ln -nfs #{shared_path}/config/auth.yml #{current_path}/config/auth.yml"
  end

end

 before "deploy:restart", "deploy:symlink_configs"
 after "deploy:update", "deploy:cleanup"

 def run_remote(cmd)
   run "cd #{current_path} && #{cmd}"
 end

 def run_remote_rake(task)
    rails_env = fetch(:rails_env, 'integration')
    run_remote("rake #{task} RAILS_ENV=#{rails_env}")
 end

我的 production.rb 文件

set :deploy_to, "/var/www/vhosts/....../apps/#    {application}"

server 'root@.......net', :web, :app, :db, :primary => true
set :thin_port, 8081
set :rails_env, 'production'

我需要一些帮助。它是一个多轨应用服务器。如果需要,请询问更多信息。由于网站安全,我还用....替换了网站和github网址。

1 个答案:

答案 0 :(得分:0)

您的服务器上没有运行精简进程,这就是您收到Can't stop process, no PID found错误的原因。我建议手动启动瘦身,以便您的部署脚本可以成功重启它。