我正在使用Rails 2.3.5开发Dreamhost服务器。
每次我对网站进行更改时,我都必须ssh进入网站,删除所有文件,上传包含该网站所有新文件的zip文件,解压缩该文件,迁移数据库,然后继续。 / p>
有些东西告诉我,部署rails应用程序的速度更快。我正在使用mac Time Machine来跟踪我的应用程序的不同版本。我知道git跟踪文件,但我真的不知道如何使用它来部署我的应用程序,因为乘客为我照顾了所有的魔力。
什么是更快的部署应用程序的方式(并且当我删除服务器上的所有文件时避免与我的方法相关的停机时间?)
谢谢!
答案 0 :(得分:4)
看看Capistrano。
答案 1 :(得分:1)
你肯定需要git和capistrano。
我的部署过程:
git commit
git push
cap deploy
Git很直接。 github.com上有大量的资源和方法。 如果你没有使用源代码控制,你绝对必须解决这个问题......
答案 2 :(得分: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