저는 Capistrano를 사용하여 스테이징 및 프로덕션에 Ruby On Rails 응용 프로그램을 배포하려고합니다. 도메인과 : : 여기이 가이드 따랐다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"첫 번째 라인으로 하나의 맹세 단어를 가지고 "캡 배포"내게 예상 오류를 제공 변경되었습니다.
이`method_missing': undefined local variable or method `domain'
문제의 라인은 다음과 같습니다 :
role :web, domain
나는 하나가 "staging.rb"또는 "production.rb"나는 같은 오류의 첫 번째 줄에 단어를 맹세 넣으면 값을 선택하지 않기 때문에
입니다. 하지만 반드시 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"
: domain 및 : repository를 주 "deploy.rb"에 넣으면 모든 것이 잘 작동합니다. 그래서
set :domain, 'example.com'
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :repository, "ssh://[email protected]/~/rails/chamonix-mont-blanc.net"
이 deploy.rb
에서 역할 코드를 제거처럼 staging.rb
파일
Spot on. 대단히 감사합니다 !! 모든 일. 나는 피자 배달 회사에게 그들의 직업을 원하지 않는다고 말할 것입니다 !! –