花了一个上午,将Capistrano布署成功

 

要点:

  1. 只要在client机器上安装capistrano即可,服务器不需要装。
  1. 服务器要装好rails环境和版本控制工具
  1. 尽量不要使用sudo, 用www的用户即可,安全。

设置为 set :use_sudo, false

以下是我的配置文件(deploy.rb)

set :application, "netbar_cap"



set :repository, "your igt"



default_run_options[:pty] = true



set :use_sudo, false



#set :scm_command, "/usr/local/src/git-1.6.0.4/git"



set :scm, :git



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



role :web, "wbfwzx.com"



# Your HTTP server, Apache/etc



role :app, "wbfwzx.com"



# This may be the same as your `Web` server



role :db, "wbfwzx.com", :primary => true # This is where Rails migrations will run



#role :db, "your slave db-server here"



set :deploy_to, "/home/xiao/#{application}"



set :mongrel_conf, "#{deploy_to}/current/config/mongrel_cluster.yml"



set :runner, "xiao"



set :user, "xiao"



on :start do



`ssh-add`



end



namespace :deploy do



task :restart do



restart_mongrel_cluster



end



end

你可能感兴趣的:(capistrano)