微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – 使用Passenger部署rails应用程序的最快方法

我正在使用Rails 2.3.5开发Dreamhost服务器.

每次我对网站进行更改时,我都必须ssh进入网站,删除所有文件,上传包含该网站所有新文件的zip文件,解压缩该文件,迁移数据库,然后继续.

有些东西告诉我有一种更快的方式来部署rails应用程序.我正在使用mac Time Machine来跟踪我的应用程序的不同版本.我知道git跟踪文件,但我真的不知道如何使用它来部署我的应用程序,因为乘客为我照顾所有的魔力.

什么是更快的部署我的应用程序的方式(并避免在我删除服务器上的所有文件时与我的方法相关的停机时间)?

谢谢!

解决方法

然后去找自己的Capistrano助手: http://github.com/westarete/capistrano-helpers

这是我自己网站的简化注释部署文件.

require 'capistrano-helpers/branch'     # prompts for branch
require 'capistrano-helpers/passenger'  # Support for Apache passenger
require 'capistrano-helpers/version'    # Record the version number after deploying
require 'capistrano-helpers/privates'   # handle sensitive files
require 'capistrano-helpers/shared'

set :application,"site"
set :repository,"file://."

set :scm,"git"
set :branch,"rails3"
set :deploy_via,:copy

set :copy_exclude,[ ".git","assets","test","Capfile","vishvish.tmproj","bin" ]

set :deploy_to,"/blah/blah.com/#{application}"

set :user,"blah"
set :domain,"blah.com"

#Things you want symlinked afterwards,not in version control.
set :privates,%w{
  config/database.yml
}

#Things you want shared across deployments,not uploaded every time.
set :shared,%w{
  uploads
}

role :app,domain
role :web,domain
role :db,domain,:primary => true

namespace :deploy do
  desc "Restarting mod_rails with restart.txt"
  task :restart,:roles => :app,:except => { :no_release => true } do
    run "touch #{current_path}/tmp/restart.txt"
  end

  [:start,:stop].each do |t|
    desc "#{t} task is a no-op with mod_rails"
    task t,:roles => :app do ; end
  end
end

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐