capsum发布rails项目

安装最新版capsum 0.3.0:

$ gem install capsum  

到项目根目录下生成发布文件:

 

$ capify .

终端会有如下提示:

 

[add] writing './Capfile'

[add] writing './config/deploy.rb'

[done] capified!  

改写 config/deploy.rb文件:

 

require "capsum/typical3"



set :application, "your_project_name" #http://5433.com

set :repository, "git@yourserver:yourproject.git"

set :branch, "master"



set :shared, %w{

  config/database.yml

  Gemfile.local

  export_tmp  # link path

}  

脚本配置已经完毕, 初始化发布前设置的发布用户需有你的公钥证书,在www-data的用户目录下创建authorized_keys文件:

$  mkdir .ssh  

$  vi authorized_keys  # 贴入你的公钥证书然后 :w 保存退出.

 

添加config/deploy/production.rb文件并加入以下代码:

 

set :deploy_to, "/var/www/vhosts/apps/#{application}"  #deploy path

set :user, "www-data"  # deploy user

server "your server", :app, :web, :db, :primary => true

接下来我们初始化发布:

$  cap dev deploy:setup

 

执行发布脚本:

 

$ cap production deploy

 



你可能感兴趣的:(Rails)