Last active
December 28, 2015 06:19
-
-
Save toddsampson/7456579 to your computer and use it in GitHub Desktop.
Database.yml and multi-stage Capistrano deployment blog post: http://www.cloudspace.com/blog/2009/09/18/database-yml-and-multi-stage-capistrano-deployment/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after "deploy:symlink", :update_config_file | |
after "deploy:symlink", :update_database_yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRODUCTION_DB_INTERNAL_IP = "1.2.3.4" | |
desc "Update database.yml with production information" | |
task :update_database_yml do | |
replacements = { "DATABASE_IP" => PRODUCTION_DB_INTERNAL_IP } | |
replacements.each_pair do |pattern, sub| | |
run "sed -i 's/#{pattern}/#{sub}/' /path/to/deploy/current/config/database.yml" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment