嗨大家在将我的rails应用程序部署到amazon服务器时出现以下错误。我尝试了各种选择但失败了。错误是:
** transaction: commit
* executing `deploy:restart'
* executing "service unicorn-app-development restart"
servers: ["localhost"]
[localhost] executing command
** [out :: localhost] Couldn't reload, starting 'cd /home/ubuntu/applications/app/development/current/app; bin/unicorn -D -c /home/ubuntu/applications/app/development/current/app/config/unicorn.rb -E development' instead
** [out :: localhost]
** [out :: localhost] Could not find rake-10.4.2 in any of the sources
** [out :: localhost]
** [out :: localhost] Run `bundle install` to install missing gems.
** [out :: localhost]
command finished in 247ms
failed: "env RUBY_VERSION=ruby-2.1.2 GEM_HOME=/home/ubuntu/.rvm/gems/ruby-2.1.2@app GEM_PATH=/home/ubuntu/.rvm/gems/ruby-2.1.2@app:/home/ubuntu/.rvm/gems/ruby-2.1.2@global PATH=/home/ubuntu/.rvm/gems/ruby-2.1.2@app/bin:/home/ubuntu/.rvm/gems/ruby-2.1.2@global/bin:/home/ubuntu/.rvm/rubies/ruby-2.1.2/bin:/home/ubuntu/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games sh -c 'service unicorn-app-development restart'" on localhost
我的Gemfile
包含:
##
# Server and deployment
gem 'unicorn'
gem 'capistrano', '2.12'
gem 'capistrano-ext'
我的deploy.rb
看起来像
# config valid only for current version of Capistrano
require 'capistrano/ext/multistage'
require "bundler/capistrano"
set :application, 'app'
set :repository, 'git@bitbucket.org:username/app.git'
set :user, "ubuntu"
set :ssh_options, { :forward_agent => true }
set :stages, %w(development staging production)
set :default_stage, "development"
default_run_options[:pty] = true
set :use_sudo, false
set :deploy_via, :remote_cache
set :keep_releases, 5
set :scm, :git
set :scm_verbose, true
set :default_environment, {
'RUBY_VERSION' => ENV['RUBY_VERSION'],
'GEM_HOME' => ENV['GEM_HOME'],
'GEM_PATH' => ENV['GEM_PATH'],
'PATH' => ENV['PATH'],
'BUNDLE_PATH' => ENV['GEM_PATH'],
}
require 'bundler/capistrano'
namespace :nginx do
%w[start stop restart].each do |command|
desc "#{command} nginx server"
task command, roles: :app, except: { no_release: true } do
sudo "service nginx #{command}"
end
end
end
namespace :deploy do
task :cold do
update
start
end
desc "restart unicorn"
task :restart, roles: :app, except: { no_release: true } do
run "service unicorn-#{application}-development restart"
end
%w[start stop].each do |command|
desc "#{command} unicorn"
task command, roles: :app, except: { no_release: true } do
run "/etc/init.d/unicorn-#{application}-development #{command}"
end
end
desc "Bundle deployment"
task :bundle_deployment, roles: :app do
run "cd #{release_path}/app && RAILS_ENV=development bundle install"
end
end
捆绑部署任务也无效。我正在使用rails-4.2.0
版本。如何解决此错误。