add deploy files for ant install
[arvados.git] / config / deploy.ant.rb
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"
6 role :db, "orvos-app-0.ant", :primary=>true
7 set :scm,         :git
8 set :repository,  "git@git.clinicalfuture.com:vcffarm.git"
9 set :rails_env,   "production"
10 set :config_files, ['database.yml']
11 set :git_enable_submodules, true
12 set :rvm_ruby_string, '1.9.3'
13 require "rvm/capistrano"
14 load "deploy/assets"
15 default_run_options[:shell] = '/bin/bash --login'
16
17 ssh_options[:forward_agent] = true
18 ssh_options[:user] = 'root'
19
20 desc "Clean up old releases"
21 set :keep_releases, 5
22 before("deploy:cleanup") { set :use_sudo, false }
23
24 before "deploy:assets:precompile", "deploy:copy_files", :roles => :app
25 after "deploy:copy_files", "deploy:bundle_install", :roles => :app
26 after "deploy:update", "deploy:migrate", :roles => :db
27 after :deploy, 'deploy:cleanup', :roles => :app
28
29 namespace :deploy do
30   desc "Put a few files in place, ensure correct file ownership"
31   task :copy_files, :roles => :app,  :except => { :no_release => true } do
32     # Copy a few files/make a few symlinks
33     run "cp /home/passenger/explorer/secret_token.rb #{release_path}/config/initializers/secret_token.rb"
34     run "cp /home/passenger/explorer/production.rb #{release_path}/config/environments/production.rb"
35     # Ensure correct ownership of a few files
36     run "chown www-data:www-data #{release_path}/config/environment.rb"
37     run "chown www-data:www-data #{release_path}/config.ru"
38     run "touch #{release_path}/db/production.sqlite3"
39     run "chown www-data:www-data #{release_path}/db/production.sqlite3"
40     run "chown root:www-data #{release_path}/db"
41     run "chmod g+w,+t #{release_path}/db"
42     # This is for the drb server
43     run "touch #{release_path}/Gemfile.lock"
44     run "chown www-data:www-data #{release_path}/Gemfile.lock"
45     # Keep track of the git commit used for this deploy
46     # This is used by the lib/add_debug_info.rb middleware, which injects it in the
47     # environment.
48     run "cd #{release_path}; /usr/bin/git rev-parse HEAD > #{release_path}/git-commit.version"
49
50     # make sure to symlink the vendor bundle. Cf. http://gembundler.com/rationale.html
51     run "cd #{release_path}; ln -s #{shared_path}/vendor_bundle #{release_path}/vendor/bundle"
52   end
53
54   # desc "Install new gems if necessary"
55   task :bundle_install, :roles => :app,  :except => { :no_release => true } do
56     run "cd #{release_path} && bundle install --deployment"
57   end
58
59   desc "Restarting mod_rails with restart.txt"
60   task :restart, :roles => :app, :except => { :no_release => true } do
61     # Tell passenger to resetart.
62     run "touch #{release_path}/tmp/restart.txt"
63   end
64
65 end