capistrano-puma不会自动运行ec2服务器

我目前在我的ec2 ubuntu实例中使用capistrano-puma,capistrano3,nginx

我的Gemfile是这个

group :development gem 'capistrano', '~> 3.6' gem 'capistrano-bundler', '~> 1.3' gem 'capistrano-rails' gem 'capistrano-rvm' gem 'capistrano3-puma', github: "seuros/capistrano-puma" gem 'capistrano-rails-db' gem 'capistrano-rails-console' end 

Capfile

 require "capistrano/setup" require "capistrano/deploy" require "capistrano/scm/git" install_plugin Capistrano::SCM::Git require 'capistrano/bundler' require 'capistrano/rails' require 'capistrano/rvm' require 'capistrano/rails/migrations' require 'capistrano/rails/db' require 'capistrano/rails/console' require 'capistrano/puma' install_plugin Capistrano::Puma install_plugin Capistrano::Puma::Nginx # Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } 

deploy.rb

 # config valid for current version and patch releases of Capistrano lock "~> 3.10.0" set :application, "aws-rails" set :repo_url, "ssh://*****/aws-rails.git" set :deploy_via, :remote_cache set :deploy_user, "deploy" set :linked_files, %w{config/database.yml config/secrets.yml} set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets public/system public/assets tmp/sockets} set :system_user, 'ssh_user' # defaults to root user set :rvm_ruby_version, '2.4.1@aws-rails' set :bundle_roles, :all set :puma_threads, [4, 16] set :puma_workers, 0 # 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/#{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 :puma_preload_app, true set :puma_worker_timeout, nil set :puma_init_active_record, true # Change to false when not using ActiveRecord set :puma_init_active_record, true # Change to false when not using ActiveRecord after "deploy", "deploy:cleanup" # keep only the last 5 releases after "deploy", "deploy:migrate" 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 before :starting, :check_revision after :finishing, :compile_assets after :finishing, :cleanup end 

configuration/部署/ production.rb

 server '*****.compute.amazonaws.com', user: 'deploy', roles: %w{web app db} set :branch, "master" set :stage, :production set :full_app_name, "#{fetch(:application)}-#{fetch(:stage)}" set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}" 

/home/deploy/apps/aws-rails-production/shared/puma.rb

 #!/usr/bin/env puma directory '/home/deploy/apps/aws-rails-production/current' rackup "/home/deploy/apps/aws-rails-production/current/config.ru" environment 'production' tag '' pidfile "/var/www/aws-rails/shared/tmp/pids/puma.pid" state_path "/var/www/aws-rails/shared/tmp/pids/puma.state" stdout_redirect '/var/www/aws-rails/current/log/puma.error.log', '/var/www/aws-rails/current/log/puma.access.log', true threads 4,16 bind 'unix:///var/www/aws-rails/shared/tmp/sockets/aws-rails-puma.sock' workers 0 restart_command 'bundle exec puma' preload_app! on_restart do puts 'Refreshing Gemfile' ENV["BUNDLE_GEMFILE"] = "" end before_fork do ActiveRecord::Base.connection_pool.disconnect! end on_worker_boot do ActiveSupport.on_load(:active_record) do ActiveRecord::Base.establish_connection end end 

在/ etc / nginx的/启用的站点- / AWS-钢轨生产

 upstream puma { server unix:///home/deploy/apps/aws-rails-production/shared/tmp/sockets/puma.sock; } server { listen 80 default_server deferred; # server_name example.com; root /home/deploy/apps/aws-rails-production/current/public; access_log /home/deploy/apps/aws-rails-production/current/log/nginx.access.log; error_log /home/deploy/apps/aws-rails-production/current/log/nginx.error.log info; location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } try_files $uri/index.html $uri @puma; location @puma { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://puma; } error_page 500 502 503 504 /500.html; client_max_body_size 10M; keepalive_timeout 10; } 

我运行应用程序,当我运行在我的应用程序的当前目录bundle exec puma -e production -b unix:///home/deploy/apps/aws-rails-production/shared/tmp/sockets/puma.sock ,我得到这个

 [11355] Puma starting in cluster mode... [11355] * Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot [11355] * Min threads: 5, max threads: 5 [11355] * Environment: production [11355] * Process workers: 2 [11355] * Phased restart available [11355] * Listening on unix:///home/deploy/apps/aws-rails-production/shared/tmp/sockets/puma.sock [11355] Use Ctrl-C to stop [11355] - Worker 0 (pid: 11358) booted, phase: 0 [11355] - Worker 1 (pid: 11360) booted, phase: 0 

但是当我做cap production puma:start我得到这个

 rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] ruby-2.4.1 ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] 00:00 puma:make_dirs 01 mkdir /home/deploy/apps/aws-rails-production/shared/tmp/sockets -p ✔ 01 deploy@ec2-54-255-166-115.ap-southeast-1.compute.amazonaws.com 0.061s 02 mkdir /home/deploy/apps/aws-rails-production/shared/tmp/pids -p ✔ 02 deploy@ec2-54-255-166-115.ap-southeast-1.compute.amazonaws.com 0.061s 00:00 puma:start using conf file /home/deploy/apps/aws-rails-production/shared/puma.rb 01 ~/.rvm/bin/rvm 2.4.1@aws-rails do bundle exec puma -C /home/deploy/apps/aws-rails-production/shared/puma.rb --daemon 01 Puma starting in single mode... 01 01 * Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot 01 01 * Min threads: 4, max threads: 16 01 01 * Environment: production 01 01 * Daemonizing... 01 ✔ 01 deploy@ec2-******.ap-southeast-1.compute.amazonaws.com 0.738s 

和我的应用程序没有运行。

任何人都可以告诉我的configuration有什么问题吗?