capistrano-delayed_job 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/Gemfile.lock +69 -0
- data/LICENSE +20 -0
- data/README.md +60 -0
- data/Rakefile +37 -0
- data/VERSION +1 -0
- data/capistrano-delayed_job.rb +11 -0
- data/capistrano-delayed_job/config.rb +28 -0
- data/capistrano-delayed_job/monit.rb +70 -0
- data/capistrano-delayed_job/runit.rb +80 -0
- data/templates/monit/delayed_job.conf.erb +16 -0
- data/templates/runit/log-run.erb +10 -0
- data/templates/runit/run.erb +6 -0
- metadata +127 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
6
|
+
capistrano (2.15.5)
|
7
|
+
highline
|
8
|
+
net-scp (>= 1.0.0)
|
9
|
+
net-sftp (>= 2.0.0)
|
10
|
+
net-ssh (>= 2.0.14)
|
11
|
+
net-ssh-gateway (>= 1.1.0)
|
12
|
+
capistrano-base_helper (0.0.3)
|
13
|
+
capistrano (>= 2.15.5)
|
14
|
+
faraday (0.8.7)
|
15
|
+
multipart-post (~> 1.1)
|
16
|
+
git (1.2.5)
|
17
|
+
github_api (0.10.1)
|
18
|
+
addressable
|
19
|
+
faraday (~> 0.8.1)
|
20
|
+
hashie (>= 1.2)
|
21
|
+
multi_json (~> 1.4)
|
22
|
+
nokogiri (~> 1.5.2)
|
23
|
+
oauth2
|
24
|
+
hashie (2.0.5)
|
25
|
+
highline (1.6.19)
|
26
|
+
httpauth (0.2.0)
|
27
|
+
jeweler (1.8.6)
|
28
|
+
builder
|
29
|
+
bundler (~> 1.0)
|
30
|
+
git (>= 1.2.5)
|
31
|
+
github_api (= 0.10.1)
|
32
|
+
highline (>= 1.6.15)
|
33
|
+
nokogiri (= 1.5.10)
|
34
|
+
rake
|
35
|
+
rdoc
|
36
|
+
json (1.8.0)
|
37
|
+
jwt (0.1.8)
|
38
|
+
multi_json (>= 1.5)
|
39
|
+
multi_json (1.7.7)
|
40
|
+
multi_xml (0.5.4)
|
41
|
+
multipart-post (1.2.0)
|
42
|
+
net-scp (1.1.1)
|
43
|
+
net-ssh (>= 2.6.5)
|
44
|
+
net-sftp (2.1.2)
|
45
|
+
net-ssh (>= 2.6.5)
|
46
|
+
net-ssh (2.6.7)
|
47
|
+
net-ssh-gateway (1.2.0)
|
48
|
+
net-ssh (>= 2.6.5)
|
49
|
+
nokogiri (1.5.10)
|
50
|
+
oauth2 (0.9.2)
|
51
|
+
faraday (~> 0.8)
|
52
|
+
httpauth (~> 0.2)
|
53
|
+
jwt (~> 0.1.4)
|
54
|
+
multi_json (~> 1.0)
|
55
|
+
multi_xml (~> 0.5)
|
56
|
+
rack (~> 1.2)
|
57
|
+
rack (1.5.2)
|
58
|
+
rake (10.1.0)
|
59
|
+
rdoc (4.0.1)
|
60
|
+
json (~> 1.4)
|
61
|
+
|
62
|
+
PLATFORMS
|
63
|
+
ruby
|
64
|
+
|
65
|
+
DEPENDENCIES
|
66
|
+
bundler (>= 1.3.0)
|
67
|
+
capistrano (>= 2.15.5)
|
68
|
+
capistrano-base_helper (>= 0.0.3)
|
69
|
+
jeweler (~> 1.8.6)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Leif Ringstad
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Capistrano Recipes for Delayed Job
|
2
|
+
|
3
|
+
This gem provides recipes for [Delayed Job](https://github.com/collectiveidea/delayed_job) to setup runit and monit
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add it to your Gemfile without requiring it
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'capistrano-delayed_job', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
In your deploy.rb:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'capistrano-delayed_job'
|
17
|
+
```
|
18
|
+
|
19
|
+
### Monit
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
cap delayed_job:monit:disable # Disable and stop monit services for Delayed Job
|
23
|
+
cap delayed_job:monit:enable # Enable monit services for Delayed Job
|
24
|
+
cap delayed_job:monit:monitor # Monitor Delayed Job
|
25
|
+
cap delayed_job:monit:restart # Restart monit services for Delayed Job
|
26
|
+
cap delayed_job:monit:setup # Setup Delayed Job monit-service
|
27
|
+
cap delayed_job:monit:start # Start monit services for Delayed Job (will also tr...
|
28
|
+
cap delayed_job:monit:stop # Stop monit services for Delayed Job (will also sto...
|
29
|
+
cap delayed_job:monit:unmonitor # Purge Delayed Job monit configuration
|
30
|
+
```
|
31
|
+
|
32
|
+
### Runit
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
cap delayed_job:runit:disable # Disable Delayed Job runit-service
|
36
|
+
cap delayed_job:runit:enable # Enable Delayed Job runit-service
|
37
|
+
cap delayed_job:runit:flush_sockets # Flush delayed_job sockets, as they can end up 'han...
|
38
|
+
cap delayed_job:runit:once # Start Delayed Job runit-service only ONCE (no supe...
|
39
|
+
cap delayed_job:runit:purge # Purge Delayed Job runit configuration
|
40
|
+
cap delayed_job:runit:quit # Quit the Delayed Job runit-service
|
41
|
+
cap delayed_job:runit:restart # Restart Delayed Job runit-service
|
42
|
+
cap delayed_job:runit:setup # Setup Delayed Job runit-service
|
43
|
+
cap delayed_job:runit:start # Start Delayed Job runit-service
|
44
|
+
cap delayed_job:runit:stop # Stop Delayed Job runit-service
|
45
|
+
```
|
46
|
+
|
47
|
+
## Configuration
|
48
|
+
|
49
|
+
See delayed_job/config.rb for default options, and ovveride any in your deploy.rb file.
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
* Fork the project
|
54
|
+
* Make a feature addition or bug fix
|
55
|
+
* Please test the feature or bug fix
|
56
|
+
* Make a pull request
|
57
|
+
|
58
|
+
## Copyright
|
59
|
+
|
60
|
+
(c) 2013 Leif Ringstad. See LICENSE for details
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "capistrano-delayed_job"
|
18
|
+
gem.homepage = "https://github.com/leifcr/capistrano-delayed_job"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Capistrano recipes for Delayed Job using runit and monit}
|
21
|
+
gem.description = %Q{Capistrano recipes for Delayed Job using runit and monit.}
|
22
|
+
gem.email = "leifcr@gmail.com"
|
23
|
+
gem.authors = ["Leif Ringstad"]
|
24
|
+
gem.files.exclude ".ruby-*"
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
# require 'rdoc/task'
|
30
|
+
# Rake::RDocTask.new do |rdoc|
|
31
|
+
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
32
|
+
|
33
|
+
# rdoc.rdoc_dir = 'rdoc'
|
34
|
+
# rdoc.title = "capistrano-empty #{version}"
|
35
|
+
# rdoc.rdoc_files.include('README*')
|
36
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
+
# end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,11 @@
|
|
1
|
+
def try_require(library)
|
2
|
+
begin
|
3
|
+
require "#{library}"
|
4
|
+
rescue LoadError => e
|
5
|
+
puts "Capistrano-Delayed Job: Cannot load library: #{library} Error: #{e}"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
try_require 'capistrano-delayed_job/config'
|
10
|
+
try_require 'capistrano-delayed_job/runit'
|
11
|
+
try_require 'capistrano-delayed_job/monit'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Capistrano::Configuration.instance(true).load do
|
2
|
+
_cset :delayed_job_runit_service_name, "delayed_job"
|
3
|
+
_cset :delayed_job_workers, 1 # More than 1 is not implemented yet.
|
4
|
+
|
5
|
+
_cset :delayed_job_bin, 'bundle exec rake jobs:work'
|
6
|
+
|
7
|
+
_cset :delayed_job_pid_file, defer {Capistrano::RunitBase::service_pid(fetch(:delayed_job_runit_service_name))}
|
8
|
+
|
9
|
+
# Logging to path
|
10
|
+
_cset :delayed_job_log_path, defer {"/var/log/service/#{fetch(:user)}/#{fetch(:application)}_#{Capistrano::BaseHelper.environment}/delayed_job"}
|
11
|
+
|
12
|
+
# runit paths
|
13
|
+
_cset :delayed_job_runit_local_config, File.join(File.expand_path(File.join(File.dirname(__FILE__),"../templates", "runit", )), "run.erb")
|
14
|
+
_cset :delayed_job_runit_control_q, File.join(File.expand_path(File.join(File.dirname(__FILE__),"../templates", "runit")), "control-q.erb")
|
15
|
+
_cset :delayed_job_runit_local_log_run, File.join(File.expand_path(File.join(File.dirname(__FILE__),"../templates", "runit")), "log-run.erb")
|
16
|
+
|
17
|
+
# monit configuration
|
18
|
+
_cset :delayed_job_monit_service_name, defer { "#{fetch(:user)}_#{fetch(:application)}_#{Capistrano::BaseHelper.environment}_delayed_job" }
|
19
|
+
_cset :delayed_job_monit_start_command, defer {"/bin/bash -c '[ ! -h #{Capistrano::RunitBase.service_path(fetch(:delayed_job_runit_service_name))}/run ] || /usr/bin/sv start #{Capistrano::RunitBase.service_path(fetch(:delayed_job_runit_service_name))}'"}
|
20
|
+
_cset :delayed_job_monit_stop_command, defer {"/usr/bin/sv -w 12 force-stop #{Capistrano::RunitBase.service_path(fetch(:delayed_job_runit_service_name))}"}
|
21
|
+
_cset :delayed_job_monit_memory_alert_threshold, "45.0 MB for 2 cycles"
|
22
|
+
_cset :delayed_job_monit_memory_restart_threshold, "50.0 MB for 3 cycles"
|
23
|
+
_cset :delayed_job_monit_cpu_alert_threshold, "90% for 2 cycles"
|
24
|
+
_cset :delayed_job_monit_cpu_restart_threshold, "95% for 5 cycles"
|
25
|
+
|
26
|
+
_cset :delayed_job_local_monit_config, File.join(File.expand_path(File.join(File.dirname(__FILE__),"../templates", "monit")), "delayed_job.conf.erb")
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Delayed Job - Monit
|
2
|
+
# Setup and management of Monit for Delayed Job
|
3
|
+
#
|
4
|
+
require 'capistrano-base_helper/base_helper'
|
5
|
+
require 'capistrano-base_helper/monit_base'
|
6
|
+
|
7
|
+
Capistrano::Configuration.instance(true).load do
|
8
|
+
after "monit:setup", "delayed_job:monit:setup"
|
9
|
+
after "delayed_job:monit:setup", "delayed_job:monit:enable"
|
10
|
+
after "delayed_job:monit:enable", "monit:reload"
|
11
|
+
|
12
|
+
before "delayed_job:monit.disable", "delayed_job:monit:unmonitor"
|
13
|
+
after "delayed_job:monit:disable", "monit:reload"
|
14
|
+
|
15
|
+
# start service after update in case it has not been stopped
|
16
|
+
# after "deploy:update", "delayed_job:monit:start"
|
17
|
+
# Not needed?
|
18
|
+
|
19
|
+
namespace :delayed_job do
|
20
|
+
namespace :monit do
|
21
|
+
desc "Setup Delayed Job monit-service"
|
22
|
+
task :setup, :roles => [:app, :web, :db] do
|
23
|
+
# Upload configuration
|
24
|
+
Capistrano::BaseHelper::generate_and_upload_config(delayed_job_local_monit_config, File.join(fetch(:monit_available_path), "#{fetch(:delayed_job_runit_service_name)}.conf"))
|
25
|
+
# Enable monitor
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Enable monit services for Delayed Job"
|
29
|
+
task :enable, :roles => [:app, :web, :db] do
|
30
|
+
Capistrano::MonitBase::Service.enable("#{fetch(:delayed_job_runit_service_name)}.conf")
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Disable and stop monit services for Delayed Job"
|
34
|
+
task :disable, :roles => [:app, :web, :db] do
|
35
|
+
Capistrano::MonitBase::Service.disable("#{fetch(:delayed_job_runit_service_name)}.conf")
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Start monit services for Delayed Job (will also try to start the service)"
|
39
|
+
task :start, :roles => [:app, :web, :db] do
|
40
|
+
Capistrano::MonitBase::Service.command_monit("start", fetch(:delayed_job_monit_service_name))
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Stop monit services for Delayed Job (will also stop the service)"
|
44
|
+
task :stop, :roles => [:app, :web, :db] do
|
45
|
+
Capistrano::MonitBase::Service.command_monit("stop", fetch(:delayed_job_monit_service_name))
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Restart monit services for Delayed Job"
|
49
|
+
task :restart, :roles => [:app, :web, :db] do
|
50
|
+
Capistrano::MonitBase::Service.command_monit("restart", fetch(:delayed_job_monit_service_name))
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Monitor Delayed Job"
|
54
|
+
task :monitor, :roles => [:app, :web, :db] do
|
55
|
+
Capistrano::MonitBase::Service.command_monit("monitor", fetch(:delayed_job_monit_service_name))
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Unmonitor Delayed Job"
|
59
|
+
task :unmonitor, :roles => [:app, :web, :db] do
|
60
|
+
Capistrano::MonitBase::Service.command_monit("unmonitor", fetch(:delayed_job_monit_service_name))
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Purge Delayed Job monit configuration"
|
64
|
+
task :unmonitor, :roles => [:app, :web, :db], :on_error => :continue do
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Delayed Job - Runit
|
2
|
+
|
3
|
+
require 'capistrano-base_helper/base_helper'
|
4
|
+
require 'capistrano-base_helper/runit_base'
|
5
|
+
|
6
|
+
Capistrano::Configuration.instance(true).load do
|
7
|
+
after "deploy:setup", "delayed_job:runit:setup"
|
8
|
+
|
9
|
+
# enable service after update in case it has not been setup or is disabled
|
10
|
+
# Service should probably be started as well?
|
11
|
+
after "deploy:update", "delayed_job:runit:enable"
|
12
|
+
after "delayed_job:runit:quit", "delayed_job:runit:stop"
|
13
|
+
|
14
|
+
namespace :delayed_job do
|
15
|
+
namespace :runit do
|
16
|
+
desc "Setup Delayed Job runit-service"
|
17
|
+
task :setup, :roles => :app do
|
18
|
+
# Create runit config
|
19
|
+
Capistrano::RunitBase.create_service_dir(delayed_job_runit_service_name)
|
20
|
+
Capistrano::BaseHelper::generate_and_upload_config(delayed_job_runit_local_config, Capistrano::RunitBase.remote_run_config_path(delayed_job_runit_service_name))
|
21
|
+
# must use quit script for stop as well
|
22
|
+
# Capistrano::BaseHelper::generate_and_upload_config(delayed_job_runit_control_q, Capistrano::RunitBase.remote_control_path(delayed_job_runit_service_name, "q"))
|
23
|
+
# Capistrano::BaseHelper::generate_and_upload_config(delayed_job_runit_control_q, Capistrano::RunitBase.remote_control_path(delayed_job_runit_service_name, "s"))
|
24
|
+
|
25
|
+
# Log run script
|
26
|
+
Capistrano::BaseHelper::generate_and_upload_config(delayed_job_runit_local_log_run, Capistrano::RunitBase.remote_service_log_run_path(delayed_job_runit_service_name))
|
27
|
+
|
28
|
+
# Make scripts executable
|
29
|
+
Capistrano::RunitBase.make_service_scripts_executeable(delayed_job_runit_service_name)
|
30
|
+
|
31
|
+
# Set correct permissions/owner on log path
|
32
|
+
Capistrano::RunitBase.create_and_permissions_on_path(fetch(:delayed_job_log_path))
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Enable Delayed Job runit-service"
|
36
|
+
task :enable, :roles => :app do
|
37
|
+
Capistrano::RunitBase.enable_service(delayed_job_runit_service_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Disable Delayed Job runit-service"
|
41
|
+
task :disable, :roles => :app do
|
42
|
+
Capistrano::RunitBase.disable_service(delayed_job_runit_service_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Start Delayed Job runit-service"
|
46
|
+
task :start, :roles => :app do
|
47
|
+
Capistrano::RunitBase.start_service(delayed_job_runit_service_name)
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Start Delayed Job runit-service only ONCE (no supervision...)"
|
51
|
+
task :once, :roles => :app do
|
52
|
+
Capistrano::RunitBase.start_service_once(delayed_job_runit_service_name)
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Stop Delayed Job runit-service"
|
56
|
+
task :stop, :roles => :app, :on_error => :continue do
|
57
|
+
# have to use force-stop on failed stop, since delayed_job might not terminate properly
|
58
|
+
# will wait 25 seconds for delayed_job to shut down, to allow it to serve any on-going requests
|
59
|
+
Capistrano::RunitBase.control_service(delayed_job_runit_service_name, "force-stop", false, "-w 25")
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Quit the Delayed Job runit-service"
|
63
|
+
task :quit, :roles => :app, :on_error => :continue do
|
64
|
+
Capistrano::RunitBase.control_service(delayed_job_runit_service_name, "quit")
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Restart Delayed Job runit-service"
|
68
|
+
task :restart, :roles => :app do
|
69
|
+
Capistrano::RunitBase.control_service(delayed_job_runit_service_name, "restart")
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Purge Delayed Job runit configuration"
|
73
|
+
task :purge, :roles => :app, :on_error => :continue do
|
74
|
+
Capistrano::RunitBase.force_control_service(delayed_job_runit_service_name, "force-stop", true)
|
75
|
+
Capistrano::RunitBase.purge_service(delayed_job_runit_service_name)
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Monit configuration for Delayed Job
|
2
|
+
# <% c = Capistrano::BaseHelper::get_capistrano_instance %>
|
3
|
+
# <%= "#{c.fetch(:application)} running as #{c.fetch(:user)} in environment #{Capistrano::BaseHelper.environment}" %>
|
4
|
+
#
|
5
|
+
# Service name: <%= c.fetch(:delayed_job_monit_service_name) %>
|
6
|
+
#
|
7
|
+
check process <%= c.fetch(:delayed_job_monit_service_name) %>
|
8
|
+
with pidfile <%= c.fetch(:delayed_job_pid_file) %>
|
9
|
+
start program = "<%= c.fetch(:delayed_job_monit_start_command) %>"
|
10
|
+
stop program = "<%= c.fetch(:delayed_job_monit_stop_command) %>"
|
11
|
+
<%= "if mem is greater than #{c.fetch(:delayed_job_monit_memory_alert_threshold)} then alert" unless c.fetch(:delayed_job_monit_memory_alert_threshold).nil? %>
|
12
|
+
<%= "if mem is greater than #{c.fetch(:delayed_job_monit_memory_restart_threshold)} then restart" unless c.fetch(:delayed_job_monit_memory_restart_threshold).nil? %>
|
13
|
+
<%= "if cpu is greater than #{c.fetch(:delayed_job_monit_cpu_alert_threshold)} then alert" unless c.fetch(:delayed_job_monit_cpu_alert_threshold).nil? %>
|
14
|
+
<%= "if cpu is greater than #{c.fetch(:delayed_job_monit_cpu_restart_threshold)} then restart" unless c.fetch(:delayed_job_monit_cpu_restart_threshold).nil? %>
|
15
|
+
|
16
|
+
group <%= c.fetch(:monit_application_group_name) %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/sh -e
|
2
|
+
<% c = Capistrano::BaseHelper::get_capistrano_instance %>
|
3
|
+
# Log output for delayed_job running on <%= c.fetch(:application) %> running as <%= c.fetch(:user) %>
|
4
|
+
# make sure the log directory exists
|
5
|
+
mkdir -p "<%= c.fetch(:delayed_job_log_path) %>"
|
6
|
+
# change path to the log directory
|
7
|
+
cd "<%= c.fetch(:delayed_job_log_path) %>"
|
8
|
+
# start logging
|
9
|
+
# exec chpst -u syslog svlogd -tt "<%= c.fetch(:delayed_job_log_path) %>"
|
10
|
+
exec svlogd -tt "<%= c.fetch(:delayed_job_log_path) %>"
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-delayed_job
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Leif Ringstad
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.15.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.15.5
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: capistrano-base_helper
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.0.3
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.0.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.3.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jeweler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.6
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.6
|
78
|
+
description: Capistrano recipes for Delayed Job using runit and monit.
|
79
|
+
email: leifcr@gmail.com
|
80
|
+
executables: []
|
81
|
+
extensions: []
|
82
|
+
extra_rdoc_files:
|
83
|
+
- LICENSE
|
84
|
+
- README.md
|
85
|
+
files:
|
86
|
+
- Gemfile
|
87
|
+
- Gemfile.lock
|
88
|
+
- LICENSE
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- VERSION
|
92
|
+
- capistrano-delayed_job.rb
|
93
|
+
- capistrano-delayed_job/config.rb
|
94
|
+
- capistrano-delayed_job/monit.rb
|
95
|
+
- capistrano-delayed_job/runit.rb
|
96
|
+
- templates/monit/delayed_job.conf.erb
|
97
|
+
- templates/runit/log-run.erb
|
98
|
+
- templates/runit/run.erb
|
99
|
+
homepage: https://github.com/leifcr/capistrano-delayed_job
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
hash: -1879143255629248842
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 1.8.25
|
124
|
+
signing_key:
|
125
|
+
specification_version: 3
|
126
|
+
summary: Capistrano recipes for Delayed Job using runit and monit
|
127
|
+
test_files: []
|