2014-01-21 142 views
1

我試圖在使用Capistrano的Rails應用程序上部署ruby。我的開發機器和服務器都在代理之後。我在遠程計算機上使用代理服務器時沒有問題(涉及代理服務器和Capistrano的大多數問題都是關於此問題的)。使用Capistrano從本地代理後部署應用程序

當Capistrano執行命令run_locally它不保留從我的bashrc設置的任何環境變量。當它在本地運行命令時,如何設置Capistrano的設置?諸如executing locally: "git ls-remote https://github.com:user/project.git master之類的命令失敗。

deploy.rb

require 'bundler/capistrano' 
require "capistrano-rbenv" 
load 'deploy/assets' 
require 'creds.rb' 
set :rbenv_ruby_version, "1.9.3-p484" 
set :rbenv_repository, "https://github.com/sstephenson/rbenv.git" 

set :application, "visio" 



# Deploy from your local Git repo by cloning and uploading a tarball 
set :scm, :git 
set :repository, "https://github.user/project.git" 
set :deploy_via, :copy 
set :branch, "master" 
set :rails_env,  "production" 


set :user, :deploy 
set :deploy_to, "/var/www/#{application}" 
set :use_sudo, false 

set :ssh_options, { :forward_agent => true } 
default_run_options[:pty] = true 

role :web, "10.9.43.153"       # Your HTTP server, Apache/etc 
role :app, "10.9.43.153"       # This may be the same as your `Web` server 
role :db, "10.9.43.153", :primary => true # This is where Rails migrations will run 

# ensure http_proxy variables are set 
set :default_environment, { 
    'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH", 
    'BASH_ENV' => '$HOME/.bashrc', 
    'https_proxy' => 'https://proxy.org.local:8080', 
    'http_proxy' => 'http://proxy.org.local:8080' 
} 

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 
+0

能否請您發表您的deploy.rb文件這裏來看看! –

回答

相關問題