При первом развертывании кода появляется ошибка.Я использовал один и тот же сценарий много раз, и он успешно работал.
Ошибка, которую я получаю при развертывании:
[out :: ***********] sh: rake: not found
Я использую RVM, Ruby 1.9.2
Вывод сценария развертывания:
executing `deploy:after_symlink'
* executing "cp /home/me/my_app/shared/database.yml /home/me/my_app/current/config/database.yml"
servers: ["**************"]
["**************"] executing command
command finished in 1204ms
* executing `deploy:migrate'
* executing "cd /home/me/my_app/current && rake db:migrate RAILS_ENV=production"
servers: ["**************"]
["**************"] executing command
** [out :: ***********] sh: rake: not found // Here is the issue
command finished in 1023ms
*** [deploy:symlink] rolling back
* executing "ls -x /home/me/my_app/releases"
Список драгоценных камней: на сервере
gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.1.0, 3.0.10)
actionpack (3.1.0, 3.0.10)
activemodel (3.1.0, 3.0.10)
activerecord (3.1.0, 3.0.10)
activeresource (3.1.0, 3.0.10)
activesupport (3.1.0, 3.0.10)
arel (2.2.1, 2.0.10)
bcrypt-ruby (3.0.1)
builder (3.0.0, 2.1.2)
bundler (1.0.21)
daemon_controller (0.2.6)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.0, 0.5.0)
mail (2.3.0, 2.2.19)
mime-types (1.16)
multi_json (1.0.3)
mysql2 (0.2.7)
passenger (3.0.9)
polyglot (0.3.2)
rack (1.3.4, 1.2.4)
rack-cache (1.0.3)
rack-mount (0.8.3, 0.6.14)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (3.0.10)
railties (3.1.0, 3.0.10)
rake (0.9.2)
rdoc (3.9.4)
sprockets (2.0.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.30)
Скрипт, который я использую для развертывания:
set :stages, %w(production staging)
require 'capistrano/ext/multistage'
server "Server IP", :app, :web, :db, :primary => true
set(:application) { "app_name" }
set (:deploy_to) { "/home/binarymesh/#{application}" }
set :user, 'my_user'
set :keep_releases, 3
set :repository, "git@github.com:MyRepo"
set :use_sudo, false
set :scm, :git
default_run_options[:pty] = true
ssh_options[:forward_agent] = false
set :deploy_via, :remote_cache
set :git_shallow_clone, 1
set :git_enable_submodules, 1
namespace :deploy do
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end
desc "invoke the db migration"
task:migrate, :roles => :app do
send(run_method, "cd #{current_path} && rake db:migrate RAILS_ENV=#{stage} ")
end
desc "Deploy with migrations"
task :long do
transaction do
update_code
web.disable
symlink
migrate
end
restart
web.enable
cleanup
end
task :after_symlink, :roles => :app do
run "cp #{shared_path}/database.yml #{current_path}/config/database.yml"
end
desc "Run cleanup after long_deploy"
task :after_deploy do
cleanup
end
end