微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

没有这样的文件或目录 – 连接2“/ tmp / puma-status-1439451994589-14316”

我想通过与Puma和Nginx的Capistrano部署我的铁轨。 我为Pumaconfiguration了deploy.rb,并在gem文件添加了所需的gem。

我能够运行初始部署命令作为“帽生产部署:初始”,并能够访问我的Rails应用程序,如下所述。

但是当我想部署一些新的更改或重新启动美洲狮它失败,并给出了这个错误

的Gemfile:

Rails + Puma + Nginx每隔几天Bad Gateway 502

呈现HTML后的Puma“终止超时工作者”

发生未处理的低级别错误。 应用程序日志可能有详细信息

没有Nginx的Puma – 同一个IP:PORT上的多个ruby应用程序

Nginx在本地将Puma作为Rails应用程序与Puma一起作为OS X的开发环境

gem 'capistrano','~> 3.4.0' gem 'capistrano-rvm',require: false gem 'capistrano-rails',require: false gem 'capistrano-bundler',require: false gem 'capistrano3-puma',require: false # gem 'capistrano-passenger',require: false gem 'capistrano-ext',require: false gem 'capistrano-faster-assets','~> 1.0.2'

Capfile:

# Load DSL and set up stages require 'capistrano/setup' # Include default deployment tasks require 'capistrano/deploy' require 'capistrano/rails' require 'capistrano/bundler' require 'capistrano/rails/assets' require 'capistrano/rails/migrations' require 'capistrano/faster_assets' require 'capistrano/rvm' require 'capistrano/puma' require 'capistrano/puma/workers' require 'capistrano/puma/Nginx' Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

deploy.rb

# Puma Server Configuration set :puma_threads,[4,16] set :puma_workers,1 # Don't change these unless you kNow what you're doing set :pty,true set :use_sudo,false set :puma_bind,"unix://#{shared_path}/tmp/sockets/puma.sock" # set :puma_conf,"#{shared_path}/puma.rb" 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 :puma_preload_app,true set :puma_worker_timeout,nil set :puma_init_active_record,true 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/capistrano` puts "WARNING: HEAD is not the same as origin/capistrano" 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

我也使用下面的命令为Puma和Nginx生成模板如下。

rails g capistrano:Nginx_puma:config

我已经运行下面的命令来部署我的rails到EC2实例(与Ubuntu)

cap production deploy:check cap production puma:config cap production puma:Nginx_config cap production deploy:initial

现在,我想用下面的代码部署一些更改。

cap production deploy

但是我得到如下错误

(Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: bundle exit status: 1 bundle stdout: No such file or directory - connect(2) for "/tmp/puma-status-1439451994589-14316" bundle stderr: nothing written SSHKit::Command::Failed: bundle exit status: 1 bundle stdout: No such file or directory - connect(2) for "/tmp/puma-status-1439451994589-14316" bundle stderr: nothing written Tasks: TOP => deploy:restart (See full trace by running task with --trace)

请帮忙! 谢谢

铁轨美洲狮 – 命令没有configuration文件错误日志的path?

Rails / Nginx / Capistrano / Puma:(111:Connection refused)连接上游

如何获得与Puma和Capistrano部署的Rails应用程序重新启动

在Puma,rails,Nginx上设置一个rails应用程序一切正在运行,但Nginx发送错误

rails 5,Nginx在WebSocket握手期间出错:意外的响应码:404

我找到了一个解决方法解决这个问题。 只需将下面的代码片段添加到您的deploy.rb文件中。 它会覆盖美洲狮重启任务。

Rake::Task["puma:restart"].clear_actions namespace :puma do task :restart do on roles(:all) do execute "RACK_ENV=#{fetch(:rails_env)} #{fetch(:rvm_binary)} #{fetch(:rvm_ruby_version)} do pumactl -S #{shared_path}/tmp/pids/puma.state restart" end end end

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐