capistrano-runit 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/LICENSE +7 -0
- data/capistrano-runit.gemspec +1 -1
- data/lib/capistrano-runit/recipes.rb +2 -0
- data/lib/capistrano-runit/recipes/base.rb +1 -1
- data/lib/capistrano-runit/recipes/delayed_job.rb +1 -1
- data/lib/capistrano-runit/recipes/resque.rb +1 -1
- data/lib/capistrano-runit/recipes/sidekiq.rb +49 -0
- data/lib/capistrano-runit/recipes/thinking_sphinx.rb +47 -0
- data/lib/capistrano-runit/templates/run-sidekiq.erb +3 -0
- data/lib/capistrano-runit/templates/run-sphinx.erb +4 -0
- data/lib/capistrano-runit/templates/run-unicorn.erb +1 -1
- metadata +36 -50
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 1.1.3 2013-04-19
|
2
|
+
|
3
|
+
* Added recipes for sidekiq.
|
4
|
+
* Fixed: runit:setup should run on servers with db-role too.
|
5
|
+
* Added recipes for thinking-sphinx.
|
6
|
+
* Use rails_env variable instead of hardwired 'production' in run-unicorn.
|
7
|
+
|
1
8
|
=== 1.1.2 2011-11-05
|
2
9
|
|
3
10
|
* Added double quotes for environment variables values.
|
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2011-2013 Anton Ageev
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/capistrano-runit.gemspec
CHANGED
@@ -2,3 +2,5 @@ require "capistrano-runit/recipes/base"
|
|
2
2
|
require "capistrano-runit/recipes/unicorn"
|
3
3
|
require "capistrano-runit/recipes/delayed_job"
|
4
4
|
require "capistrano-runit/recipes/resque"
|
5
|
+
require "capistrano-runit/recipes/sidekiq"
|
6
|
+
require "capistrano-runit/recipes/thinking_sphinx"
|
@@ -3,7 +3,7 @@ Capistrano::Configuration.instance(true).load do
|
|
3
3
|
|
4
4
|
namespace :runit do
|
5
5
|
desc "Setup runit directories"
|
6
|
-
task :setup, :roles => :app do
|
6
|
+
task :setup, :roles => [:app, :db] do
|
7
7
|
run "[ -d #{runit_dir}/.env ] || mkdir -p #{runit_dir}/.env"
|
8
8
|
run "echo $HOME > #{runit_dir}/.env/HOME"
|
9
9
|
run "[ -d #{runit_dir}/available ] || mkdir -p #{runit_dir}/available"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Capistrano::Configuration.instance(true).load do
|
2
2
|
_cset :runit_delayed_job_service_name, "delayed_job"
|
3
3
|
_cset :runit_delayed_job_template, File.expand_path(File.join(File.dirname(__FILE__), "../templates/run-delayed_job.erb"))
|
4
|
-
_cset :runit_delayed_job_environment, defer { { "RAILS_ENV" => fetch(:rails_env) } }
|
4
|
+
_cset :runit_delayed_job_environment, defer { { "RAILS_ENV" => fetch(:rails_env, "production") } }
|
5
5
|
_cset :runit_delayed_job_command, "./script/delayed_job"
|
6
6
|
|
7
7
|
namespace :runit do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Capistrano::Configuration.instance(true).load do
|
2
2
|
_cset :runit_resque_service_name, "resque"
|
3
3
|
_cset :runit_resque_template, File.expand_path(File.join(File.dirname(__FILE__), "../templates/run-resque.erb"))
|
4
|
-
_cset :runit_resque_environment, defer { { "RAILS_ENV" => fetch(:rails_env) } }
|
4
|
+
_cset :runit_resque_environment, defer { { "RAILS_ENV" => fetch(:rails_env, "production") } }
|
5
5
|
_cset :runit_resque_command, defer { "#{rake} environment resque:work" }
|
6
6
|
_cset :runit_resque_queue, "*"
|
7
7
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Capistrano::Configuration.instance(true).load do
|
2
|
+
_cset :runit_sidekiq_service_name, "sidekiq"
|
3
|
+
_cset :runit_sidekiq_template, File.expand_path(File.join(File.dirname(__FILE__), "../templates/run-sidekiq.erb"))
|
4
|
+
_cset :runit_sidekiq_environment, {}
|
5
|
+
_cset :runit_sidekiq_command, "sidekiq"
|
6
|
+
_cset :runit_sidekiq_queues, ["default"]
|
7
|
+
_cset :runit_sidekiq_processes, 4
|
8
|
+
|
9
|
+
namespace :runit do
|
10
|
+
namespace :sidekiq do
|
11
|
+
desc "Setup sidekiq runit-service"
|
12
|
+
task :setup, :roles => :app do
|
13
|
+
run "[ -d #{runit_dir}/available/#{runit_sidekiq_service_name} ] || mkdir -p #{runit_dir}/available/#{runit_sidekiq_service_name}"
|
14
|
+
template = File.read(runit_sidekiq_template)
|
15
|
+
erb_template = ERB.new(template)
|
16
|
+
servers = find_servers_for_task(current_task)
|
17
|
+
servers.each do |server|
|
18
|
+
put erb_template.result(binding), "#{runit_dir}/available/#{runit_sidekiq_service_name}/run", :mode => 0755, :hosts => server.host
|
19
|
+
end
|
20
|
+
find_and_execute_task "runit:sidekiq:enable"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Enable sidekiq runit-service"
|
24
|
+
task :enable, :roles => :app do
|
25
|
+
run "cd #{runit_dir}/enabled && [ -h ./#{runit_sidekiq_service_name} ] || ln -sf ../available/#{runit_sidekiq_service_name} ."
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Disable sidekiq runit-service"
|
29
|
+
task :disable, :roles => :app do
|
30
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_sidekiq_service_name} ] || sv stop #{runit_dir}/enabled/#{runit_sidekiq_service_name}/ && rm -f #{runit_dir}/enabled/#{runit_sidekiq_service_name}"
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Start sidekiq runit-service"
|
34
|
+
task :start, :roles => :app do
|
35
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_sidekiq_service_name} ] || sv start #{runit_dir}/enabled/#{runit_sidekiq_service_name}/"
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Stop sidekiq runit-service"
|
39
|
+
task :stop, :roles => :app do
|
40
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_sidekiq_service_name} ] || sv stop #{runit_dir}/enabled/#{runit_sidekiq_service_name}/"
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Restart sidekiq runit-service"
|
44
|
+
task :restart, :roles => :app do
|
45
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_sidekiq_service_name} ] || sv restart #{runit_dir}/enabled/#{runit_sidekiq_service_name}/"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Capistrano::Configuration.instance(true).load do
|
2
|
+
_cset :runit_thinking_sphinx_service_name, "sphinx"
|
3
|
+
_cset :runit_thinking_sphinx_template, File.expand_path(File.join(File.dirname(__FILE__), "../templates/run-sphinx.erb"))
|
4
|
+
_cset :runit_thinking_sphinx_environment, defer { fetch(:rails_env, "production") }
|
5
|
+
_cset :runit_thinking_sphinx_searchd_command, "/usr/bin/searchd"
|
6
|
+
|
7
|
+
namespace :runit do
|
8
|
+
namespace :thinking_sphinx do
|
9
|
+
desc "Setup Thinking Sphinx runit-service"
|
10
|
+
task :setup, :roles => :db do
|
11
|
+
run "[ -d #{runit_dir}/available/#{runit_thinking_sphinx_service_name} ] || mkdir -p #{runit_dir}/available/#{runit_thinking_sphinx_service_name}"
|
12
|
+
template = File.read(runit_thinking_sphinx_template)
|
13
|
+
erb_template = ERB.new(template)
|
14
|
+
servers = find_servers_for_task(current_task)
|
15
|
+
servers.each do |server|
|
16
|
+
put erb_template.result(binding), "#{runit_dir}/available/#{runit_thinking_sphinx_service_name}/run", :mode => 0755, :hosts => server.host
|
17
|
+
end
|
18
|
+
find_and_execute_task "runit:thinking_sphinx:enable"
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Enable Thinking Sphinx runit-service"
|
22
|
+
task :enable, :roles => :db do
|
23
|
+
run "cd #{runit_dir}/enabled && [ -h ./#{runit_thinking_sphinx_service_name} ] || ln -sf ../available/#{runit_thinking_sphinx_service_name} ."
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Disable Thinking Sphinx runit-service"
|
27
|
+
task :disable, :roles => :db do
|
28
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name} ] || sv stop #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name}/ && rm -f #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name}"
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Start Thinking Sphinx runit-service"
|
32
|
+
task :start, :roles => :db do
|
33
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name} ] || sv start #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name}/"
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Stop Thinking Sphinx runit-service"
|
37
|
+
task :stop, :roles => :db do
|
38
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name} ] || sv stop #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name}/"
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Restart Thinking Sphinx runit-service"
|
42
|
+
task :restart, :roles => :db do
|
43
|
+
run "[ ! -h #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name} ] || sv restart #{runit_dir}/enabled/#{runit_thinking_sphinx_service_name}/"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,3 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
cd <%= current_path %>
|
3
|
+
<%= fetch(:default_environment, {}).map { |k, v| "#{k}=\"#{v}\"" }.join(" ") %> <%= runit_sidekiq_environment.map { |k, v| "#{k}=\"#{v}\"" }.join(" ") %> exec <%= runit_sidekiq_command %> -e <%= fetch(:rails_env, "production") %> -g <%= application %> -c <%= fetch(:runit_sidekiq_processes, 4) %> <%= runit_sidekiq_queues.map { |q| "-q #{q}" }.join(" ") %> -L <%= File.join(shared_path, "log", "sidekiq.#{fetch(:rails_env, "production")}.log") %> -P <%= File.join(shared_path, "pids", "sidekiq.pid") %>
|
@@ -125,7 +125,7 @@ if [ ! $RUNNING ]; then
|
|
125
125
|
echo "Starting unicorn"
|
126
126
|
old=$(pwd)
|
127
127
|
cd $APP_DIR
|
128
|
-
<%= fetch(:default_environment, {}).map { |k, v| "#{k}=\"#{v}\"" }.join(" ") %> <%= runit_unicorn_command %> -E production -c $THIS_DIR/unicorn.rb -D
|
128
|
+
<%= fetch(:default_environment, {}).map { |k, v| "#{k}=\"#{v}\"" }.join(" ") %> <%= runit_unicorn_command %> -E <%= fetch(:rails_env, "production") %> -c $THIS_DIR/unicorn.rb -D
|
129
129
|
cd $old
|
130
130
|
sleep 2
|
131
131
|
CUR_PID=$(cat $CUR_PID_FILE)
|
metadata
CHANGED
@@ -1,92 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-runit
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 1.1.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Anton Ageev
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: capistrano
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 15
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 0
|
32
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 2.0.0
|
34
22
|
type: :runtime
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.0
|
36
30
|
description:
|
37
31
|
email: antage@gmail.com
|
38
32
|
executables: []
|
39
|
-
|
40
33
|
extensions: []
|
41
|
-
|
42
34
|
extra_rdoc_files: []
|
43
|
-
|
44
|
-
files:
|
35
|
+
files:
|
45
36
|
- .gitignore
|
46
37
|
- Gemfile
|
47
38
|
- History.txt
|
39
|
+
- LICENSE
|
48
40
|
- README.markdown
|
49
41
|
- capistrano-runit.gemspec
|
50
42
|
- lib/capistrano-runit/recipes.rb
|
51
43
|
- lib/capistrano-runit/recipes/base.rb
|
52
44
|
- lib/capistrano-runit/recipes/delayed_job.rb
|
53
45
|
- lib/capistrano-runit/recipes/resque.rb
|
46
|
+
- lib/capistrano-runit/recipes/sidekiq.rb
|
47
|
+
- lib/capistrano-runit/recipes/thinking_sphinx.rb
|
54
48
|
- lib/capistrano-runit/recipes/unicorn.rb
|
55
49
|
- lib/capistrano-runit/templates/run-delayed_job.erb
|
56
50
|
- lib/capistrano-runit/templates/run-resque.erb
|
51
|
+
- lib/capistrano-runit/templates/run-sidekiq.erb
|
52
|
+
- lib/capistrano-runit/templates/run-sphinx.erb
|
57
53
|
- lib/capistrano-runit/templates/run-unicorn.erb
|
58
54
|
homepage: https://github.com/antage/capistrano-runit
|
59
55
|
licenses: []
|
60
|
-
|
61
56
|
post_install_message:
|
62
57
|
rdoc_options: []
|
63
|
-
|
64
|
-
require_paths:
|
58
|
+
require_paths:
|
65
59
|
- lib
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
61
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
67
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
segments:
|
82
|
-
- 0
|
83
|
-
version: "0"
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
84
72
|
requirements: []
|
85
|
-
|
86
73
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.8.23
|
88
75
|
signing_key:
|
89
76
|
specification_version: 3
|
90
77
|
summary: Useful deployment recipes.
|
91
78
|
test_files: []
|
92
|
-
|