每个 cap:deploy 服务器上出现机架错误
每次我在本地计算机上运行 cap:deploy
时,当我打开网页时,我都会收到下一个错误:
Ruby (Rack) application could not be started
Error message:
git://github.com/ctran/annotate_models.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
Exception class:
PhusionPassenger::UnknownError
Application root:
/vol/www/apps/ror_tutorial/current
Backtrace:
#
File
Line
Location
0
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
572
in `rescue in load_spec_files'
1
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
570
in `load_spec_files'
2
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
385
in `local_specs'
3
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
555
in `specs'
4
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
147
in `block in resolve'
5
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
145
in `each'
6
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
145
in `resolve'
7
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
90
in `specs'
8
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
135
in `specs_for'
9
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
124
in `requested_specs'
10
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/environment.rb
23
in `requested_specs'
11
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/runtime.rb
11
in `setup'
12
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler.rb
110
in `setup'
13
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb
326
in `prepare_app_process'
14
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb
156
in `block in initialize_server'
15
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb
572
in `report_app_init_status'
16
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb
154
in `initialize_server'
17
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
204
in `start_synchronously'
18
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
180
in `start'
19
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb
129
in `start'
20
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
253
in `block (2 levels) in spawn_rack_application'
21
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb
132
in `lookup_or_add'
22
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
246
in `block in spawn_rack_application'
23
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb
82
in `block in synchronize'
24
prelude>
10:in `synchronize'
25
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb
79
in `synchronize'
26
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
244
in `spawn_rack_application'
27
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
137
in `spawn_application'
28
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
275
in `handle_spawn_application'
29
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
357
in `server_main_loop'
30
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
206
in `start_synchronously'
31
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server
99
in `'
我通过下一行修复该问题:
$ bundle install --without development test
$ bundle install --deployment
$ service nginx restart
但我真的厌倦了一次又一次地这样做。有谁知道如何永久修复它吗?
我的 gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.3'
gem 'gravatar_image_tag'
gem 'will_paginate'
gem 'rack'
gem 'rake'
gem 'texticle', "2.0", :require => 'texticle/rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
end
gem 'jquery-rails'
group :development do
gem 'capistrano'
gem 'rspec-rails'
gem 'therubyracer-heroku'
gem 'pg'
gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
gem 'faker'
end
group :test do
gem 'rspec-rails'
gem 'webrat'
gem 'spork'
gem 'autotest'
gem 'autotest-rails-pure'
gem 'autotest-fsevent'
gem 'autotest-growl'
gem 'factory_girl_rails'
end
group :production do
gem 'pg'
gem 'faker'
end
config/deploy.rb
set :user, "root"
set :rails_env, "production"
default_run_options[:pty] = true
set :repository, "git://github.com/Loremaster/sample_app.git"
set :application, "ror_tutorial"
set :deploy_to, "/vol/www/apps/#{application}"
set :scm, :git
set :branch, "master"
set :deploy_via, :remote_cache
server "my.ip", :app,
:web,
:db, :primary => true
# If you are using Passenger mod_rails uncomment this:
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
我的服务器系统:
Ubuntu 10.04 LTS
PostgreSQL 9.1
Rails 3.1.3
Ruby 1.9.3p27
Nginx 1.0.11 (installed/compiled by passenger)
Phusion passenger 3.0.11
Capistrano
Each time i run on my local machine cap:deploy
i get next error when i open my web-page:
Ruby (Rack) application could not be started
Error message:
git://github.com/ctran/annotate_models.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
Exception class:
PhusionPassenger::UnknownError
Application root:
/vol/www/apps/ror_tutorial/current
Backtrace:
#
File
Line
Location
0
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
572
in `rescue in load_spec_files'
1
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
570
in `load_spec_files'
2
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
385
in `local_specs'
3
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/source.rb
555
in `specs'
4
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
147
in `block in resolve'
5
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
145
in `each'
6
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
145
in `resolve'
7
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
90
in `specs'
8
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
135
in `specs_for'
9
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/definition.rb
124
in `requested_specs'
10
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/environment.rb
23
in `requested_specs'
11
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler/runtime.rb
11
in `setup'
12
/usr/local/rvm/gems/ruby-1.9.3-head/gems/bundler-1.0.21/lib/bundler.rb
110
in `setup'
13
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb
326
in `prepare_app_process'
14
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb
156
in `block in initialize_server'
15
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb
572
in `report_app_init_status'
16
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb
154
in `initialize_server'
17
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
204
in `start_synchronously'
18
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
180
in `start'
19
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb
129
in `start'
20
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
253
in `block (2 levels) in spawn_rack_application'
21
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb
132
in `lookup_or_add'
22
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
246
in `block in spawn_rack_application'
23
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb
82
in `block in synchronize'
24
prelude>
10:in `synchronize'
25
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb
79
in `synchronize'
26
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
244
in `spawn_rack_application'
27
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
137
in `spawn_application'
28
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb
275
in `handle_spawn_application'
29
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
357
in `server_main_loop'
30
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb
206
in `start_synchronously'
31
/usr/local/rvm/gems/ruby-1.9.3-head/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server
99
in `'
I fix that by next lines:
$ bundle install --without development test
$ bundle install --deployment
$ service nginx restart
But i really tired to do that again and again. Does anyone know how to fix it forever?
My gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.3'
gem 'gravatar_image_tag'
gem 'will_paginate'
gem 'rack'
gem 'rake'
gem 'texticle', "2.0", :require => 'texticle/rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
end
gem 'jquery-rails'
group :development do
gem 'capistrano'
gem 'rspec-rails'
gem 'therubyracer-heroku'
gem 'pg'
gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
gem 'faker'
end
group :test do
gem 'rspec-rails'
gem 'webrat'
gem 'spork'
gem 'autotest'
gem 'autotest-rails-pure'
gem 'autotest-fsevent'
gem 'autotest-growl'
gem 'factory_girl_rails'
end
group :production do
gem 'pg'
gem 'faker'
end
config/deploy.rb
set :user, "root"
set :rails_env, "production"
default_run_options[:pty] = true
set :repository, "git://github.com/Loremaster/sample_app.git"
set :application, "ror_tutorial"
set :deploy_to, "/vol/www/apps/#{application}"
set :scm, :git
set :branch, "master"
set :deploy_via, :remote_cache
server "my.ip", :app,
:web,
:db, :primary => true
# If you are using Passenger mod_rails uncomment this:
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
My Server system:
Ubuntu 10.04 LTS
PostgreSQL 9.1
Rails 3.1.3
Ruby 1.9.3p27
Nginx 1.0.11 (installed/compiled by passenger)
Phusion passenger 3.0.11
Capistrano
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您在deploy.rb 中指定使用bundler,否则capistrano 不会自动运行bundler 命令。我将此行添加到部署.rb 文件的顶部以激活捆绑器集成。然后,Capistrano 在部署时自动运行正确的捆绑器命令。
您运行
bundle install --withoutdevelopment test
和bundle install --deployment
的解决方案实际上是相同的,但必须手动保持最新。此外,您可以将其提炼为单个命令:bundle install --deployment --withoutdevelopment test
。在您当前的解决方案中,您运行了两次捆绑程序。capistrano does not automatically run the bundler command unless you specify that you use bundler in your deploy.rb. I add this line to the top of my deploy.rb file to activate bundler integration. Capistrano then automatically runs the right bundler commands when deploying.
Your solution, of running
bundle install --without development test
andbundle install --deployment
is effectively the same, but has to be kept up to date manually. In addition, you could distill this into a single command:bundle install --deployment --without development test
. In your current solution, you are running bundler twice.我也有同样的问题。在我们的 5 个环境中,我们的临时环境突然开始执行此操作。我无法找出原因,但我终于能够通过备份然后重新创建我们的部署目录来部署,然后是 cap 部署:setup,cap 部署:冷,然后是 cap 部署
I had the same problem. Of our 5 environments, our staging environment started doing this out of the blue. I was not able to find out the cause, but I was finally able to deploy by backing up then recreating our deploy directory, followed by cap deploy:setup, cap deploy:cold then cap deploy