Reputation: 1289
I have added config/database.yml
to my .gitignore
file. And have added this to the deploy.rb file
namespace(:customs) do
task :symlink_db, :roles => :app do
run "cp #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
end
after "deploy:update_code", "customs:symlink_db"
But now that i run cap deploy
. I get the error
No such file or directory - /var/www/XXXX/releases/20130313100825/config/database.yml
How do i fix it ?
Note: there has already been a release before this. I made some changes to the app and deploying it again.
Thanks
Upvotes: 2
Views: 1121
Reputation: 4654
You want to use a symlink, as it will not care if the source file is not there yet.
task :symlink_db_yml do
run "ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
And you want to execute it before bundle:install, as the new application directory is not created at the deploy:update_code stage.
before 'bundle:install', 'customs:symlink_db_yml'
Upvotes: 2