使用capistrano部署rails时出现捆绑错误

时间:2013-10-12 18:51:36

标签: ruby-on-rails ruby-on-rails-3 capistrano rvm-capistrano

部署我的rails应用程序时,使用capistrano安装所有内容并进行回滚并显示以下错误

failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-2.0.0-p247' -c 'cd /var/www/vhosts/admin/releases/20131012184713 && bundle install --gemfile /var/www/vhosts/admin/releases/20131012184713/Gemfile --path /var/www/vhosts/admin/shared/bundle --deployment --quiet --without development test'" on admin.mydomain.com

修改-1

这是我的deploy.rb:

require "bundler/capistrano"
require "rvm/capistrano"
set :rvm_ruby_string, "ruby-2.0.0-p247"
set :rvm_type, :user

set :application, "admin"
set :repository,  "git@bitbucket.org:username/myrepo.git"
set :user, "my-server-user-name"
set :branch, "master"

set :deploy_to, "/var/www/vhosts/admin"
set :deploy_via, :copy
set :use_sudo, false
set :rvm_install_with_sudo, true

default_run_options[:pty] = true

set :port, 2775

set :scm, :git

role :web, "admin.mydomain.com"
role :app, "admin.mydomain.com"
role :db,  "admin.mydomain.com", :primary => true
role :db,  "admin.mydomain.com"

after "deploy:update_code","deploy:config_symlink"

set :rvm_type, :system

# 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

  task :config_symlink do
    #run "cp #{release_path}/config/database.yml.example #{release_path}/config/database.yml"
  end
end

before 'deploy', 'rvm:install_ruby'
before 'deploy', 'rvm:create_gemset'

我没有在此处显示任何特定错误。上面提到的错误是我得到的唯一信息。

还有一件事要说是

在我的服务器中,我可以找到此路径

/usr/local/rvm但我找不到/usr/local/rvm/bin/rvm-shell

修改-2

 ** [out :: admin.mydomain.com] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
 ** [out :: admin.mydomain.com] 
 ** [out :: admin.mydomain.com] /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb --with-pg-config=/usr/pgsql-9.2/bin/pg_conf
 ** [out :: admin.mydomain.com] Using config values from /usr/pgsql-9.2/bin/pg_conf
 ** [out :: admin.mydomain.com] sh: /usr/pgsql-9.2/bin/pg_conf: No such file or directory
 ** [out :: admin.mydomain.com] sh: /usr/pgsql-9.2/bin/pg_conf: No such file or directory
 ** [out :: admin.mydomain.com] checking for libpq-fe.h... no
 ** [out :: admin.mydomain.com] Can't find the 'libpq-fe.h header
 ** [out :: admin.mydomain.com] *** extconf.rb failed ***
 ** [out :: admin.mydomain.com] Could not create Makefile due to some reason, probably lack of necessary
 ** [out :: admin.mydomain.com] libraries and/or headers.  Check the mkmf.log file for more details.  You may
 ** [out :: admin.mydomain.com] need configuration options.
 ** [out :: admin.mydomain.com] 
 ** [out :: admin.mydomain.com] Provided configuration options:
 ** [out :: admin.mydomain.com] --with-opt-dir
 ** [out :: admin.mydomain.com] --without-opt-dir
 ** [out :: admin.mydomain.com] --with-opt-include
 ** [out :: admin.mydomain.com] --without-opt-include=${opt-dir}/include
 ** [out :: admin.mydomain.com] --with-opt-lib
 ** [out :: admin.mydomain.com] --without-opt-lib=${opt-dir}/lib
 ** [out :: admin.mydomain.com] --with-make-prog
 ** [out :: admin.mydomain.com] --without-make-prog
 ** [out :: admin.mydomain.com] --srcdir=.
 ** [out :: admin.mydomain.com] --curdir
 ** [out :: admin.mydomain.com] --ruby=/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
 ** [out :: admin.mydomain.com] --with-pg
 ** [out :: admin.mydomain.com] --without-pg
 ** [out :: admin.mydomain.com] --with-pg-config
 ** [out :: admin.mydomain.com] --with-pg-dir
 ** [out :: admin.mydomain.com] --without-pg-dir
 ** [out :: admin.mydomain.com] --with-pg-include
 ** [out :: admin.mydomain.com] --without-pg-include=${pg-dir}/include
 ** [out :: admin.mydomain.com] --with-pg-lib
 ** [out :: admin.mydomain.com] --without-pg-lib=${pg-dir}/
 ** [out :: admin.mydomain.com] 
 ** [out :: admin.mydomain.com] 
 ** [out :: admin.mydomain.com] Gem files will remain installed in /var/www/vhosts/admin/shared/bundle/ruby/2.0.0/gems/pg-0.17.0 for inspection.
 ** [out :: admin.mydomain.com] Results logged to /var/www/vhosts/admin/shared/bundle/ruby/2.0.0/gems/pg-0.17.0/ext/gem_make.out
 ** [out :: admin.mydomain.com] An error occurred while installing pg (0.17.0), and Bundler cannot continue.
 ** [out :: admin.mydomain.com] Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.

我尝试了gem install pg -v '0.17.0'并添加了bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config,但上述错误存在,我该如何解决呢

1 个答案:

答案 0 :(得分:0)

这有效

sudo yum install postgresql-devel

安装完成后,需要重新启动才能使配置采取措施。

sudo service postgres-9.2 restart

相关问题