Merge branch 'master' into authentication
[lyrix.git] / config / deploy.rb
bloba2fd3f79a1ba2d931388e1039c9f4e43988cd5f6
1 set :application, "lyrix"
2 set :repository,  "git://repo.or.cz/lyrix.git"
3 set :user, "jcmcarpetcare"
5 # If you aren't deploying to /u/apps/#{application} on the target
6 # servers (which is the default), you can specify the actual location
7 # via the :deploy_to variable:
8 set :deploy_to, "/home/#{user}/sites/#{application}"
10 # If you aren't using Subversion to manage your source code, specify
11 # your SCM below:
12 set :scm, :git
13 set :scm_command, "~/bin/git"
14 set :git_dir, "#{shared_path}/git"
16 set :use_sudo, false
17 #set :deploy_via, :copy
19 role :app, "jcmcarpetcare.com"
20 role :web, "jcmcarpetcare.com"
21 role :db,  "jcmcarpetcare.com", :primary => true
23 require 'erb'
25 before "deploy:setup", :db
26 after "deploy:update_code", "db:symlink"
28 namespace :db do
29   desc "Create database yaml in shared path"
30   task :default do
31     db_config = ERB.new <<-EOF
32 base: &base
33   adapter: mysql
34   host: localhost
35   username: #{user}
36   password: PASSWORD
38 development:
39   database: #{application}_dev
40   <<: *base
42 test:
43   database: #{application}_test
44   <<: *base
46 production:
47   database: #{application}_prod
48   <<: *base
49     EOF
51     run "mkdir -p #{shared_path}/config"
52     put db_config.result, "#{shared_path}/config/database.yml"
53   end
55   desc "Make symlink for database yaml"
56   task :symlink do
57     run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
58   end
59 end
61 namespace :deploy do 
62   desc <<-DESC 
63     Sets up the git repository clones to :git_dir on the app servers. 
64   DESC
65   task :git_clone, :except => { :no_release => true } do 
66     run(source.clone) 
67   end 
68 end