Do not try to start a job when too few slurm nodes are idle. refs #1417
[arvados.git] / config / deploy.ant.rb
1 set :application, "orvos-server"
2 set :domain,      "orvos.ant"
3 set :deploy_to,   "/var/www/7tzkq.orvosapi.com"
4 role :web, "orvos.ant"
5 role :app, "orvos.ant"
6 role :db, "orvos.ant", :primary=>true
7 set :scm,         :git
8 set :repository,  "git@git.clinicalfuture.com:orvos-server.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/orvos-server/database.yml #{release_path}/config/database.yml"
34     run "cp /home/passenger/orvos-server/secret_token.rb #{release_path}/config/initializers/secret_token.rb"
35     run "cp /home/passenger/orvos-server/production.rb #{release_path}/config/environments/production.rb"
36     run "cp /home/passenger/orvos-server/omniauth.rb #{release_path}/config/initializers/omniauth.rb"
37     # Ensure correct ownership of a few files
38     run "chown www-data:www-data #{release_path}/config/environment.rb"
39     run "chown www-data:www-data #{release_path}/config.ru"
40     run "chown www-data:www-data #{release_path}/config/database.yml"
41     # This is for the drb server
42     run "touch #{release_path}/Gemfile.lock"
43     run "chown www-data:www-data #{release_path}/Gemfile.lock"
44     # Keep track of the git commit used for this deploy
45     # This is used by the lib/add_debug_info.rb middleware, which injects it in the
46     # environment.
47     run "cd #{release_path}; /usr/bin/git rev-parse HEAD > #{release_path}/git-commit.version"
48     # make sure to symlink the vendor bundle. Cf. http://gembundler.com/rationale.html
49     run "cd #{release_path}; ln -s #{shared_path}/vendor_bundle #{release_path}/vendor/bundle"
50   end
51
52   # desc "Install new gems if necessary"
53   task :bundle_install, :roles => :app,  :except => { :no_release => true } do
54     run "cd #{release_path} && bundle install --deployment"
55   end
56
57   desc "Restarting mod_rails with restart.txt"
58   task :restart, :roles => :app, :except => { :no_release => true } do
59     # Tell passenger to restart.
60     run "touch #{release_path}/tmp/restart.txt"
61   end 
62 end