2010-04-12 40 views
4

我正在使用Rails 2.3.5 Dreamhost服务器上工作。最快的方式与乘客部署rails应用程序

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

东西告诉我有一种更快的方式来部署rails应用程序。我使用Mac Time Machine来跟踪我的应用程序的不同版本。我知道git跟踪文件,但我真的不知道如何使用它来部署我的应用程序,因为乘客会为我处理所有魔术。

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

谢谢!

回答

1

,先去自己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 
1

你一定需要git和capistrano。

我的部署过程:

git commit 
git push 
cap deploy 

Git是非常直接的。 github.com上有很多资源和方法。 如果你不使用源代码控制你绝对必须解决这个问题......

相关问题