IP:192.168.1.100
开发服务器,capistrano 发布服务器
svn地址:svn://192.168.1.100/svnweb
svn发布目录:/app/dev_public
IP:192.168.1.200
web服务器
使用svn用户将svn项目svn://192.168.1.100/svnweb checkout 到/tmp/20130108***下通过sftp将/tmp/20130108***文件打为tgz,并上传到web服务器tmp/20130108***.tgz,并将/tmp/20130108***.tgz解压到web服务器/opt/webroot/目录。
Ruby下载 http://ishare.iask.sina.com.cn/download/explain.php?fileid=9554760
RubyGames下载 http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.8.9.tgz
Ruby安装
# tar jxf ruby-1.9.2-p0.tar.bz2
# cd ruby-1.9.2-p0
# ./configure
# make && make install
RubyGames安装
# cd rubygems-1.8.9
`-- config
`-- deploy.rb
set :repository, "svn://192.168.1.100/svnweb"
set :scm_username, 'dev_public'
set :scm_password, 'dev_public'
set :checkout, "export"
#role :db, "192.168.1.201"
set :deploy_via, :copy
set :runner, "devpass"
set :password, "devpass"
set :use_sudo, true
namespace :deploy do
task :restart, :roles => :web do
run "sudo chown www:www -R /opt/webroot/"
end
end
set :runner web服务器运行用户名
task :restart, :roles => :web do
run "sudo chown www:www -R /opt/webroot/"
end
end
|-- current
|-- releases
`-- shared
|-- log
|-- pids
`-- system
# cap deploy:check #检查web服务器上文件夹权限
# cap deploy #代码发布
cap deploy:check # Test deployment dependencies.
cap deploy:cleanup # Clean up old releases.
cap deploy:cold # Deploys and starts a `cold' application.
cap deploy:create_symlink # Updates the symlink to the most recently deplo...
cap deploy:finalize_update # [internal] Touches up the released code.
cap deploy:migrate # Run the migrate rake task.
cap deploy:migrations # Deploy and run pending migrations.
cap deploy:pending # Displays the commits since your last deploy.
cap deploy:pending:diff # Displays the `diff' since your last deploy.
cap deploy:restart #
cap deploy:rollback # Rolls back to a previous version and restarts.
cap deploy:rollback:cleanup # [internal] Removes the most recently deployed ...
cap deploy:rollback:code # Rolls back to the previously deployed version.
cap deploy:rollback:revision # [internal] Points the current symlink at the p...
cap deploy:setup # Prepares one or more servers for deployment.
cap deploy:start # Blank task exists as a hook into which to inst...
cap deploy:stop # Blank task exists as a hook into which to inst...
cap deploy:symlink # Deprecated API.
cap deploy:update # Copies your project and updates the symlink.
cap deploy:update_code # Copies your project to the remote servers.
cap deploy:upload # Copy files to the currently deployed version.
cap invoke # Invoke a single command on the remote servers.
cap shell # Begin an interactive Capistrano session