私はRuby On Railsアプリケーションをステージングとデプロイの両方に配置しようとしています。カスケードラノがステージングとプロダクションにデプロイ
2間の唯一の違いは次のとおりです。ドメインと:私はネットを中心に探索していると私は見つけるすべては基本的に何を焼き直し記事ですhttps://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
:リポジトリ
私はここに、このガイドに従っています私は上記を持っています。
私はちょうど設定しようとしている:私は確信して私はサブのdirsを綴ら作るために私のスペルをチェックして設定/展開/ staging.rbおよび設定/展開/ production.rb
でリポジトリ:ドメインとを正しく、ファイルの名前。
この記事を読む:staging and live app with capistrano私はちょうどここに違いを宣言できるように見えます。
staging.rbファイルが実際に読み取られているようには見えません。私は私の "deploy.rb"を変更して、最初の行として単一の誓いの言葉を持つようにしました。 "cap deploy"は私に予想されるエラーを与えます。
私はシングルが「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
そして、私のconfig /デプロイ/ staging.rbファイル:
set :domain, 'example.com'
set :repository, "ssh://[email protected]/~/rails/chamonix-mont-blanc.net"
:domainと:repositoryをメインの "deploy.rb"に入れると、すべて正常に動作します。あなたのstaging.rb
ファイルへ
Spot on。どうもありがとうございました!!すべて働いている。ピザ宅配会社に仕事をしたくないと伝えます。 –