Пытаюсь залить проект на сервер. В последний момент выдает ошибку. Проблема в capistrano/deploy
В логах вижу вот такую ситуацию
ln -s /home/root/apps/holls_api/releases/20180509165931 /home/root/apps/holls_api/releases/current
mv /home/root/apps/holls_api/releases/current /home/root/apps/holls_api
cannot overwrite directory '/home/root/apps/holls_api/current' with non-directory
Capistrano пытается переименовать папку, которая является симлинком. Как исправить?
capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/puma'
require 'capistrano/rails/collection'
require 'capistrano3/postgres'
require 'capistrano/database_yml'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
install_plugin Capistrano::Puma
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
deploy.rb
server 'xx.xx.xxx.xxx', port: 22, roles: [:web, :app, :db], primary: true
set :repo_url, 'git@github.com:xxx/holls_api.git'
set :application, 'holls_api'
set :user, 'deploy'
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 :stage, :production
set :stages, ["production"]
set :deploy_via, :remote_cache
set :deploy_to, "/home/#{fetch(:user)}/apps/#{fetch(:application)}"
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 :ssh_options, { forward_agent: true, user: fetch(:user), keys: ["#{ENV['USERPROFILE']}/.ssh/private.ppk"] }
set :postgres_keep_local_dumps, 5 # Will keep 5 last dump files.
set :postgres_backup_compression_level, 6 # Will use gzip level 6 to compress the output.
append :linked_files, 'config/database.yml'
set :puma_preload_app, true
set :puma_worker_timeout, nil
set :puma_init_active_record, true # Change to false when not using ActiveRecord
set :rails_env, "production"
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
task :config_symlink do
on roles(:app) do
execute "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
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 'deploy:starting', 'postgres:backup:create'
#before 'deploy:starting', 'postgres:backup:download'
before :starting, :check_revision
# before :compile_assets, :config_symlink
after :finishing, :compile_assets
after :finishing, :cleanup
after :finishing, :restart
end
capistrano.log
INFO [c5b8e062] Running /usr/bin/env ln -s /home/root/apps/holls_api/releases/20180509165931 /home/root/apps/holls_api/releases/current on 92.53.107.196
DEBUG [c5b8e062] Command: /usr/bin/env ln -s /home/root/apps/holls_api/releases/20180509165931 /home/root/apps/holls_api/releases/current
INFO [c5b8e062] Finished in 0.176 seconds with exit status 0 (successful).
INFO [1b25514b] Running /usr/bin/env mv /home/root/apps/holls_api/releases/current /home/root/apps/holls_api on 22.33.137.196
DEBUG [1b25514b] Command: /usr/bin/env mv /home/root/apps/holls_api/releases/current /home/root/apps/holls_api
DEBUG [1b25514b] mv:
DEBUG [1b25514b] cannot overwrite directory '/home/root/apps/holls_api/current' with non-directory