use ORVOS_API_TOKEN environment variable in rails console
[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 set :scm,         :git
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"
12 load "deploy/assets"
13 default_run_options[:shell] = '/bin/bash --login'
14
15 ssh_options[:forward_agent] = true
16 ssh_options[:user] = 'root'
17
18 desc "Clean up old releases"
19 set :keep_releases, 5
20 before("deploy:cleanup") { set :use_sudo, false }
21
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
25
26 namespace :deploy do
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
41     # environment.
42     run "cd #{release_path}; /usr/bin/git rev-parse HEAD > #{release_path}/git-commit.version"
43
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"
46   end
47
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"
51   end
52
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"
57   end
58
59 end