0
我已經設置過,但現在無法使用它。我想要一個開發和生產網站。當我做帽子部署時,它會設置一個「當前」符號鏈接(不知道我是如何做到這一點,因爲很長一段時間它不會這樣做)。但是,如何獲得它來部署和設置dev/prod所需的符號鏈接?Capistrano多階段 - 不創建開發/產品符號鏈接(僅限'當前')
我deploy.rb文件:
#require 'bundler/capistrano'
require 'capistrano/ext/multistage'
require 'capistrano_colors'
set :stages, %w(development production)
set :default_stage, 'development'
set :application, "myapp"
set :repository, "***"
# Target directory on the server
set :deploy_to, "/var/www/#{application}"
set :scm, :git
set :deploy_via, :remote_cache
set :user, '***'
set :use_sudo, false
role :web, "68.225.130.30" # Your HTTP server, Apache/etc
role :app, "68.225.130.30" # This may be the same as your `Web` server
role :db, "68.225.130.30", :primary => true # This is where Rails migrations will run
# List of symlinks to be generated. Keys are subdirectories of release_path.
SYMLINKS = { :config => ['database.yml'],
:public => ['system'] }
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')}"
# Not working =/
#run "touch /var/www/#{current_path}/tmp/restart.txt"
end
desc "Set up application symlinks."
task :app_symlinks do
SYMLINKS.keys.each do |key|
dir = key.to_s
SYMLINKS[key].each do |path|
run "ln -nfs #{shared_path}/#{dir}/#{path} #{release_path}/#{dir}/#{path}"
end
end
end
end
我的部署/ development.rb文件:
set :deploy_to, "/var/www/#{application}"
set :branch, "master"
unset :rails_env
set :rails_env, "development"
UPDATE /回答:
問題是與變量的current_path。奇怪,因爲我一直在使用
集嘗試:的current_path, 「發展」
和
集:的current_path, 「#{}應用程序/開發」
,並沒有奏效。看起來我必須設置整個路徑,這看起來很奇怪,因爲我之前使用過後者。
set :current_path, "/var/www/#{application}/development"
任何人都知道爲什麼?