# config/deploy.rb
# config valid for current version and patch releases of Capistrano
lock "~> 3.10.0"
set :application, -> {'phonebook-api'}
set :repo_url, '.'
set :user, 'semenvr' #ssh auth username
set :rvm_ruby_version, 'ruby-2.4.2'
set :tmp_dir, "/home/#{user}/#{application}/tmp"
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :puma_threads, [4, 6]
set :puma_workers, 2
set :pty, true
set :use_sudo, false
set :stage, -> {:production} # по умолчанию production
set :deploy_via, :remote_cache
set :deploy_to, -> {"/home/#{user}/#{application}"}
set :puma_bind, -> {"unix:///home/#{user}/#{application}/tmp/sockets/puma.sock"}
set :puma_state, -> {"/home/#{user}/#{application}/tmp/pids/puma.state"}
set :puma_pid, -> {"/home/#{user}/#{application}/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, true # Change to false when not using ActiveRecord
set :nginx_use_ssl, false
set :log_level, :debug
set :keep_releases, 3
## Linked Files & Directories (Default None):
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{log tmp public/uploads}
namespace :puma do
desc
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
task :copy_config do
on release_roles :app do |role|
fetch(:linked_files).each do |linked_file|
user = role.user ? role.user + '@' : nil
hostname = role.hostname
linked_files(shared_path).each do |file|
run_locally do
execute :rsync, "config/#{file.to_s.gsub(/.*\/(.*)$/,"\\1")}", "#{user}#{hostname}:#{file.to_s.gsub(/(.*)\/[^\/]*$/, "\\1")}/"
end
end unless user.nil?
end
end
end
desc
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
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
end
end
before :starting, :check_revision
before 'deploy:check:linked_files', 'deploy:copy_config'
# after :finishing, :compile_assets # закомментируйте эту строчку если используете Rails API
after :finishing, :cleanup
after :finishing, :restart
end
Dendi47, в тексте ошибки вы же видите "NameError: undefined local variable or method `user'" и далее рекомендацию запустить еще раз с параметром "--trace", что скорее всего покажет вам строку где возникла ошибка.