I'm trying to deploy a Rails application from my local machine to the VPS through Capistrano. I've installed Capistrano by including it in the Gemfile and running 'bundle'. Then I ran 'capify .' and added the ff to the Capfile.
我正在尝试通过Capistrano将Rails应用程序从本地计算机部署到VPS。我通过将它包含在Gemfile中并运行'bundle'来安装Capistrano。然后我跑'capify'。并将ff添加到Capfile中。
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p136@foobar'
Now, I'm stuck with the deploy.rb, I'm not sure what values should I put into the file. If I don't host my code in Github or other online repositories, what should I place in the set :repository option? And what exactly is set :domain? Should I use the ip address of my VPS machine here? Btw, I'm following the tutorial from http://infinite-sushi.com/2011/01/deploying-a-rails-app-to-a-linode-box/, and here's the sample deploy.rb.
现在,我坚持使用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
1 个解决方案
#1
1
set :scm, :none
set :deploy_via, :rsync_with_remote_cache
You can also try :deploy_via, :copy
. As for the :domain
option, the example you followed is using that for both naming as well as for accessing the server. I'd suggest just hardcoding the ip addresses with the servers for now. I know it's not DRY, but if your cluster grows in size, you'll want to change these values (or just set the ip to a variable for now -- it doesn't really matter):
您还可以尝试:deploy_via,:copy。对于:domain选项,您遵循的示例是将其用于命名和访问服务器。我建议暂时用服务器硬编码ip地址。我知道它不是DRY,但是如果你的集群规模增长,你会想要改变这些值(或者现在只需将ip设置为变量 - 这并不重要):
set :deploy_to, "/home/#{user}/#{application}"
role :web, "1.2.3.4"
role :app, ["1.2.3.5", "1.2.3.6"]
#1
1
set :scm, :none
set :deploy_via, :rsync_with_remote_cache
You can also try :deploy_via, :copy
. As for the :domain
option, the example you followed is using that for both naming as well as for accessing the server. I'd suggest just hardcoding the ip addresses with the servers for now. I know it's not DRY, but if your cluster grows in size, you'll want to change these values (or just set the ip to a variable for now -- it doesn't really matter):
您还可以尝试:deploy_via,:copy。对于:domain选项,您遵循的示例是将其用于命名和访问服务器。我建议暂时用服务器硬编码ip地址。我知道它不是DRY,但是如果你的集群规模增长,你会想要改变这些值(或者现在只需将ip设置为变量 - 这并不重要):
set :deploy_to, "/home/#{user}/#{application}"
role :web, "1.2.3.4"
role :app, ["1.2.3.5", "1.2.3.6"]