Jez*_*dle 6 capistrano ruby-on-rails
我正在尝试使用Capistrano将Ruby On Rails应用程序部署到暂存和生产.
两者之间的唯一区别是:domain和:repository
我在这里遵循了这个指南:https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
我在网上搜索过,我找到的所有文章基本上都与我上面的内容相同.
我试过在config/deploy/staging.rb和config/deploy/production.rb中设置:domain和:repository
我检查了我的拼写,以确保我正确地拼写了子目录和文件的名称.
阅读本文:使用capistrano登台和实时应用程序看起来我应该能够在这里声明差异.
它看起来并不像实际上正在读取staging.rb文件.我将"deploy.rb"更改为第一行有一个单词,"cap deploy"给出了预期的错误.
如果我在"staging.rb"或"production.rb"的第一行放一个单词,我会得到同样的错误:
`method_missing': undefined local variable or method `domain'
Run Code Online (Sandbox Code Playgroud)
有问题的一行是:
role :web, domain
Run Code Online (Sandbox Code Playgroud)
因为价值没有被提取.但是肯定它应该在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
Run Code Online (Sandbox Code Playgroud)
和我的config/deploy/staging.rb文件:
set :domain, 'example.com'
set :repository, "ssh://dave@example.com/~/rails/chamonix-mont-blanc.net"
Run Code Online (Sandbox Code Playgroud)
如果我将:domain和:repository放在主"deploy.rb"中,那么一切正常,花花公子.
移动roles到您的staging.rb文件,使其看起来像
set :domain, 'example.com'
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :repository, "ssh://dave@example.com/~/rails/chamonix-mont-blanc.net"
Run Code Online (Sandbox Code Playgroud)
从中删除角色代码deploy.rb.此外,你必须修改production.rb类似的.
| 归档时间: |
|
| 查看次数: |
13538 次 |
| 最近记录: |