2012-10-05 204 views
1

我試圖通過Capistrano將我的Rails應用程序部署爲我的網站Blog。我在/ rails_app/Blog /在cPanel中創建了一個Rails應用程序,並刪除了生成的框架代碼。使用Capistrano部署rails應用程序

當我在終端

cap deploy:setup 

鍵入此命令我得到這個錯誤信息

[email protected] ~/documents/Aptana Studio 3 Workspace/Blog 
$ cap deploy:setup 
* executing `deploy:setup' 
* executing "sudo -p 'sudo password: ' mkdir -p /rails_app/Blog/ /rails_app/Bl 
og/releases /rails_app/Blog/shared /rails_app/Blog/shared/system /rails_app/Blog 
/shared/log /rails_app/Blog/shared/pids" 
servers: ["mydomain.co.nz"] 
connection failed for: mydomain.co.nz (Errno::ETIMEDOUT: A connection attempt fail 
ed because the connected party did not properly respond after a period of time, 
or established connection failed because connected host has failed to respond. - 
connect(2)) 

這裏是我的deploy.rb文件的配置設置

set :application, "mydomain.co.nz" 
set :repository, "set your repository location here" 

set :scm, :subversion 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 

# These are not not part of the defaults 
set :port, 12002 
set :deploy_to, "/rails_app/Blog/" 
# 

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

什麼是mydomain.co.nz?嘗試ping或ssh它。設置:server,your_server_name。設置:存儲庫path_to_repository。 – ryaz

回答

1

試試這個,這是適用於我的deploy.rb文件的示例

require "bundler/capistrano" 
set :application, "testcapistrano" 

set :rvm_ruby_string, "[email protected]" 
require "rvm/capistrano" 
set :rvm_type, :user 
set :rvm_install_ruby, :install 
set :repository, "xyz" 
set :scm, :git 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 
role :web, "testcapistrano.dipak.cs"  # Your HTTP server, Apache/etc 
role :app, "testcapistrano.dipak.cs"  # This may be the same as your `Web` server 
role :db, "testcapistrano.dipak.cs", :primary => true # This is where Rails migrations will run 

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true 
set :deploy_to, "/dipak/capistron/" 
set :deploy_via, :remote_cache 
set :user, "your username" 
set :password, "password" 
set :use_sudo, false 
set :keep_releases, 5 
before 'deploy:setup', 'rvm:install_ruby' 

# tasks 
namespace :deploy do 
    task :start, :roles => :app do 
    run "touch #{current_path}/tmp/restart.txt" 
    end 
    task :stop, :roles => :app do 
    # Do nothing. 
    end 

    desc "Restart Application" 
    task :restart, :roles => :app do 
    run "touch #{current_path}/tmp/restart.txt" 
    end 
end 
相關問題