Проблемы с развертыванием приложения rails с Capistrano

87
8

Я использую capistrano для развертывания приложения rails 3.2.16 на сервере VPS. Это мое время, используя capistrano, так что считайте меня новичком. У меня возникает проблема, когда я запускаю "развертывание крышки: обновление", и я не уверен, что делать дальше.

Ниже приведен вывод о том, что происходит:

    ******-MBP:Folio stevo$ bundle exec cap deploy:update
triggering load callbacks
* 2013-12-26 20:29:21 executing 'deploy:update'
** transaction: start
* 2013-12-26 20:29:21 executing 'deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@bitbucket.org:**********/*********.git master-staging"
command finished in 1626ms
* executing "if [ -d /home/********/app/*********/shared/cached-copy ]; then cd /home/********/app/*********/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard c56df1b37c96846177a518133e89c1188b8d7a09 && git clean -q -d -x -f; else git clone -q -b master-staging git@bitbucket.org:**********/*********.git /home/********/app/*********/shared/cached-copy && cd /home/********/app/*********/shared/cached-copy && git checkout -q -b deploy c56df1b37c96846177a518133e89c1188b8d7a09; fi"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 3002ms
copying the cached version to /home/********/app/*********/releases/20131227002927
* executing "cp -RPp /home/********/app/*********/shared/cached-copy /home/********/app/*********/releases/20131227002927 && (echo c56df1b37c96846177a518133e89c1188b8d7a09 > /home/********/app/*********/releases/20131227002927/REVISION)"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 1025ms
* 2013-12-26 20:29:28 executing 'deploy:finalize_update'
triggering before callbacks for 'deploy:finalize_update'
* 2013-12-26 20:29:28 executing 'deploy:assets:symlink'
* executing "rm -rf /home/********/app/*********/releases/20131227002927/public/assets && mkdir -p /home/********/app/*********/releases/20131227002927/public && mkdir -p /home/********/app/*********/shared/assets && ln -s /home/********/app/*********/shared/assets /home/********/app/*********/releases/20131227002927/public/assets"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 911ms
* 2013-12-26 20:29:29 executing 'bundle:install'
* executing "cd /home/********/app/*********/releases/20131227002927 && bundle install --gemfile /home/********/app/*********/releases/20131227002927/Gemfile --path /home/********/app/*********/shared/bundle --deployment --quiet --without development test"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 1533ms
* executing "chmod -R -- g+w /home/********/app/*********/releases/20131227002927 && rm -rf -- /home/********/app/*********/releases/20131227002927/public/system && mkdir -p -- /home/********/app/*********/releases/20131227002927/public/ && ln -s -- /home/********/app/*********/shared/system /home/********/app/*********/releases/20131227002927/public/system && rm -rf -- /home/********/app/*********/releases/20131227002927/log && ln -s -- /home/********/app/*********/shared/log /home/********/app/*********/releases/20131227002927/log && rm -rf -- /home/********/app/*********/releases/20131227002927/tmp/pids && mkdir -p -- /home/********/app/*********/releases/20131227002927/tmp/ && ln -s -- /home/********/app/*********/shared/pids /home/********/app/*********/releases/20131227002927/tmp/pids && rm -rf -- /home/********/app/*********/releases/20131227002927/config/application.yml && mkdir -p -- /home/********/app/*********/releases/20131227002927/config/ && ln -s -- /home/********/app/*********/shared/application.yml /home/********/app/*********/releases/20131227002927/config/application.yml"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 940ms
triggering after callbacks for 'deploy:update_code'
* 2013-12-26 20:29:32 executing 'deploy:assets:precompile'
triggering before callbacks for 'deploy:assets:precompile'
* 2013-12-26 20:29:32 executing 'deploy:assets:update_asset_mtimes'
* executing "[ -e /home/********/app/*********/shared/assets/manifest* ] && cat /home/********/app/*********/shared/assets/manifest* || echo"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 903ms
* executing "cat /home/********/app/*********/current/REVISION"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 920ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/********/app/*********/releases/20131227002927; true"
servers: ["198.**.***.***"]
[198.**.***.***] executing command
command finished in 918ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cat /home/********/app/*********/current/REVISION'" on 198.**.***.***

Вот мой файл deploy.rb, если проблема здесь:

server '198.**.***.***', :web, :app, :db, primary: true

set :application, '*********'
set :user, '*********'
set :deploy_to, "/home/#{user}/app/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :rvm_type, :user

set :scm, 'git'
set :repository, "git@bitbucket.org:*****/#{application}.git"
set :branch, 'git rev-parse --abbrev-ref HEAD'.strip

set :shared_children, shared_children + %w{ config/application.yml }

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

# Using Passenger
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end

# Skipping Asset Compilation With Capistrano
# http://www.bencurtis.com/2011/12/skipping-asset-compilation-with-capistrano/
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
end

require "rvm/capistrano"
require "bundler/capistrano"

Что я делаю не так?

спросил(а) 2021-01-19T16:26:54+03:00 2 месяца, 3 недели назад
1
Решение
87

Развертывание вашей крышки вызывает ошибку при развертывании: assets: прекомпилировать задачу, которую вы переопределили в вашем deploy.rb, попробуйте запустить развертывание крышки после комментирования приведенного ниже кода из вашего deploy.rb

namespace :deploy do

namespace :assets do

task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end

конец

ответил(а) 2021-01-19T16:26:54+03:00 2 месяца, 3 недели назад
Ваш ответ
Введите минимум 50 символов
Чтобы , пожалуйста,
Выберите тему жалобы:

Другая проблема