Commit 2e6ef4d5

mo k <mo@mokhan.ca>
2012-09-22 22:04:52
update cap deployment to symlink the database.yml file in the shared dir.
1 parent ff5788e
Changed files (2)
config/deploy.rb
@@ -22,8 +22,11 @@ set :branch, "master"
 set :deploy_env, 'production'
 set :scm_verbose, true
 
-# ugly workaround for bug https://github.com/capistrano/capistrano/issues/81
-#before "deploy:assets:precompile", "update_bundler"
+after "deploy", "deploy:cleanup" # remove old releases
+after 'deploy:update_code', 'deploy:symlink_db'
 
-# remove old releases
-after "deploy", "deploy:cleanup"
+namespace :deploy do
+  task :symlink_db, :roles => :app do
+    run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
+  end
+end
capfile
@@ -14,11 +14,6 @@ task :show_free_space, :roles => :web do
   run "df -h /"
 end
 
-task :update_bundler do
-  #run "bundle install --gemfile #{release_path}/Gemfile"
-  #run "cd #{release_path} && bundle exec rake db:migrate RAILS_ENV=production && bundle exec rake db:seed RAILS_ENV=production"
-end
-
 task :backup_db do
   filename = "#{deploy_env}-#{Time.now.strftime('%Y-%m-%d')}.sql"
   run "pg_dump --clean cakeside_production > ~/db/backups/#{filename}"
@@ -29,6 +24,5 @@ task :restore_db do
   dumpfile = "~/db/backups/latest"
   destination_db = "cakeside_production"
   upload("latest", "db/backups/latest", :via => :scp)
-  #run "psql -U cakeside -d #{destination_db} -f #{dumpfile}"
   run "psql #{destination_db} < #{dumpfile}"
 end