1 set :application, "vcffarm"
2 set :domain, "orvos-app-0.ant"
3 set :deploy_to, "/var/www/orvos-explorer.ant.freelogy.org"
4 role :web, "orvos-app-0.ant"
5 role :app, "orvos-app-0.ant"
7 set :repository, "git@git.clinicalfuture.com:vcffarm.git"
8 set :rails_env, "production"
9 set :git_enable_submodules, true
10 set :rvm_ruby_string, '1.9.3'
11 require "rvm/capistrano"
13 default_run_options[:shell] = '/bin/bash --login'
15 ssh_options[:forward_agent] = true
16 ssh_options[:user] = 'root'
18 desc "Clean up old releases"
20 before("deploy:cleanup") { set :use_sudo, false }
22 before "deploy:assets:precompile", "deploy:copy_files", :roles => :app
23 after "deploy:copy_files", "deploy:bundle_install", :roles => :app
24 after :deploy, 'deploy:cleanup', :roles => :app
27 desc "Put a few files in place, ensure correct file ownership"
28 task :copy_files, :roles => :app, :except => { :no_release => true } do
29 # Copy a few files/make a few symlinks
30 run "cp /home/passenger/explorer/secret_token.rb #{release_path}/config/initializers/secret_token.rb"
31 run "cp /home/passenger/explorer/production.rb #{release_path}/config/environments/production.rb"
32 # Ensure correct ownership of a few files
33 run "chown www-data:www-data #{release_path}/config/environment.rb"
34 run "chown www-data:www-data #{release_path}/config.ru"
35 run "touch #{release_path}/db/production.sqlite3"
36 run "chown www-data:www-data #{release_path}/db/production.sqlite3"
37 run "chown root:www-data #{release_path}/db"
38 run "chmod g+w,+t #{release_path}/db"
39 # Keep track of the git commit used for this deploy
40 # This is used by the lib/add_debug_info.rb middleware, which injects it in the
42 run "cd #{release_path}; /usr/bin/git rev-parse HEAD > #{release_path}/git-commit.version"
44 # make sure to symlink the vendor bundle. Cf. http://gembundler.com/rationale.html
45 run "cd #{release_path}; ln -s #{shared_path}/vendor_bundle #{release_path}/vendor/bundle"
48 # desc "Install new gems if necessary"
49 task :bundle_install, :roles => :app, :except => { :no_release => true } do
50 run "cd #{release_path} && bundle install --deployment"
53 desc "Restarting mod_rails with restart.txt"
54 task :restart, :roles => :app, :except => { :no_release => true } do
55 # Tell passenger to restart.
56 run "touch #{release_path}/tmp/restart.txt"