我正在尝试通过 Capistrano 将 Rails 应用程序从本地计算机部署到 VPS。我已经通过将 Capistrano 包含在 Gemfile 中并运行“捆绑包”来安装它。然后我跑了'capify'。并将ff添加到Capfile。
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p136@foobar'
现在,我被 deploy.rb 卡住了,我不确定我应该在文件中输入什么值。如果我不在 Github 或其他在线存储库中托管我的代码,我应该在 set :repository 选项中放置什么?究竟设置了什么:域?我应该在这里使用我的 VPS 机器的 IP 地址吗?顺便说一句,我正在学习http://infinite-sushi.com/2011/01/deploying-a-rails-app-to-a-linode-box/的教程,这里是示例 deploy.rb。
set :user, 'deploy'
set :domain, 'foo.bar.us'
set :application, "my_web_app"
set :repository, "git@github.com:foo/repo.git" # Your clone URL
set :scm, "git"
set :branch, "master"
set :scm_verbose, true
set :deploy_via, :remote_cache
set :scm_passphrase, "password" # The deploy user's password
set :deploy_to, "/home/#{user}/#{domain}"
set :use_sudo, false
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end