This link has been bookmarked by 6 people . It was first bookmarked on 21 Jul 2007, by Ken Wei.
-
21 Mar 08
-
28 Sep 07
-
Managing database.yml with Capistrano
Posted by Jeremy Voorhis Thu, 06 Jul 2006 21:43:00 GMT
At PLANET ARGON, we typically do not keep our
database.ymlfiles in subversion, leaving behind adatabase.yml.examplefile instead. This makes it easy for us to share the repository with multiple developers who work on their own conventions, or sometimes an alternate database engine. We still want to have a one-step automated deployment process, however, and ssh-ing into the server to createdatabase.ymlmanually just feels a little… uncouth.The solution? Building upon Tim’s post at “http://toolmantim.com/article/2006/5/26/setting_up_capistrano_on_segpub”, our Capistrano deployment recipe now writes
database.ymlafter we deploy, and symlinks it to the latest release directory after we update the code. Here is the code that lets us do that:desc "Create database.yml in shared/config" task :after_setup do database_configuration = render :template => <<-EOF login: &login adapter: postgresql host: localhost port: <%= postgresql_port %> username: <%= user %> password: <%= password %> development: database: <%= "#{application}_development" %> <<: *login test: database: <%= "#{application}_test" %> <<: *login production: database: <%= "#{application}_production" %> <<: *login EOF run "mkdir -p #{deploy_to}/#{shared_dir}/config" put database_configuration, "#{deploy_to}/#{shared_dir}/config/database.yml" end desc "Link in the production database.yml" task :after_update_code do run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml" end
-
-
09 Aug 07
-
21 Jul 07
-
28 Sep 06
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.