capistrano-racecar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/README.md +95 -0
- data/Rakefile +1 -0
- data/capistrano-racecar.gemspec +24 -0
- data/lib/capistrano-racecar.rb +0 -0
- data/lib/capistrano/racecar.rb +18 -0
- data/lib/capistrano/tasks/racecar.rake +53 -0
- data/lib/capistrano/tasks/version.rb +3 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2924fa4223d81d17ea96903284a7d3fb763aa63195ab84a31a3ac682a777ceeb
|
4
|
+
data.tar.gz: efd11cc844706df3fb57eead2da57775d62b67c80587faf2d047b2de25d53a3d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6aa476405928c3bd2d05bcad2cea501f4f6f8f3d65fce2b82ae735bd8ecc1f6b22b01cc0631066a4af6805a4d85f559a8900ebb6eee0aa9c1ee219ce3c547efc
|
7
|
+
data.tar.gz: 2d674bf087451936e7bb6ef1eec6c2f5f66565de6e53040cd70b62bcc0ec99742e96f4f117078cb21b4b3cc15eb754943c239c1e43c159f698011acb27759192
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
[](http://badge.fury.io/rb/capistrano-sidekiq)
|
2
|
+
|
3
|
+
# Capistrano::Sidekiq
|
4
|
+
|
5
|
+
Sidekiq integration for Capistrano
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
gem 'capistrano-sidekiq', group: :development
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
```ruby
|
18
|
+
# Capfile
|
19
|
+
|
20
|
+
require 'capistrano/sidekiq'
|
21
|
+
install_plugin Capistrano::Sidekiq # Default sidekiq tasks
|
22
|
+
# Then select your service manager
|
23
|
+
install_plugin Capistrano::Sidekiq::Systemd
|
24
|
+
# or
|
25
|
+
install_plugin Capistrano::Sidekiq::Upstart # tests needed
|
26
|
+
# or
|
27
|
+
install_plugin Capistrano::Sidekiq::Monit # tests needed
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
Configurable options, shown here with defaults:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
:sidekiq_roles => :app
|
35
|
+
:sidekiq_default_hooks => true
|
36
|
+
:sidekiq_pid => File.join(shared_path, 'tmp', 'pids', 'sidekiq.pid') # ensure this path exists in production before deploying.
|
37
|
+
:sidekiq_env => fetch(:rack_env, fetch(:rails_env, fetch(:stage)))
|
38
|
+
:sidekiq_log => File.join(shared_path, 'log', 'sidekiq.log')
|
39
|
+
|
40
|
+
# sidekiq systemd options
|
41
|
+
:sidekiq_service_unit_name => 'sidekiq'
|
42
|
+
:sidekiq_service_unit_user => :user # :system
|
43
|
+
:sidekiq_enable_lingering => true
|
44
|
+
:sidekiq_lingering_user => nil
|
45
|
+
|
46
|
+
# sidekiq monit
|
47
|
+
:sidekiq_monit_templates_path => 'config/deploy/templates'
|
48
|
+
:sidekiq_monit_conf_dir => '/etc/monit/conf.d'
|
49
|
+
:sidekiq_monit_use_sudo => true
|
50
|
+
:monit_bin => '/usr/bin/monit'
|
51
|
+
:sidekiq_monit_default_hooks => true
|
52
|
+
:sidekiq_monit_group => nil
|
53
|
+
:sidekiq_service_name => "sidekiq_#{fetch(:application)}"
|
54
|
+
|
55
|
+
:sidekiq_user => nil #user to run sidekiq as
|
56
|
+
```
|
57
|
+
|
58
|
+
## Known issues with Capistrano 3
|
59
|
+
|
60
|
+
There is a known bug that prevents sidekiq from starting when pty is true on Capistrano 3.
|
61
|
+
```ruby
|
62
|
+
set :pty, false
|
63
|
+
```
|
64
|
+
|
65
|
+
## Bundler
|
66
|
+
|
67
|
+
If you'd like to prepend `bundle exec` to your sidekiq and sidekiqctl calls, modify the SSHKit command maps
|
68
|
+
in your deploy.rb file:
|
69
|
+
```ruby
|
70
|
+
SSHKit.config.command_map[:sidekiq] = "bundle exec sidekiq"
|
71
|
+
SSHKit.config.command_map[:sidekiqctl] = "bundle exec sidekiqctl"
|
72
|
+
```
|
73
|
+
|
74
|
+
|
75
|
+
## Customizing the monit sidekiq templates
|
76
|
+
|
77
|
+
If you need change some config in redactor, you can
|
78
|
+
|
79
|
+
```
|
80
|
+
bundle exec rails generate capistrano:sidekiq:monit:template
|
81
|
+
```
|
82
|
+
|
83
|
+
If your deploy user has no need in `sudo` for using monit, you can disable it as follows:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
set :sidekiq_monit_use_sudo, false
|
87
|
+
```
|
88
|
+
|
89
|
+
## Contributing
|
90
|
+
|
91
|
+
1. Fork it
|
92
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
93
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
94
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
95
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/tasks/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'capistrano-racecar'
|
8
|
+
spec.version = Capistrano::RacecarVERSION
|
9
|
+
spec.authors = ['ZengTao']
|
10
|
+
spec.email = ['so.zengtao@gmail.com']
|
11
|
+
spec.summary = %q{Racecar integration for Capistrano}
|
12
|
+
spec.description = %q{Racecar integration for Capistrano}
|
13
|
+
spec.homepage = 'https://github.com/helloworld/capistrano-racecar'
|
14
|
+
spec.license = 'LGPL-3.0'
|
15
|
+
|
16
|
+
spec.required_ruby_version = '>= 2.0.0'
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'capistrano', '>= 3.9.0'
|
21
|
+
spec.add_dependency 'capistrano-bundler'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'pry'
|
24
|
+
end
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'capistrano/bundler'
|
2
|
+
require 'capistrano/plugin'
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
class Racecar < Capistrano::Plugin
|
6
|
+
def define_tasks
|
7
|
+
eval_rakefile File.expand_path('../tasks/racecar.rake', __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_defaults
|
11
|
+
set_if_empty :racecar_task_path, 'config/racecar_task.yml'
|
12
|
+
set_if_empty :racecar_role, :app
|
13
|
+
set_if_empty :racecar_user, :system
|
14
|
+
set_if_empty :racecar_ctl, 'bundle exec racecarctl'
|
15
|
+
set_if_empty :racecar_pid_path, "#{fetch(:deploy_to)}/shared/tmp/pids"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
git_plugin = self
|
2
|
+
|
3
|
+
namespace :racecar do
|
4
|
+
|
5
|
+
def consumer_list
|
6
|
+
YAML.parse_file(fetch(:racecar_task_path)).to_ruby['tasks']
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_pid_file(consumer_name)
|
10
|
+
"#{fetch(:racecar_pid_path)}/#{consumer_name.downcase}.pid"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Test'
|
14
|
+
task :test do
|
15
|
+
on roles(fetch(:racecar_role)) do |role|
|
16
|
+
within release_path do
|
17
|
+
with rails_env: fetch(:rails_env) do
|
18
|
+
info fetch(:racecar_pid_path)
|
19
|
+
git_plugin.consumer_list.each { |item|
|
20
|
+
git_plugin.build_pid_file(item)
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Start'
|
28
|
+
task :start do
|
29
|
+
on roles(fetch(:racecar_role)) do |role|
|
30
|
+
within current_path do
|
31
|
+
with rails_env: fetch(:rails_env) do
|
32
|
+
git_plugin.consumer_list.each do |item|
|
33
|
+
execute(:bundle, "exec racecar --daemonize #{item} --pidfile #{git_plugin.build_pid_file(item)}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task :stop do
|
41
|
+
on roles(fetch(:racecar_role)) do |role|
|
42
|
+
within current_path do
|
43
|
+
with rails_env: fetch(:rails_env) do
|
44
|
+
git_plugin.consumer_list.each do |item|
|
45
|
+
execute(:bundle, "exec racecarctl stop --pidfile #{git_plugin.build_pid_file(item)}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-racecar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ZengTao
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.9.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: capistrano-bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Racecar integration for Capistrano
|
56
|
+
email:
|
57
|
+
- so.zengtao@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- capistrano-racecar.gemspec
|
67
|
+
- lib/capistrano-racecar.rb
|
68
|
+
- lib/capistrano/racecar.rb
|
69
|
+
- lib/capistrano/tasks/racecar.rake
|
70
|
+
- lib/capistrano/tasks/version.rb
|
71
|
+
homepage: https://github.com/helloworld/capistrano-racecar
|
72
|
+
licenses:
|
73
|
+
- LGPL-3.0
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 2.0.0
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubygems_version: 3.2.3
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Racecar integration for Capistrano
|
94
|
+
test_files: []
|