[英]Deploying with Capistrano from Local Machine to VPS
I'm trying to deploy a Rails application from my local machine to the VPS through Capistrano. 我正在尝试通过Capistrano将Rails应用程序从本地计算机部署到VPS。 I've installed Capistrano by including it in the Gemfile and running 'bundle'.
我通过将Capistrano包含在Gemfile中并运行“ bundle”来安装它。 Then I ran 'capify .'
然后我跑了“ capify”。 and added the ff to the Capfile.
并将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. 现在,我陷入了deploy.rb,我不确定应该在文件中输入什么值。 If I don't host my code in Github or other online repositories, what should I place in the set :repository option?
如果我没有在Github或其他在线存储库中托管代码,应该在set:repository选项中放置什么? And what exactly is set :domain?
究竟设置了什么:域? Should I use the ip address of my VPS machine here?
我应该在这里使用我的VPS机器的IP地址吗? 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.
顺便说一句,我正在关注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
set :scm, :none
set :deploy_via, :rsync_with_remote_cache
You can also try :deploy_via, :copy
. 您也可以尝试
: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. 至于
:domain
选项,您遵循的示例将其用于命名和访问服务器。 I'd suggest just hardcoding the ip addresses with the servers for now. 我建议暂时仅使用服务器对IP地址进行硬编码。 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):
我知道这不是DRY,但是如果您的群集大小增加,则需要更改这些值(或者现在暂时将ip设置为变量-没关系):
set :deploy_to, "/home/#{user}/#{application}"
role :web, "1.2.3.4"
role :app, ["1.2.3.5", "1.2.3.6"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.