capistrano将database.yml部署为release而不是current

时间:2013-06-10 02:19:50

标签: ruby-on-rails-3 capistrano

我的capistrano resipe尝试从releases目录中提取databse.yml而不是

/var/www/pantry/current/config/database.yml

并因以下错误而崩溃:

No such file or directory - /var/www/pantry/releases/20130610020222/config/database.yml

我的deploy.rb

require "rvm/capistrano"
require "bundler/capistrano"
set :application, "pantry"
set :repository,  "git@github.com:tbrooke/food-pantry-manager.git"
set :user, 'deployer'
set :ssh_options, {:forward_agent => true}
set :use_sudo, false
set :rvm_type, :user
default_run_options[:pty] = true
set :scm, :git

set :deploy_to, "/var/www/pantry"
set :branch, "master"
set :deploy_via, :remote_cache
set :use_sudo, false

server "192.168.1.30", :web, :app, :db, primary: true

ssh_options[:forward_agent] = true

role :web,    "192.168.1.30"
role :app,    "192.168.1.30"
role :db,     "192.168.1.30", :primary => true

after "deploy", "deploy:migrate"

after 'deploy:update_code', 'deploy:symlink_db'

namespace  :deploy do
   desc "Symlinks the database.yml"
   task :symlink_db, :roles => :app do
   run "ln -nfs #{shared_path}config/database.yml #{release_path}/config/database.yml"
   end
end

require 'simple-capistrano-unicorn'
after :deploy, "unicorn:restart"

如何将其更改为指向当前目录?

1 个答案:

答案 0 :(得分:0)

而不是

#{release_path}/config/database.yml

使用

#{current_path}/config/database.yml