使用Capistrano部署时无法启动Puma

时间:2017-03-01 15:20:12

标签: ruby-on-rails nginx capistrano

使用nginx服务器在数字海洋上部署capistrano时,我无法启动我的应用程序。 这是我尝试启动时的输出:

puma:start
  using conf file /home/shop-it/staging/shared/puma.rb
  01 /usr/local/rvm/bin/rvm default do bundle exec puma -C /home/shop-it/staging/shared/puma.rb --daemon
  01 Puma starting in single mode...
  01
  01 * Version 3.7.0 (ruby 2.4.0-p0), codename: Snowy Sagebrush
  01
  01 * Min threads: 4, max threads: 16
  01
  01 * Environment: production
  01
  01 * Daemonizing...
  01
✔ 01 shop-it@95.85.20.211 1.060s

它似乎没有听任何端口。这是状态:

00:00 puma:status
  Puma not running

这是我的deploy.rb

set :puma_threads,    [4, 16]
set :puma_workers,    0

set :pty,             true
set :use_sudo,        false
set :stage,           :production
set :deploy_via,      :remote_cache
set :puma_bind,       "unix:///home/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state,      "/home/tmp/pids/puma.state"
set :puma_pid,        "/home/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

# 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 /home/tmp/sockets -p"
      execute "mkdir /home/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/staging` #This is just for staging
        puts "WARNING: HEAD is not the same as origin/staging"
        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

我把它放在我的staging.rb

set :puma_bind, 'tcp://0.0.0.0:9294'

但它似乎没有任何效果。

知道我可能做错了吗?

0 个答案:

没有答案