This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.rb
86 lines (70 loc) · 2.17 KB
/
deploy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
namespace :bower do
desc 'Install bower'
task :install do
on roles(:web) do
within release_path do
execute :rake, 'bower:install CI=true'
end
end
end
desc 'Resolve bower'
task :resolve do
on roles(:web) do
within release_path do
execute :rake, 'bower:resolve CI=true'
end
end
end
end
before 'bower:resolve', 'bower:install'
before 'deploy:compile_assets', 'bower:resolve'
set :application, 'class_request_tool'
set :repo_url, '[email protected]:harvard-library/ClassRequestTool.git'
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_via, :copy
set :scm, :git
set :format, :pretty
# set :log_level, :debug
# set :pty, true
# Create these in /path/to/deploy/shared
set :linked_files, %w{config/customization.yml config/database.yml config/mailer.yml.erb config/reports.yml .env}
set :linked_dirs, %w{node_modules log tmp/pids tmp/cache tmp/sockets vendor/bundle public/assets public/system public/uploads}
set :keep_releases, 3
namespace :deploy do
desc 'Run arbitrary remote rake task'
task :rrake do
on roles(:app) do
within release_path do
execute :rake, "#{ENV['T']} --rakefile=#{release_path}/Rakefile RAILS_ENV=#{Proc.new do fetch(:rails_env) end.call}"
end
end
end
desc 'Restart application'
task :restart do
invoke 'delayed_job:restart'
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
after :restart, :crontab do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
execute :rake, "crt:cron_task:setup_crontab --rakefile=#{release_path}/Rakefile RAILS_ENV=#{Proc.new do fetch(:rails_env) end.call}"
end
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
after :finishing, :cleanup
end
# In order to see RVM while not part of a deploy
before 'deploy:migrate', 'rvm:hook'
before 'deploy:rrake', 'rvm:hook'
before 'bundler:install', 'rvm:hook'