我想部署一个Ruby On Rails应用程序到舞台,然后使用Capistrano生产。Capistrano部署到舞台和生产
两者之间的唯一区别是:域和:仓库
我按照这个指南在这里:https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
找遍周围的净和我所看到的是,基本上老调重弹的文章是什么我有以上。
我曾尝试只需设置:域和:仓库在config /部署/ staging.rb和配置/部署/ production.rb
我检查了我的拼写,以确保我拼写子迪尔斯正确和文件的名称。
阅读本文:staging and live app with capistrano它看起来像我应该能够在这里宣布的差异。
它看起来不像staging.rb文件实际上被读取。我改变了我的“deploy.rb”作为第一行有一个单一的发誓词,“帽部署”给我预期的错误。
如果我把一个发誓“staging.rb”或“production.rb”我得到同样的错误的第一行字:
`method_missing': undefined local variable or method `domain'
有问题的行是:
role :web, domain
因为价值没有被拾起。但是,它肯定会在staging.rb或production.rb中的单个发誓词上失败并且根本不运行?
如果我将:domain和:repository移回到主要的“deploy.rb”文件中,我会发现发誓词的错误。所以看起来我不能在“staging.rg”和“production.rb”文件中设置变量,而只是完成任务。
任何帮助,将不胜感激或者你认为我应该采取送披萨的工作...
deploy.rb:
require 'capistrano/ext/multistage'
set :stages, %w(production staging)
set :default_stage, "staging"
set :user, 'dave'
set :applicationdir, "~/rails/example.com"
set :scm, 'git'
set :git_enable_submodules, 1 # if you have vendored rails
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :keep_releases, 5
after "deploy:update", "deploy:cleanup"
# roles (servers)
role :web, domain
role :app, domain
role :db, domain, :primary => true
after "deploy", "deploy:migrate"
# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export
# set :rake, 'bundle exec rake'
# additional settings
default_run_options[:pty] = true # Forgo errors when deploying from windows
set :ssh_options, {:forward_agent => true}
#ssh_options[:keys] = %w(/home/user/.ssh/id_rsa) # If you are using ssh_keysset :chmod755, "app config db lib public vendor script script/* public/disp*"set :use_sudo, false
# Passenger
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run " touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
而且我的配置/部署/ staging.rb文件:
set :domain, 'example.com'
set :repository, "ssh://[email protected]/~/rails/chamonix-mont-blanc.net"
如果我把主要的“deploy.rb”中的:domain和:repository一起工作正常和花哨。
Spot on。非常感谢你!!所有的工作。我会告诉比萨饼送货公司,我不想要他们的工作! – 2012-08-17 08:58:56