caploy 0.2.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/caploy.gemspec +6 -12
- data/lib/caploy/railtie.rb +13 -0
- data/lib/caploy/recipes/assets.rb +11 -19
- data/lib/caploy/recipes/database.rb +44 -47
- data/lib/caploy/recipes/deploy.rb +219 -0
- data/lib/caploy/recipes/info.rb +24 -28
- data/lib/caploy/recipes/memcache.rb +9 -13
- data/lib/caploy/recipes/nginx.rb +82 -86
- data/lib/caploy/recipes/paperclip.rb +7 -8
- data/lib/caploy/recipes/seeding.rb +3 -5
- data/lib/caploy/recipes/setup.rb +31 -35
- data/lib/caploy/recipes/taillog.rb +22 -0
- data/lib/caploy/recipes/unicorn.rb +109 -108
- data/lib/caploy/templates/unicorn/unicorn.rb.erb +2 -2
- data/lib/caploy/version.rb +1 -1
- data/lib/caploy.rb +16 -1
- metadata +34 -153
- data/lib/caploy/recipes/airbrake.rb +0 -4
- data/lib/caploy/recipes/bundler.rb +0 -25
- data/lib/caploy/recipes/defaults.rb +0 -132
- data/lib/caploy/recipes/monitoring.rb +0 -12
- data/lib/caploy/recipes/passenger.rb +0 -32
- data/lib/caploy/recipes/puma.rb +0 -25
- data/lib/caploy/recipes/rbenv.rb +0 -7
- data/lib/caploy/recipes/redis.rb +0 -41
- data/lib/caploy/recipes/rvm.rb +0 -8
- data/lib/caploy/recipes/symlink.rb +0 -24
- data/lib/caploy/recipes/unicorn_bluepill.rb +0 -90
- data/lib/caploy/recipes/whenever.rb +0 -8
- data/lib/caploy/templates/bluepill/init.erb +0 -9
- data/lib/caploy/templates/bluepill/unicorn_config.rb.erb +0 -43
@@ -1,90 +0,0 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# sudoers:
|
4
|
-
# %deploy ALL=(ALL) NOPASSWD: /usr/local/bin/bluepill, /sbin/start my_app_bluepill , /sbin/stop my_app_bluepill
|
5
|
-
# sudo chown root:root deploy_conf
|
6
|
-
# sudo chmod 0440 deploy_conf
|
7
|
-
# => /etc/sudoers.d
|
8
|
-
#
|
9
|
-
Capistrano::Configuration.instance.load do
|
10
|
-
|
11
|
-
namespace :deploy do
|
12
|
-
|
13
|
-
task :start, :roles => :app, :except => { :no_release => true } do
|
14
|
-
sudo 'start bluepill_conf'
|
15
|
-
end
|
16
|
-
|
17
|
-
task :stop, :roles => :app, :except => { :no_release => true } do
|
18
|
-
sudo "bluepill stop"
|
19
|
-
sudo "stop bluepill_conf"
|
20
|
-
end
|
21
|
-
|
22
|
-
task :restart, :roles => :app, :except => { :no_release => true } do
|
23
|
-
sudo "bluepill restart unicorn"
|
24
|
-
end
|
25
|
-
|
26
|
-
#desc "Restart Resque Workers"
|
27
|
-
#task :restart_workers do
|
28
|
-
# sudo "bluepill stop resque"
|
29
|
-
# sudo "bluepill start resque"
|
30
|
-
#end
|
31
|
-
#
|
32
|
-
#desc "Start Resque Workers"
|
33
|
-
#task :start_workers do
|
34
|
-
# sudo "bluepill start resque"
|
35
|
-
#end
|
36
|
-
#
|
37
|
-
#desc "Stop Resque Workers"
|
38
|
-
#task :stop_workers do
|
39
|
-
# sudo "bluepill stop resque"
|
40
|
-
#end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
namespace :bluepill do
|
45
|
-
desc "Prints bluepills monitored processes statuses"
|
46
|
-
task :status, :roles => [:app] do
|
47
|
-
sudo "bluepill status"
|
48
|
-
end
|
49
|
-
|
50
|
-
desc "Setup blupill config"
|
51
|
-
task :setup, :roles => [:app] do
|
52
|
-
setup_init
|
53
|
-
setup_config
|
54
|
-
end
|
55
|
-
|
56
|
-
task :setup_init do
|
57
|
-
template_path = File.expand_path('../../templates/bluepill/init.erb', __FILE__)
|
58
|
-
vars = {
|
59
|
-
'application' => application,
|
60
|
-
'config_path' => fetch(:bluepill_config_path, "#{shared_path}/config/bluepill_config.pill")
|
61
|
-
}
|
62
|
-
|
63
|
-
config_path = "#{shared_path}/config/bluepill_init.conf"
|
64
|
-
|
65
|
-
put(render_erb_template(template_path, vars), config_path)
|
66
|
-
sudo "rm -f /etc/init/bluepill_#{application}_#{stage}.conf"
|
67
|
-
sudo "ln -s #{config_path} /etc/init/bluepill_#{application}_#{stage}.conf"
|
68
|
-
end
|
69
|
-
|
70
|
-
task :setup_config do
|
71
|
-
template_path = File.expand_path('../../templates/bluepill/default_config.rb.erb', __FILE__)
|
72
|
-
log_file = "#{latest_release}/log/bluepill.log"
|
73
|
-
unicorn_config_path = "#{shared_path}/config/unicorn/#{stage}.rb"
|
74
|
-
vars = {
|
75
|
-
'application' => application,
|
76
|
-
'stage' => stage,
|
77
|
-
'log_file' => log_file,
|
78
|
-
'unicorn_config_path' => unicorn_config_path
|
79
|
-
}
|
80
|
-
|
81
|
-
config_path = fetch(:bluepill_config_path, "#{shared_path}/config/bluepill_config.pill")
|
82
|
-
put(render_erb_template(template_path, vars), config_path)
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
#after "deploy:restart", "deploy:restart_workers"
|
88
|
-
after "deploy:setup", "bluepill:setup"
|
89
|
-
|
90
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "<%= stage %>"
|
2
|
-
|
3
|
-
Bluepill.application("<%= application %>-<%= stage %>", :log_file => '<%= log_file %>') do |app|
|
4
|
-
|
5
|
-
app.process("unicorn") do |process|
|
6
|
-
process.pid_file = '<%= unicorn_config_path %>'
|
7
|
-
process.working_dir = '/var/my_app/current'
|
8
|
-
|
9
|
-
process.start_command = "/usr/local/bin/bundle exec unicorn -c /var/my_app/current/config/unicorn.rb -E staging -D"
|
10
|
-
process.stop_command = "kill -QUIT {{PID}}"
|
11
|
-
process.restart_command = "kill -USR2 {{PID}}"
|
12
|
-
|
13
|
-
process.uid = process.gid = 'deploy'
|
14
|
-
|
15
|
-
process.start_grace_time = 30.seconds
|
16
|
-
process.stop_grace_time = 30.seconds
|
17
|
-
process.restart_grace_time = 30.seconds
|
18
|
-
|
19
|
-
|
20
|
-
process.monitor_children do |child_process|
|
21
|
-
child_process.stop_command = "kill -QUIT {{PID}}"
|
22
|
-
|
23
|
-
child_process.checks :mem_usage, :every => 30.seconds, :below => 200.megabytes, :times => [3, 4], :fires => :stop
|
24
|
-
child_process.checks :cpu_usage, :every => 30.seconds, :below => 40, :times => [3, 4], :fires => :stop
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
2.times do |i|
|
29
|
-
app.process("resque-#{i}") do |process|
|
30
|
-
process.working_dir = '/var/my_app/current'
|
31
|
-
process.group = "resque"
|
32
|
-
process.start_command = "/usr/local/bin/bundle exec rake resque:work"
|
33
|
-
process.pid_file = "/var/my_app/shared/pids/my_app-resque-#{i}.pid"
|
34
|
-
process.stop_command = "kill -QUIT {{PID}}"
|
35
|
-
process.daemonize = true
|
36
|
-
|
37
|
-
process.start_grace_time = 30.seconds
|
38
|
-
process.stop_grace_time = 30.seconds
|
39
|
-
process.uid = process.gid = 'deploy'
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|