在amazon ec2 ubuntu服务器上部署rails项目时出错

时间:2015-10-21 12:30:46

标签: ruby-on-rails ubuntu deployment server capistrano

我是服务器上deploy code的新用户。我第一次做它。

我在deploying

上使用capistrano使用amazon ubuntu server.对于rails项目获得了以下错误
  

错误:失败:“rvm_path = $ HOME / .rvm $ HOME / .rvm / bin / rvm-shell   'ruby-2.0.0-p353'-c'git clone -q -b master

## Deploy.rb file
require 'rvm/capistrano'
set :application, "testproject"
set :deploy_to, "/home/ubuntu/testproject"

set :user, "ubuntu"
set :domain, "52.52.523.523"
set :ssh_options, { :forward_agent => true }
server domain, :app, :web
role :db, domain, :primary => true
set :rvm_ruby_string, 'ruby-2.0.0-p353'
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
set :rvm_type, :user

set :keep_releases,       5
default_run_options[:pty] = true

after "deploy:update_code" do
  run "ls -al #{fetch(:release_path)} && which ruby"
  bundle_dir = File.join(fetch(:shared_path), 'bundle')
  args = ["--path #{bundle_dir}"]
  args << "--without development"
  run "cd #{fetch(:release_path)} && bundle install #{args.join(' ')}"
end

set :scm, :git
set :repository, "https://hwar@bitbucket.org/tes_code/testproject_pro.git"
set :rake, 'bundle exec rake'
set :branch, 'master'


# if you want to clean up old releases on each deploy uncomment this:
after "deploy:restart", "deploy:cleanup"
after "deploy:restart", "deploy:start_juggernaut"
before "deploy:restart", "deploy:tmp_symlinks"

# 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')}"
    run "touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

namespace :deploy do

  #desc "Restarting httpd "
  #task :restart, :roles => :app, :except => { :no_release => true } do
  #  run "/sbin/service httpd stop"
  #  run "/sbin/service httpd start"
  #end

  task :create_symlink do
    run "ln -nfs #{shared_path}/config/database.yml #{current_path}/config/database.yml"
    run "ln -nfs #{shared_path}/public/uploads #{current_path}/public"
    run "cd #{current_path}/public && rm -rf resources && ln -nfs #{shared_path}/public/resources #{current_path}/public"
    #run "cd #{current_path} && chmod -R 777 tmp/"
  end

  task :tmp_symlinks do
    run "cd #{current_path} && rm -rf tmp && ln -s #{shared_path}/tmp tmp"
  end

  desc "start the juggernaut server"
  task :start_juggernaut do
    run "cd #{current_path} && nohup /etc/init.d/juggernaut restart &"
  end

  desc "Recreate symlink"
  task :resymlink, :roles => :app do
    run "rm -f #{current_path} && ln -s #{release_path} #{current_path}"
  end
end
after "deploy", "deploy:create_symlink"
before "deploy:create_symlink", "deploy:resymlink"

任何人都有关于它的想法或解决方案。

由于

0 个答案:

没有答案